HP Operations ManagerPolicy variables The variables listed below can be used in most event policy editor text entry boxes (exceptions are noted). The variables can be used within HP Operations, or passed to external programs. Each variable is shown with the required syntax. NOTE: It is often useful to surround the variable with quotation marks, especially if it may return a value that contains spaces. <$FULLNAME> Returns the name of the policy and the source (concatenated with -). As defined for templates, this would return the same as <$NAME> This variable, along with <$NAME> and <$FULLNAME>, can be used in the field Program Name as follows so that when you are renaming a policy, you would not need to modify the Program name field. mymonitorscript.bat <$NAME>- mymonitorscript.bat <$FULLNAME> <$MSG_APPL> Returns the name of the application associated with the event that caused the message. Only events from the Open Message Interface (parameter: application) or the Windows Event Log (parameter: source) will set this variable. Sample output: /usr/bin/su(1) Switch User <$MSG_GRP> Returns the default message group of the message. Only events from the Open Message Interface (parameter: message_group) will set this variable. Sample output: Security <$MSG_ID> Returns the unique identity number of the message, as generated by the message agent. Note that identity numbers are not generated for suppressed messages. Sample output: 6e998f80-a06b-71d0-012e-0f887a7c0000 <$MSG_NODE> Returns the IP address of the managed node on which the message originates. Sample output: 14.136.122.123 <$MSG_NODE_ID> Returns the GUID that the management server assigned to the node on which the message originates. Because this value is only known by the management server, this variable cannot be resolved on the managed node. This variable is valid for the service_id message attribute and in the Command box for an automatic or operator-initiated command. Sample output: {6e998f80-a06b-71d0-012e-0f887a7c0000} <$MSG_NODE_NAME> Returns the name of the managed node on which the message originates. This variable is not fixed, however, and can be changed by a policy on a per-message basis. For example, if the policy is intercepting SNMP traps that originate from other devices, you might want to set this variable to the name of the device where the trap originated. If the policy is monitoring a logfile on a network share where applications on several nodes write messages, you could extract the name of the node from the error message, save it in a user-defined variable, and assign it to MSG_NODE_NAME. <$MGMTSV_KNOWN_MSG_NODE_NAME> Returns the name of the managed node on which the message originates. The management server resolves this variable to the node's hostname. This variable may be different to <$MSG_NODE_NAME>, which is the hostname that the agent resolves. You can use <$MGMTSV_KNOWN_MSG_NODE_NAME> in the following message attributes: Service ID Message Key Message Type Message Group Application Object Message Text CMA Name CMA Value Automatic Command Automatic Command Node Operator-initiated Command Operator-initiated Command Node This variable is useful in environments where management servers and agents resolve different hostnames for the same the node (for example, NAT environments). <$MSG_OBJECT> Delivers the name of the object associated with the event. Only events from the Open Message Interface (parameter: msg_object) and Windows Event Log (parameter: category) will set this variable. <$MSG_SEV> Returns the default value for the severity of the event. Only events from the Open Message Interface (default is "Normal') and the Windows Event Log (parameter: converted) will set this variable. Note that the following severity conversions are performed when this variable is set by the Windows Event Log: information=Normal, warning=Warning, error=critical, success audit=Normal, failure audit=Critical, default=unknown). Sample output: Normal <$MSG_TEXT> Returns the full text of the message. For the Open Message Interface, this value is the msg_text parameter. For the Windows Event Log this value is the event ID and description. In general, there are default texts for all editors derived from incoming event properties (this is shown in the message text field of outgoing message properties). Sample output: SU 03/19 16:13 + ttyp7 bill-root <$MSG_TYPE> Delivers the name set for Message Type. <$NAME> Returns the name of the measurement threshold policy or the scheduled task policy that sent the message. Sample output: cpu_util This variable, along with <$FULLNAME> and <$SRCNAME>, can be used in the field Program Name as follows so that when you are renaming a policy, you would not need to modify the Program name field. mymonitorscript.bat <$NAME>- mymonitorscript.bat <$FULLNAME> <$OPC_GUI_CLIENT> Returns the hostname of the client where the HP Operations GUI is currently running. This variable is valid in the Node box for an operator-initiated command and for message attributes. <$OPC_GUI_CLIENT_WEB> Returns the hostname and default web browser of the client where the HP Operations GUI is currently running. This can be used with an operator-initiated command to load a web page in the default browser on the HP Operations GUI client. This variable is valid in the node field for an operator-initiated command and for message attributes. <$OPC_MGMTSV> Returns the name of the current HP Operations management server. This variable is valid in the Command text box and in the Node text box for an automatic or operator-initiated command. This variable is only resolved on the management server. Sample output: zucchini.veg.com <$OPTION(N)> Returns the value of an optional variable that is set by opcmsg or opcmon (for example, $OPTION(A) $OPTION(B), and so on.). <$SRCNAME> Returns the name of the source for a policy. For a template, this would return an empty string. This variable, along with <$NAME> and <$FULLNAME>, can be used in the field Program Name as follows so that when you are renaming a policy, you would not need to modify the Program name field. mymonitorscript.bat <$NAME>- mymonitorscript.bat <$FULLNAME> Additional information about variables <$NAME>, <$FULLNAME>, and <$SRCNAME> The execute command made by the monitor agent now includes additional processing that allows special opc defined variables for the policy/monitor/source name to be resolved. <$NAME> currently exists and evaluates only to the name of the template. To remain consistent, the variable <$FULLNAME> is used for the complete policy-source name which would generally be used in the newer Policy definitions. The " <$>"character combination can be suppressed with the "\" escape character. If the " <$>" character combination is found, but the variable is unknown, or no closing bracket (">") is found, then no substitution is performed. Parsing for escape characters would be limited to the characters directly before a known variable, as shown in examples 3, 4 and 5). This feature will be available by default on all agent platforms. It would be possible to disable this for a node by setting the OPCINFO/NODEINFO key: OPC_MON_DISABLE_PROG_VARS TRUE Examples: Policy: SNMP-service-Win2k with source name service Example: 1 Definition: opcservice SNMP <$NAME>-<$SRCNAME> Resolved: opcservice SNMP SNMP-service-Win2k-service Notes: Create required name for opcmon from both the policy name and source name variables Example: 2 Definition: opcservice SNMP <$FULLNAME> Resolved: opcservice SNMP SNMP-service-Win2k-service Notes: Resolves to the combined policy and source name. Example: 3 Definition: opcservice SNMP \<$FULLNAME> Resolved: opcservice SNMP <$FULLNAME> Notes: Single escape character, therefore the variable is ignored Example: 4 Definition: opcservice SNMP \\<$FULLNAME> Resolved: opcservice SNMP \SNMP-service-Win2k-service Notes: Double escape character, resolved to single and variables resolved. The following variables are valid only in measurement threshold policies: <$THRESHOLD> Returns value for the threshold limit set in General Threshold Rule Properties. If the threshold is determined with a script, the name of the scripting language is returned, for example, VBScript Sample output: 95.00 <$VALUE> Returns the value measured by a Measurement Threshold policy. Sample output: 100.00 <$VALAVG> Returns the average value of all messages reported by the Measurement Threshold policy. Sample output: 100.00 <$VALCNT> Returns the number of times that the threshold monitor has delivered a message to the browser. Sample output: 1 <$MSG_TIME_CREATED> Returns the time the message was created on the managed node in seconds elapsed since midnight (00:00:00), January 1, 1970, coordinated universal time. Sample output: 950008585 <$INSTANCE> Returns the name of the current instance Sample output: C; <$SESSION(key)> Returns the value of a key stored in the Session object by using the Value method. The following variable is valid only in messages sent from Windows Management Interface policies <$WBEM:WMI class property> (for example, <$WBEM:TimeCreated> Sample output: 19991130105330.000000+060) The following variables are valid only in messages sent from Scheduled Task policies: <$PROG> Returns the name of the program executed by the Scheduled Task policy Sample output:check_for_upgrade.bat <$USER> Returns the name of the user under which the scheduled task was executed. Sample output:administrator The following variables are valid only in messages sent from Logfile Entry policies <$LOGFILE> Returns the name of the logfile that contains the event which caused the message. Sample output:program_log.txt <$LOGPATH> Returns the name and path of the logfile that contains the event which caused the message. Sample output:C:\temp\mylogfile\program_log.txt The following variables are valid only in messages sent from Process-monitor policies The following session variables are set automatically and can be used to define actions in the format <$SESSION(session variable)>: Defines the name used to access the process on the Managed Node Defines the parameter pattern used to access the process on the Managed Node Defines the number of monitored processes Defines the number of available processes matching the process name and parameter pattern Defines the string used to build the message text. It depends on the monitor you specify, for example: MIN PROCESSMODE is: ">= " MAX PROCESSMODE is: "<= " EQUAL PROCESSMODE is: " " (empty string) The following variables are valid only in messages sent from Windows Services-monitor policies The following session variables are set automatically and can be used in the actions in the format <$SESSION (session variable)>: Defines the name used to access the Windows service on the Managed Node <$SERVICEDISPLAYNAME> Defines the display name of the Windows service. This value is retrieved on the specified Managed Node and can be displayed in the local language of the Managed Node. <$SERVICEMONITORSTATE> Defines the state of the Windows service to monitor, for example; "running", "stopped", or "disabled". If an agent catalog is available in the local language set on the Managed Node, this is the localized text for the monitor state. If no agent catalog is available in the local language of the Managed Node, English text is used to display the monitor state. <$SERVICECURRENTSTATE> Defines the current state of the Windows service being monitored, for example; "running", "stopped", or "disabled". If an agent catalog is available in the local language set on the Managed Node, this is the localized text for the monitor state. If no agent catalog is available in the local language of the Managed Node, English text is used to display the monitor state. Defines the string used to build the message text. It depends on the monitor mode you define: Monitor state "running" net start /Y Monitor state "stopped" net stop /Y Monitor state "disabled" empty Related Topics: Pattern-matching and variables Quick start: how to create a policy Send documentation feedback Send software feedback -------------------------------------------------------------------------------- © Copyright 1999 - 2008 Hewlett-Packard Development Company, L.P. The variables listed below can be used in most event policy editor text entry boxes (exceptions are noted). The variables can be used within OpenView Operations, or passed to external programs. Each variable is shown with the required syntax. NOTE: It is often useful to surround the variable with quotation marks, especially if it may return a value that contains spaces. <$MSG_APPL> Returns the name of the application associated with the event that caused the message. Only events from the Open Message Interface (parameter: application) or the Windows Event Log (parameter: source) will set this variable. Sample output: /usr/bin/su(1) Switch User <$MSG_GRP> Returns the default message group of the message. Only events from the Open Message Interface (parameter: message_group) will set this variable. Sample output: Security <$MSG_ID> Returns the unique identity number of the message, as generated by the message agent. Note that identity numbers are not generated for suppressed messages. Sample output: 6e998f80-a06b-71d0-012e-0f887a7c0000 <$MSG_NODE> Returns the IP address of the managed node on which the message originates. Sample output: 14.136.122.123 <$MSG_NODE_ID> Returns GUID that the management server assigned to the node on which the message originates. Because this value is only known by the management server, this variable cannot be resolved on the managed node. Sample output: 6e998f80-a06b-71d0-012e-0f887a7c0000 <$MSG_NODE_NAME> Returns the name of the managed node on which the message originates. This variable is not fixed, however, and can be changed by a policy on a per-message basis. For example, if the policy is intercepting SNMP traps that originate from other devices, you might want to set this variable to the name of the device where the trap originated. If the policy is monitoring a logfile on a network share where applications on several nodes write messages, you could extract the name of the node from the error message, save it in a user-defined variable, and assign it to MSG_NODE_NAME. <$MSG_OBJECT> Delivers the name of the object associated with the event. Only events from the Open Message Interface (parameter: msg_object) and Windows Event Log (parameter: category) will set this variable. <$MSG_SEV> Returns the default value for the severity of the event. Only events from the Open Message Interface (default is "Normal') and the Windows Event Log (parameter: converted) will set this variable. Note that the following severity conversions are performed when this variable is set by the Windows Event Log: information=Normal, warning=Warning, error=critical, success audit=Normal, failure audit=Critical, default=unknown). Sample output: Normal <$MSG_TEXT> Returns the full text of the message. For the Open Message Interface, this value is the msg_text parameter. For the Windows Event Log this value is the event ID and description. In general, there are default texts for all editors derived from incoming event properties (this is shown in the message text field of outgoing message properties). Sample output: SU 03/19 16:13 + ttyp7 bill-root <$MSG_TYPE> Delivers the name set for Message Type. <$NAME> Returns the name of the measurement threshold policy or the scheduled task policy that sent the message. Sample output: cpu_util <$OPC_GUI_CLIENT> Returns the hostname of the client where the OpenView Operations GUI is currently running. This variable is valid in the Node box for an operator-initiated command and for message attributes. <$OPC_GUI_CLIENT_WEB> Returns the hostname and default web browser of the client where the OpenView Operations GUI is currently running. This can be used with an operator-initiated command to load a web page in the default browser on the OpenView Operations GUI client. This variable is valid in the node field for an operator-initiated command and for message attributes. <$OPC_MGMTSV> Returns the name of the current OpenView Operations management server. This variable may only be used in the Node text box for an automatic- or operator-initiated command. (Quotation marks may not surround this variable, or a policy distribution error will result.) Sample output: zucchini.veg.com <$OPTION(N)> Returns the value of an optional variable that is set by opcmsg or opcmon (for example, $OPTION(A) $OPTION(B), and so on.). The following variables are valid only in measurement threshold policies: <$THRESHOLD> Returns value for the threshold limit set in General Threshold Rule Properties. If the threshold is determined with a script, the name of the scripting language is returned, for example, VBScript Sample output: 95.00 <$VALUE> Returns the value measured by a Measurement Threshold policy. Sample output: 100.00 <$VALAVG> Returns the average value of all messages reported by the Measurement Threshold policy. Sample output: 100.00 <$VALCNT> Returns the number of times that the threshold monitor has delivered a message to the browser. Sample output: 1 <$MSG_TIME_CREATED> Returns the time the message was created on the managed node in seconds elapsed since midnight (00:00:00), January 1, 1970, coordinated universal time. Sample output: 950008585 <$INSTANCE> Returns the name of the current instance Sample output: C; <$SESSION(key)> Returns the value of a key stored in the Session object by using the Value method. The following variable is valid only in messages sent from Windows Management Interface policies <$WBEM:WMI class property> (for example, <$WBEM:TimeCreated> Sample output: 19991130105330.000000+060) The following variables are valid only in messages sent from Scheduled Task policies: <$PROG> Returns the name of the program executed by the Scheduled Task policy Sample output:check_for_upgrade.bat <$USER> Returns the name of the user under which the scheduled task was executed. Sample output:administrator The following variables are valid only in messages sent from Logfile Entry policies <$LOGFILE> name of log file; for example: mylogfile <$LOGPATH> name of log file with path; for example: C:\temp\mylogfile <$LOGFILE> Returns the name of the logfile that contains the event which caused the message. Sample output:program_log.txt <$LOGPATH> Returns the name and path of the logfile that contains the event which caused the message. Sample output:C:\temp\mylogfile\program_log.txt