Managing policies with the CLI

The policy command tool can be used to list policy objects, evaluate policies or objects, or evaluate policies or objects and apply the evaluated actions.

This section includes:

Policy tool CLI commands

Option

Argument

Description

--agent-policy

Name

The agent policy to evaluate.

Outputs a list of actions that the agent policy can apply.

--list-object-policies

Name

Evaluates an agent policy group.

Outputs a list of actions that the agent policy group can apply.

--apply

Not applicable

Apply the evaluated actions.

If not specified, policies are evaluated only. Actions are not applied, but the evaluated actions are output.

--as-host

Name

Application Service hostname.

--as-port

Number

Application Service port number.

--csv

filename

Write action output to a CSV format file.

--deep-copy-agent-policy

agent_policy_name

Deep copies an agent policy (requires --prefix and/or --suffix and requires --deep-copy-option and optionally --disable-deep-copy-policy-components).

--deep-copy-agent-policy-group

agent_policy_group_name

Deep copies an agent policy group (requires --prefix and/or --suffix and requires --deep-copy-option and optionally --disable-deep-copy-policy-components).

--deep-copy-object-policy

object_policy_name

Deep copies an object policy (requires --object-policy-type and requires --deep-copy-option and optionally --disable-deep-copy-policy-components).

--deep-copy-object-policy-group

object_policy_group_name

Deep copies an object policy group (requires --prefix and/or --suffix and requires --deep-copy-option and optionally --disable-deep-copy-policy-components).

--deep-copy-option

object_policy_group_name

The deep copy option specifying what to do if a copied policy component name already exists.

fail - fail when duplicate policy component name exists

replace - replace the existing named policy component with the copied one

use - use the existing named policy component instead of the copied one

--disable-deep-copy-policy-components

Not applicable

Disable all deep copied policy components. Otherwise, they are enabled.

--example

Not applicable

Includes example evaluation output (requires an evaluation option).

--json

Filename

Write action output to a JSON format file.

--list-agent-policies

Not applicable

List all agent policies.

--list-agent-policy-groups

Not applicable

List all agent policy groups.

--list-object-policies

Not applicable

List all object policies.

--list-object-policy-groups

Not applicable

Lists all object policy groups.

--object-name-path

Topic name path

Requires --object-type-path.

Name path of an object to evaluate against all policies. E.g. "myHost!myQmgr!myQueue".

Outputs a list of actions that apply to the object.

--object-type-path

Topic type path

Requires --object-name-path.

Type path of an object to evaluate against all policies. E.g.

ComMQSoftwareNetworkHost!ComMQSoftwareWebSphereMQQueueManager!ComMQSoftwareMQLocalQueue".

Outputs a list of actions that apply to the object.

--object-policy

Name

Requires --object-policy-type.

The object policy to evaluate.

Outputs a list of actions that apply to the object policy.

--object-policy-type

Type name

Requires --object-policy.

The type name of the object policy to evaluate (e.g. "ComMQSoftwareNetworkHost").

Outputs a list of actions that apply to the object policy.

--object-policy-group

Name

The object policy group to evaluate. Outputs a list of actions that apply to the object group policy.

--prefix

prefix

Prefix prepended to the policy component to form a new deep copy name.

--suffix

suffix

Suffix appended to the policy component to form a new deep copy name.

-? Or –h

Not applicable

Print out usage information.

-b

Not applicable

Run in batch mode

Runs the command in batch mode. Without this flag, you are prompted to press the Enter key (or to press Ctrl+c to cancel) before the command is processed. This flag disables that request.

-p

Password

Password. Use this password to access the services.

-s

Not applicable

Specify password via stdin. This is mutually exclusive with -p.

-silent

Not applicable

Runs silently. Suppresses output of evaluations. Ignored for list options.

Examples of how to use the Policy commands from the CLI

GoalCommand
List agent policies % policytool -b -p BMCSOFTWARE SA --list-agent-policies 
Evaluate the "WMQ_Agents" agent policy, output the actions to a JSON format file, but do not apply the actions.% policytool -b -p BMCSOFTWARE SA --agent-policy "WMQ_Agents" --json actions.json

Evaluate the "WMQ_Agents" agent policy, output the actions to the console, and apply the actions.

% policytool -b -p BMCSOFTWARE SA --agent-policy "WMQ_Agents" --apply

Evaluate an agent host against all matching policies and output the actions to the console, but do not apply the actions.

% policytool -b -p BMCSOFTWARE SA --object-name-path "myAgent" --object-type-path "ComMQSoftwareNetworkHost"

Was this page helpful? Yes No Submitting... Thank you

Comments