HPE Software is now Micro Focus
HPE Software is now Micro Focus
IT Operations Management (ITOM)

Keys to automated policy management and aspect assignment using the new OMi CLIs

Keys to automated policy management and aspect assignment using the new OMi CLIs


Micro Focus Operations Manager i 10.62 comes with new command-line interface (CLI) tools that enable end-to-end automated policy management and aspect assignment. These new CLI tools – opr-template, opr-config-tool and opr-assign – were developed to facilitate and automate a number of policy management tasks, such as performing mass updates on policy templates, deploying aspects to CIs or deleting policy templates outside of the OMi UI (for example, in situations when an update is requested through a customer self-service portal).

  • opr-template enables you to edit policies outside of the OMi Policy Editor interface. With this tool, you can download a policy (or multiple policies) from OMi to a location of your choice, edit the policy and then upload it back to OMi.
  • opr-config-tool enables you to update aspects and management templates to use the modified policies. For example, when a new policy version is created, you can run this tool to get a list of aspects and management templates affected by the change and then update aspects and management templates to use the latest policy version.
  • opr-assign enables you to update assignments to use the latest version of an aspect or a management template or to create new assignments.

The detailed information about these CLI commands, together with the description of all available command options and the corresponding examples, is provided in the OMi online help.

Now that you've been introduced to the new CLIs, let us review a couple of use cases.

Use Case 1: Set up monitoring for a new CI by deploying an aspect to that CI

The high-level procedure for this use case is shown in the diagram below:




These steps describe how to deploy monitoring to a new CI by assigning an aspect:

  1. Retrieve the CI ID by running opr-ci-list -node_list <node name>.

  2. Get a list of aspects (and their versions) by running opr-config-tool -list -type aspect.

  3. Assign and deploy the aspect to the new CI:
    opr-assign -create_assignment_by_aspect -ci_id <CI ID> -id <Aspect ID> -parameter_value <Parameter1=Value1>. The output is displayed in the form AspectAssignment:<Aspect ID>:<CI ID>.

  4. Optional step. Later, you can adjust the parameter values of the created assignment:
    opr-assign -update_assignment -id <AspectAssignmentID> -parameter_value <Parameter1=ValueNew>.

For detailed information, see the OMi online help topics opr-ci-list Command-Line Interface, opr-config-tool Command-Line Interface, opr-assign Command-Line Interface and Policy Management CLI workflows.

Use Case 2: Automated policy management / policy editing outside of the OMi UI 

This is an example of a complex use case in which all three CLIs are used. In this use case, policy templates are edited outside of the OMi UI and then rolled out to the corresponding nodes.

Note: Developing new policies outside of OMi is possible but not recommended, as the policy syntax varies depending on the policy type. This makes creating policies from scratch a very complex task that requires extensive know-how of the policy syntax.

For policy changes outside of the OMi UI we recommend a workflow outlined in the following diagram:



Now let’s review each step of the workflow in more detail. For additional information, see the OMi online help topic Policy Management CLI workflows.

  1. Use the Policy Templates section of the OMi Monitoring UI to create your initial policies as described in the OMi online help (refer to the Policy Templates section for detailed information).

  2. When an update of a policy template (or multiple policy templates) is required, download the policy from OMi to a directory of your choice using the opr-template CLI. The synopsis and the description of available options (together with the supporting examples) is provided in the OMi online help topic opr-template Command-Line Interface.

    Note: You can select to download either a policy template or an aspect; if no type is specified, policy template is selected by default.

    You can download policy templates individually or in chunks. The location for downloaded policies is specified using the option -output <directory>. For each downloaded policy, the output directory contains the following four files:

        - <policy_id>_data
        - <policy_id>_delta.xml
        - <policy_id>_header.xml
        - <policy_id>_params.xml

    The <policy_id>_delta.xml file must not be changed as it is used by OMi internally to detect policy modifications. Three remaining files can be edited as follows:

        - Edit <policy_id>_data to add conditions and change fix values. (Be aware that this is the crucial part of a policy that contains log file patterns, SNMP trap match conditions, monitoring thresholds, etc., depending on the policy type.)
        - Edit <policy_id>_header.xml to change general information, such as the policy template name, version, type, required instrumentation, categories and supported operating systems.
        - Edit <policy_id>_params.xml to add parameters and change parameter values.

    For detailed information about editing policy syntax, see the OMi online help topic Review the policy syntax.

  3. Make the necessary changes to the policy.

    You can edit all parts of a policy template, with the exception of the <policy_id>_delta.xml file. The syntax of the individual elements is documented in the Review the policy syntax topic of the OMi online help.

    We recommend creating a policy template in the UI first, downloading it into the file system and then modifying the policy. It is not recommended to create a policy from scratch outside of OMi.

    Note: You can repeatedly edit the same policy files in the file system. In this case, policy versioning is implemented as follows:

        - opr-template checks if the version already exists in the database.
        - If yes, OMi increases the highest existing version by 1 and uses it for the new policy version to be stored in the database.
        - If no, OMi stores the new version in the database using the given number.

    The upload detects which policies were modified and ignores the rest. The upload also takes the policy IDs (version and container ID) into account, but the policy name and version are prioritized higher. We therefore recommend specifying the policy name and version instead of the ID.

    Tip:  You can validate the syntax of the modified policy by running:
    opr-template -check -input <directory or policy_header_file>

    The -check option looks for errors in all three parts of a policy template (data, header and parameter). You can validate individual policy templates (if you specify a policy header file *_header.xml) or all policies if you specify a directory. If a policy contains multiple errors, only the first error is displayed.
    Serious problems (such as communication errors or certificate issues) are returned immediately. In case of recoverable errors (for example, policy syntax errors), the command continues and prints a summary line.

  4. Upload the updated policies back to OMi by running the -upload -input <directory or policy_header_file> option of the opr-template CLI. Note that you can upload either an individual policy template or all policy templates in the specified directory.

    You can also use the opr-template CLI for various policy maintenance tasks, such as checking the policy syntax (already described in Step 3), listing policy templates, or a cleanup of redundant policy templates. The options used for these operations are -check, -list and -delete, respectively. See the OMi online help topic opr-template Command-Line Interface for more information.

  5. Update aspects/management templates to use the modified policies by running the opr-config-tool CLI. You can list, update and group policy templates, aspects and management templates. You can also add a policy template to an aspect and display aspects and management templates that need to be updated before consuming a new policy template or an aspect version. To run these operations, specify the appropriate command options as described in the OMi online help topic opr-config-tool Command-Line Interface.

    Note: Creating new aspects and management templates outside of OMi is currently not possible.

  6. Update assignments to use the modified aspects/MTs by running the opr-assign CLI. This CLI enables you to perform various operations related to assignments and auto assignment rules. You can create assignments for the latest version of an aspect or management template, or for a specific aspect or management template version. For more information on the opr-assign CLI and its options, see the topic opr-assign Command-Line Interface in the OMi online help.

If you have feedback or suggestions, don’t hesitate to comment on this article.

Explore full capabilities of Operations Bridge Suite via the Software Documentation Portal and take a look at our Operations Manager i, Operations Bridge Analytics, Operations Bridge Reporter, Operations Connector (OpsCx), Business Value Dashboard (BVD) and Operations Orchestration (OO) documentation!


To get more information on this release and how customers are using Operations Bridge, we are happy to announce the following events you can register for:

Vivit event – Operations Special Interest Group Webinar – 11th October 2017 – Watch on-demand here
ITOM Customer Forum, Brussels – December 7th 2017 – coming soon

Read all our news at the OpsBridge blog.


Explore all the capabilities of the Operations Bridge Suite and technology integrations by visiting these sites:

  • operations bridge
About the Author