The objects listed here are available for
Caution: Policy scripts provide administrators with a powerful tool to evaluate and manipulate data. If, however, a script is incorrectly written, it could cause the agent to fail. Hewlett-Packard Company is not responsible for agent failures resulting from incorrectly written scripts.
This object is used to access the attributes of a policy.
Policy Method: | CreateObject
|
---|---|
Parameter: | progID (string of format: [Vendor.]Component[.Version] ) |
Return Type: | VB Script: IDispatch Perl: not applicable |
VB Script Syntax: | Policy.CreateObject("progID")
|
Perl Syntax: | not applicable |
Description: | Creates a component instance of a COM object. Note that this method is valid only on Windows nodes, and cannot be used in a Perl script. |
Policy Method: | Execute
|
---|---|
Parameter: | command (string) |
Return Type: | VB Script: void Perl: void |
VB Script Syntax: | Policy.Execute("command")
|
Perl Syntax: | $Policy->Execute("command");
|
Description: | Run the specified command asynchronously. The command is executed in the context of agent security, so could be run as Local System or any other user-selected user to run the agent. The method will return immediately. See the ExecuteCommand method Command for more information about how to indicate commands. |
Policy Method: | Output
|
---|---|
Parameter: | string |
Return Type: | VB Script: void Perl: void |
VB Script Syntax: | Policy.Output("string")
|
Perl Syntax: | $Policy->Output("string");
|
Description: | Appends the string to the annotation field of the event sent to BSM in response to the success or failure of a scheduled task. |
Policy Method: | ExecuteEx
|
---|---|
Parameter: | command (string) |
Return Type: | VB Script: BSTR Perl: string |
VB Script Syntax: | Policy.ExecuteEx("command")
|
Perl Syntax: | $Policy->ExecuteEx("command");
|
Description: |
Run the specified command synchronously and wait for it to complete before returning the output of the command.
|
In scheduled task policies, the Rule object is used to indicate whether the command has succeeded or failed. TRUE = command succeeded, FALSE = command failed.
Rule Method: | Status
|
---|---|
Parameter: | void |
Return Type: | VB Script: Boolean Perl: integer |
VB Script Syntax: | for put: Rule.Status = boolvalue for get: boolvalue = Rule.Status |
Perl Syntax: | for put: $Rule.Status(boolvalue); for get: boolvalue = $Rule.Status(); |
Description: | For scheduled task policies, FALSE indicates that the scheduled task failed. |
The ConsoleMessage object provides a method for sending events directly to BSM. Events sent in this way are not intercepted by an open message interface policy, but instead are sent directly to the server. Multiple uses of the Send method are supported. The same script can then send multiple events to OMi depending on which problem it detects.
Note: You cannot use action variables with the ConsoleMessage object.
ConsoleMessage Method: | Application
|
---|---|
Parameter: | application (string) |
Return Type: | VB Script: void Perl: void |
VB Script Syntax: | ConsoleMessage.Application = "application"
|
Perl Syntax: | $ConsoleMessage->Application("application");
|
Description: | This optional method sets the content of Application in the event properties. |
ConsoleMessage Method: | Object
|
---|---|
Parameter: | object (string) |
Return Type: | VB Script: void Perl: void |
VB Script Syntax: | ConsoleMessage.Object = "object"
|
Perl Syntax: | $ConsoleMessage->Object("object");
|
Description: | This optional method sets the content of Object in the event properties. |
ConsoleMessage Method: | MsgText
|
---|---|
Parameter: | msgtext (string) |
Return Type: | VB Script: void Perl: void |
VB Script Syntax: | ConsoleMessage.MsgText = "msgtext"
|
Perl Syntax: | $ConsoleMessage->MsgText("msgtext");
|
Description: | This method sets the message text for the event. |
ConsoleMessage Method: | Severity
|
---|---|
Parameter: | severity
(valid strings are: Unknown|Normal|Warning|Minor|Major|Critical) |
Return Type: | VB Script: void Perl: void |
VB Script Syntax: | ConsoleMessage.Severity = "severity"
|
Perl Syntax: | $ConsoleMessage->Severity("severity");
|
Description: | Sets the severity of the event that is sent. If not specifically set with this method, the default is Normal. If an invalid string is supplied, severity Unknown will be used. |
ConsoleMessage Method: | MsgGrp
|
---|---|
Parameter: | messagegroup (string) |
Return Type: | VB Script: void Perl: void |
VB Script Syntax: | ConsoleMessage.MsgGrp = "messagegroup"
|
Perl Syntax: | $ConsoleMessage->MsgGrp("messagegroup");
|
Description: | Sets the value for the Message Group in event properties. If this method does not supply a value, Misc is used. |
ConsoleMessage Method: | Node
|
---|---|
Parameter: | nodename (IP address or fully qualified hostname) |
Return Type: | VB Script: void Perl: void |
VB Script Syntax: | ConsoleMessage.Node = "nodename"
|
Perl Syntax: | $ConsoleMessage->Node("nodename");
|
Description: | Sets the value for Primary Node Name that will be displayed in the event properties. IP addresses and fully qualified hostnames are valid. If this method does not supply a value, the hostname of the system is used by default. |
ConsoleMessage Method: | ServiceId
|
---|---|
Parameter: | serviceid (string) |
Return Type: | VB Script: void Perl: void |
VB Script Syntax: | ConsoleMessage.ServiceId = "serviceid"
|
Perl Syntax: | $ConsoleMessage->ServiceId("serviceid");
|
Description: | This optional method sets the Service ID for the event. |
ConsoleMessage Method: | MessageType
|
---|---|
Parameter: | messagetype (string) |
Return Type: | VB Script: void Perl: void |
VB Script Syntax: | ConsoleMessage.MessageType = "messagetype"
|
Perl Syntax: | $ConsoleMessage->MessageType("messagetype");
|
Description: | This optional method sets the value for the message type field of the event properties. |
ConsoleMessage Method: | MessageKey
|
---|---|
Parameter: | messagekey (string) |
Return Type: | VB Script: void Perl: void |
VB Script Syntax: | ConsoleMessage.MessageKey = "messagekey"
|
Perl Syntax: | $ConsoleMessage->MessageKey("messagekey");
|
Description: | This optional methods sets a key for event correlation. |
ConsoleMessage Method: | AcknowledgeMessageKey
|
---|---|
Parameter: | messagekey (string) |
Return Type: | VB Script: void Perl: void |
VB Script Syntax: | ConsoleMessage.AcknowledgeMessageKey = "messagekey"
|
Perl Syntax: | $ConsoleMessage->AcknowledgeMessageKey("messagekey");
|
Description: | This optional method sets the message key to indicate which events are automatically closed. |
ConsoleMessage Method: | TroubleTicket
|
---|---|
Parameter: | Booleanvalue |
Return Type: | VB Script: void Perl: void |
VB Script Syntax: | ConsoleMessage.TroubleTicket = Booleanvalue
|
Perl Syntax: | $ConsoleMessage->TroubleTicket(Booleanvalue);
|
Description: | This optional method specifies if the event is to be sent to a trouble ticket interface. Default is FALSE. |
ConsoleMessage Method: | Notification
|
---|---|
Parameter: | Booleanvalue |
Return Type: | VB Script: void Perl: void |
VB Script Syntax: | ConsoleMessage.Notification = Booleanvalue
|
Perl Syntax: | $ConsoleMessage->Notification(Booleanvalue);
|
Description: | This optional method specifies if the event is sent to the notification mechanism. Default is FALSE. |
ConsoleMessage Method: | AgentMSI
|
---|---|
Parameter: | type (valid strings are: copy|divert|none) |
Return Type: | VB Script: void Perl: void |
VB Script Syntax: | ConsoleMessage.AgentMSI = "type"
|
Perl Syntax: | $ConsoleMessage->AgentMSI("type");
|
Description: | This optional method specifies if the event is to be sent through the message stream interface on the agent. Default (or if string misspelled) is none. |
ConsoleMessage Method: | ServerMSI
|
---|---|
Parameter: | type (valid strings are: copy|divert|none) |
Return Type: | VB Script: void Perl: void |
VB Script Syntax: | ConsoleMessage.ServerMSI = "type"
|
Perl Syntax: | $ConsoleMessage->ServerMSI("type");
|
Description: | This optional method specifies if event is sent through the event stream interface on the server. Default (or if string misspelled) is none. |
ConsoleMessage Method: | Send
|
---|---|
Parameter: | void |
Return Type: | VB Script: void Perl: void |
VB Script Syntax: | ConsoleMessage.Send()
|
Perl Syntax: | $ConsoleMessage->Send();
|
Description: | This method sends the event to the OMi server. The MsgText method must set the message text before using this method. Multiple uses of the Send method are supported. Policy variables will not be expanded. |
Object used for requesting a command to be run. It starts a command to be run by the HP Operations Agent.
ExecuteCommand Method: | Command
|
---|---|
Parameter: | command (string) |
Return Type: | VB Script: void Perl: void |
VB Script Syntax: | ExecuteCommand.Command = "command"
|
Perl Syntax: | $ExecuteCommand->Command("command");
|
Description: |
This mandatory method is the name of the command to run with all necessary parameters. Note: For scripts that will run on Windows systems, internal commands such as Copy, Rename, and DIR use a command interpreter that must be started before the command can be run. For commands of this type, the command must be preceded with |
ExecuteCommand Method: | KillonTimeout
|
---|---|
Parameter: | seconds (integer) |
Return Type: | VB Script: void Perl: void |
VB Script Syntax: | ExecuteCommand.KillonTimeout = seconds;
|
Perl Syntax: | $ExecuteCommand->KillonTimeout(seconds);
|
Description: | This method sets the maximum time, in seconds, that the command will run. The default is unlimited. Valid only with the StartEx method. |
ExecuteCommand Method: | UserName
|
---|---|
Parameter: | username (string) |
Return Type: | VB Script: void Perl: void |
VB Script Syntax: | ExecuteCommand.UserName = "username"
|
Perl Syntax: | $ExecuteCommand->UserName("username");
|
Description: | User name under which the command should be run. Optional, default is $AGENT_USER. |
ExecuteCommand Method: | Password
|
---|---|
Parameter: | password (string) |
Return Type: | VB Script: void Perl: void |
VB Script Syntax: | ExecuteCommand.Password = "password"
|
Perl Syntax: | $ExecuteCommand->Password("password");
|
Description: |
Password for accessing the specified user account. To prevent the password from being visible in the script, use the following instructions:
In some cases it is better not to supply a password. ![]() Executing the command without the password is the easier of the two methods, but it has some restrictions that make it unsuitable in some situations. The lists below show the restrictions and advantages of both methods. Without a password:
With a password:
|
ExecuteCommand Method: | Start
|
---|---|
Parameter: | void |
Return Type: | VB Script: void Perl: void |
VB Script Syntax: | ExecuteCommand.Start()
|
Perl Syntax: | $ExecuteCommand->Start();
|
Description: | Run the command specified by ExecuteCommand.Command and return immediately the control to the script so the next lines can be processed right away. |
ExecuteCommand Method: | StartEx
|
---|---|
Parameter: | void |
Return Type: | VB Script: BSTR Perl: String |
VB Script Syntax: | ExecuteCommand.StartEx
|
Perl Syntax: | $ExecuteCommand->StartEx();
|
Description: |
Run ExecuteCommand.Command and wait until it finishes. Commands can be run synchronously or asynchronously, as needed. Multiple uses of the Start method are supported. This way, the same script can trigger multiple external commands. If the command is successful, STDOUT is returned. If the command is not successful (return value non-zero), the string "ERROR:\n" followed by STDERR will be returned. To handle non-zero return values, run StartEx in an eval function and then check the result, for example for the string ERROR. Perl script example:
|