createOrUpdatePolicy

Use the createOrUpdatePolicy command to create or update the specified policy directly in the sphere.

Creating or updating a policy might involve the following three steps:

  1. Generate the template settings document using the createSettingsDocument command.

  2. Edit the generated document to provide the specific values required for the policy being created.

  3. Create the policy using the createOrUpdatePolicy command, providing the settings document created in Step 2.

To create a new policy, you need to supply only a template name, type, and name. If the policy requires settings, you must also provide a settings document. You can provide additional information to more precisely identify the source template to specify the initial state of the policy, but these are not required.

To update a policy, you must provide a name, type, the -overwrite flag, and any arguments for elements you want to update. Any values you do not specify remain unchanged. Because the policy name and version identify the policy, you cannot use this command to change either. Instead, create a new policy with the desired name and/or version.

Command Syntax

btmcli createOrUpdatePolicy [-templateName templateName]
                            [-t type][-subType subType] [-templateVersion version]
                            -n name [-V version] [-desc description]
                            [-settings settingsDocument]
                            [-criteria criterion1 [criterion2]...]
                            [-enable] | [-disable]
                            [-overwrite] [-f]
                            [-s sphereUrl] -l username:password
Name Long Name Description
-templateName -- The name of the template on which to base the new policy.

This parameter is ignored when performing an update.

-t -type The policy type for the new policy.

This parameter is also used to determine if the specified policy already exists.

-subType -- The policy sub type for the new policy.

This parameter is also used to determine if the specified policy already exists.

-templateVersion -- The version of the template on which to base the created policy.

This parameter is ignored when performing an update.

-n -name The name of the new policy.

This parameter is also used to determine if the specified policy already exists.

-V -version The version of the new policy.

This parameter is also used to determine if the specified policy already exists.

-desc -description A description of the policy.
-settings -settingsDocument The policy's settings document, created with the createSettingsDocument command.
-criteria -- A list of application criteria for the policy. The form of each criterion is described below.
-enable -- Marks the policy as enabled.
-disable -- Marks the policy as disabled.
-overwrite -- Indicates that if the policy already exists, it should be updated with the specified information.
-f -force Update the policy even if it is marked internally as "cannot be updated."
-s -sphereUrl The URL of the sphere.

http://hostname:port/btmcentral/sphere/

This flag is not required if you have set the AP_SPHERE_URL environment variable for your sphere.

-l -userLogin The username and password associated with the sphere, in the format: username:password. This set of credentials must belong to a user in the btmadmin role.

See Security Options in Accessing CLI Commands for information on furnishing login credentials.

You can encrypt passwords using the encryptPassword command.


Application Criteria

When creating or modifying a policy, you can specify a set of criteria to be used in determining the monitored objects to which the policy can be applied. The format of each criterion in the set is as follows:

monitoredObjectType [;query [,{UNION | EXCLUDE}]]+

For detailed information on how to specify criteria visit http://www.oracle.com/support/contact.html or visit http://www.oracle.com/accessibility/support.html if you are hearing impaired.

Example

The following example shows the createOrUpdatePolicy command used to enable the enforcement of a pre-existing policy, MyPolicy.

btmcli createOrUpdatePolicy -name MyPolicy -enable
                            -s http://localhost:8080/btmcentral/sphere/ 
                            -l admin:abracadabra