Develop > Command-Line Interfaces > opr-agt Command-Line Interface

opr-agt Command-Line Interface

You can use the opr-agt command-line interface (CLI) to manage and configure the HPE Operations Agent on one or more monitored nodes:

  • Get the current status of the agent processes.
  • Start or restart the agent processes.
  • Shut down (stop) the agent processes.
  • Return the version number of the installed HPE Operations Agent software.
  • Return the setting of configuration variables.
  • Set configuration variables to a specified value.
  • Switch the primary manager.
  • Deploy configuration.
  • Sets the primary manager for event reception (primary event receiver).

The opr-agt command-line interface first contacts the ClosedRTSM (Run-time Service Model) to retrieve a list of monitored nodes. It then contacts up to 50 nodes in parallel to perform the requested operation. When you run an operation on more than one monitored node, opr-agt displays the status immediately after a remote operation finishes for each node.

You can run opr-agt on a gateway or a data processing server. On the server, the server processes must be running, and the ovcd and ovbbccb processes must be running on the monitored node.

Location

<OMi_HOME>/opr/bin/opr-agt.[bat|sh]

Synopsis

opr-agt <CONNECTION_INFO> <operation> <targets> <toolInfo>

Options

Exit Status

Exit Status

Description

Output

0

Successful completion of the requested operation

No output.
1

Failure of the requested operation

An error message stating why the operation failed, followed by the tool's help text.
300‑399

HTTP Redirection (300-399)

An error message stating the HTTP error number and description.

For more information about HTTP error status values, see publicly available HTTP documentation.

400‑499

HTTP Client Error (400-499)

500‑599

HTTP Internal Server Error (500-599)

Restrictions

  • Authentication. Some operations require authentication. If <authentication> is required, <authentication> must be specified and valid.

    If <authentication> is omitted when requesting an operation requiring authentication, opr-agt does not execute the requested operation, and exits with the following error:

    Username may not be null. Operation requires authentication. Please enter the login name and password.

    The error can be fixed by inserting an <authentication>.

  • Prerequisites. To run opr-agt successfully, the following processes must be running:

    • OMi must be running on the server.

    • ovcd and ovbbccb must be running on the monitored node.

  • Agent restart. The opr-agt command updates configuration variables in the configuration settings files and in the configuration database (similar to the ovconfchg command). Most changes take effect immediately but some require an agent restart. The value to set may not contain colons (:) or parentheses (()). For more information about the variables, see the Operations Agent Help.

  • Permissions. To run opr-agt successfully, the following permissions are required:

    • The user running the opr-agt command-line interface must be assigned a role with the Monitored Nodes permission, unless the option -no_db is specified. To grant the Monitored Nodes permission, select the Setup and Maintenance category of the Permissions section of a role, and enable full control.

    • To operate the -deploy option, the user must be assigned a role with the Redeploy All Configuration permission in addition to the Monitored Nodes permission. To grant the Redeploy All Configuration permission, select the Monitoring category of the Permissions section of a role. Then click Special Operations and check the Redeploy all configuration box.

    • To operate the -cmd option, the user must be assigned a role with the Action Web Service permission, in addition to the Monitored Nodes permission. To grant the Action Web Service permission, select the Operations Console category of the Permissions section of a role. Then click Action Web Service and click the Execute check box. Also make sure that the Action Web Service is enabled (the web service is enabled by default). To edit the Action Web Service infrastructure setting, go to:
    • Administration > Setup and Maintenance > Infrastructure Settings

      Alternatively, click Infrastructure Settings.

      Select Applications and use the list to set the context to Operations Management. Scroll down to Operations Management - Action Web Service Settings. Set Allow command execution through Action Web Service to true.

      Non-admin users also need the following file permissions to operate this command-line tool:

      File Windows Permissions Linux Permissions
      <OMi_HOME>/conf/TopazInfra.ini read r
      <OMi_HOME>/log/opr-clis.log full control rw

      <OMi_HOME>/log/opr-pgctl.log

      Note: This file is not available on gateway server systems.
      full control rw
      <OMi_HOME>/conf/encryption.properties read r
      <OMi_HOME>/conf/seed.properties read r

Examples

This section shows a number of examples you can use as a starting point for developing your own opr-agt commands.

  • Stop and start the HPE Operations Agent processes on node1.example.com and node2.example.com

    opr-agt -username myU -password myPwd -node_list "node1.example.com,node2.example.com" -stop

    opr-agt -username myU -password myPwd -node_list "node1.example.com,node2.example.com" -start

  • Stop, start, or restart the action and message agent processes on node1.example.com

    opr-agt -username myU -password myPwd -node_list node1.example.com -stop -comp opcacta,opcmsga

    opr-agt -username myU -password myPwd -node_list node1.example.com -start -comp opcacta,opcmsga

    opr-agt -username myU -password myPwd -node_list node1.example.com -restart -comp opcacta,opcmsga

  • Stop or start the action on the node group myNodeGrp, which is a member of the top-level group myTopNodeGrp

    opr-agt -username myU -password myPwd -node_group /myTopNodeGrp/myNodeGrp -stop

    opr-agt -username myU -password myPwd -node_group /myTopNodeGrp/myNodeGrp -start

    Note that you can specify the path for hierarchical node groups only (the node groups imported from OM for Windows). The node groups imported from OM for UNIX using topology synchronization packages are always flat and are therefore specified by providing their names, for example:

    opr-agt -username myU -password myPwd -node_group myNodeGrp -stop

  • Check the status of all or of the event and action group of agent processes on node1.example.com

    opr-agt -username myU -password myPwd -node_list node1.example.com -status

    opr-agt -username myU -password myPwd -node_list node1.example.com -status -comp EA

  • Check the status of all monitored nodes

    opr-agt -username myU -password myPwd -status -all

  • Print an alphabetical list of nodes selected by the TQL query All_CIs_with_OM_Agents_Unix

    opr-agt -username myU -password myPwd -query_name All_CIs_with_OM_Agents_Unix -list_agent_nodenames

  • Restart the HPE Operations Agent processes on all nodes selected by the TQL query All_CIs_with_OM_Agents_Unix

    opr-agt -username myU -password myPwd -query_name All_CIs_with_OM_Agents_Unix -restart

  • Retrieve the PROXY configuration setting on node1.example.com

    opr-agt -username myU -password myPwd -node_list node1.example.com -get_config_var bbc.http:PROXY

  • Retrieve all configuration settings in the namespace eaagt on node1.example.com and node2.example.com

    opr-agt -username myU -password myPwd -node_list "node1.example.com,node2.example.com" -get_config_var eaagt:

  • List all policies that are deployed to node1.example.com and node2.example.com

    opr-agt -username myU -password myPwd -node_list "node1.example.com,node2.example.com" -list_policies

  • List all HPE Operations Agent packages that are installed on node1.example.com

    opr-agt -username myU -password myPwd -node_list node1.example.com -agent_version

  • Find out when the HPE Operations Agent was installed on all monitored nodes

    opr-agt -username myU -password myPwd -get_config_var eaagt:OPC_INSTALLATION_TIME -all

  • Change the primary manager for event reception of all monitored nodes (200 in parallel) to the current OMi server

    opr-agt -username myU -password myPwd -num_parallel 200 -all -set_primary_manager

  • Change the primary manager of the node group myNodeGrp to the current OMi server and remove all policies that were deployed from another server from all HPE Operations Agents

    opr-agt -username myU -password myPwd -switch_manager -node_group myNodeGrp
    opr-agt -username myU -password myPwd -deploy -clean -all

Troubleshooting