When a tool is invoked, the attributes of the tool target are automatically passed to the tool script. The attributes are passed to the tool script as environment variables in the form:
SM_OBJ_<NAME>=<value>
The <NAME> parameter identifies the attribute and the <value> parameter contains the attribute’s value. For example, the ClassName attribute would be passed in the environment variable:
SM_OBJ_CLASSNAME=Router
Your tool script must parse these environment variables and extract the information required by the program invoked by the tool script. For example, if you want a tool that telnets to a device, you need to extract the environment variable that contains the name or IP address of the device, as shown in the example code :
rem if SM_OBJ_Name isn't set in environment report an error if not defined SM_OBJ_Name ( echo Invalid SM_OBJ_NAME exit 0 ) rem Use the value of SM_OBJ_Name to connect to the device start /wait cmd /c "telnet %SM_OBJ_Name% "
The tool target can either be a notification or an instance. For both types of targets, a tool script receives the attributes listed in Attributes passed to all tool scripts as environment variables.
Environment variable |
Description |
---|---|
SM_REMOTE_USER |
Specifies the VMware Telco Cloud Service Assurance username of the person that invoked the tool. |
SM_SERVER_NAME |
Specifies the name of the Global Manager that executes the tool script. |
Attributes for element targets lists the attributes that are passed to the tool script when the target is an instance.
Element target attributes |
Description |
---|---|
SM_OBJ_CLASS_NAME |
Class name of the system. For example, Router. |
SM_OBJ_INSTANCE_NAME |
Name of the system. |
SM_OBJ_DOMAIN_NAME |
Name of the Global Manager. |
Attributes for notification targets lists the attributes that are passed to the tool script when the target is a notification.
Notification target attributes |
Description |
---|---|
SM_OBJ_Acknowledged |
Specifies whether the notification is acknowledged. TRUE if the notification has been acknowledged, FALSE if not. |
SM_OBJ_Active |
Specifies whether the notification is active. TRUE if the notification is active, FALSE if not. |
SM_OBJ_Category |
Type of notification sent by the Global Manager. Possible values include:
|
SM_OBJ_Certainty |
Confidence that this notification is the correct diagnosis. Value ranges from 0 to 100. |
SM_OBJ_ClassDisplayName |
Name of the ClassName that is displayed to the user. |
SM_OBJ_ClassName |
Name of the class where the event occurred. Might not be the same as SM_OBJ_ClassDisplayName. |
SM_OBJ_ElementClassName |
Class name of the managed element most closely related to this event. |
SM_OBJ_ElementName |
Name of the managed element most closely related to this event. |
SM_OBJ_EventDisplayName |
Name of the EventName that is displayed to the user. |
SM_OBJ_EventName |
Name of the event. Might not be the same as SM_OBJ_EventDisplayName. |
SM_OBJ_EventText |
A description of the notification. |
SM_OBJ_EventType |
MOMENTARY when the notification has no duration. DURABLE if the notification has a period for which it is active, such as a link failure. |
SM_EventState |
State of the event. Possible values include:
The UNITIALIZED state is not relevant here. |
SM_OBJ_FirstNotifiedAt |
Time, in seconds, when the notification first became active. |
SM_OBJ_Impact |
Numeric value that indicates the effect of this event on related elements. |
SM_OBJ_InMaintenance |
TRUE if the device is in maintenance mode, FALSE if not. |
SM_OBJ_InstanceDisplayName |
Name of the InstanceName that is displayed to the user. |
SM_OBJ_InstanceName |
Name of the instance where the event occurred. Might not be the same as SM_OBJ_InstanceDisplayName. |
SM_OBJ_IsProblem |
TRUE if (and only if) at least one of the types is “PROBLEM”, and none of the types are anything other than “PROBLEM” or “UNKNOWN”. |
SM_OBJ_IsRoot |
TRUE if the notification is a root cause, FALSE if not. |
SM_OBJ_LastChangedAt |
Time, in seconds, when the status of the notification last changed. |
SM_OBJ_LastClearedAt |
Time, in seconds, when the notification was last cleared. |
SM_OBJ_LastNotifiedAt |
Time, in seconds, when the notification was last notified. |
SM_OBJ_Name |
InternalEventHandle for the notification. |
SM_OBJ_OccurrenceCount |
Number of times the notification has occurred. |
SM_OBJ_Owner |
Name of the person responsible for this notification. Value is SYSTEM when acknowledged by the Global Manager. |
SM_OBJ_Severity |
Level of severity for this notification. 1 = CRITICAL 2 = MAJOR 3 = MINOR 4 = UNKNOWN 5 = NORMAL |
SM_OBJ_SourceDomainName |
Name of the underlying domain that sent this notification. If more than one domain is listed, the names are separated by commas. |
SM_OBJ_SourceEventType |
Indicates the type of event from an underlying source or sources. Value can be: PROBLEM, EVENT, AGGREGATE, or UNKNOWN. The default value is UNKNOWN. |
SM_OBJ_TroubleTicketID |
Trouble-ticket number associated with this notification. |
SM_OBJ_UserDefined1-20 |
Twenty user-defined fields.You can populate these fields with data with an ASL hook script. |
Attributes for escalation targets lists additional attributes that are passed to the tool script when the tool is invoked through an escalation policy.
Element target attributes |
Description |
---|---|
SM_POBJ_POLICY |
Name of the policy that executed the tool. |
SM_POBJ_PATH |
Name of the path that executed the tool. |
SM_POBJ_LEVEL |
Name of the level that executed the tool. |
In addition to the attributes listed above, a server tool script receives the DISPLAY environment variable. The value of this variable is used to determine the location of the user’s X Window System display. “Running tools over X Windows” on page 156 includes detailed information for invoking server tools through an X Windows System.