Traverse uses an XML file to describe settings for script plugin monitors. Here is an example test descriptor that might be used to describe a plugin script that monitors weather information:
<monitor type="weather" plugintype="script">
<!--
Insert a testType element here.
-->
<script type="weather" subType="temperature">
<rootScript>gettemp.pl</rootScript>
<timeout>10</timeout>
<parameters>--country=${country} --state=${state}
--city=${city} </parameters>
</script>
</monitor>
Note: <timeout>
must be specified.
The first element is the monitor element. The monitor element defines what monitor the different tests belong to. There are two attributes for the monitor element:
Monitor Element Attributes
Attributes |
Description |
type |
This defines a type name for the plugin, and the type of monitoring it does. The value of type shows up in the DGE status line when displaying the testing queues and monitor status, and is used in the web application |
plugintype |
This attribute describes the type of plugin. For a script plugin monitor, this parameter should be set to script. |
The monitor element also requires a testType
definition as described above.
The second element is the script element. This element describes the way the script should be run. The script element has two attributes, type
and subType
, that associates the script with a test type. The type attribute for the script should have the same value as the type attribute of the monitor element. In this case, they're both weather. The value of the subType
attribute should match the subType
attribute of one of the testType
elements owned by the monitor. Our script will get the temperature, so we want it to be associated with the temperature test type, so we give its subType
the same value, temperature, as the subType
for the temperature test type.
The next two child elements are fairly straightforward. The rootScript
element gives the name of the script to run, and the timeout
element gives the maximum number of seconds to wait for the script. You should give a timeout
of less than 60 seconds for your script, so that the Traverse monitor running your script can return in a timely manner if your script hangs for some reason. Timeout values of zero or less will be interpreted as a 60-second timeout.
The final child element is the parameters
element, which defines how arguments are passed to the script. You can enter any text for the parameters
object, and you can also use testField
placeholders to indicate where testField
values should be passed. To use a placeholder, simply enter \${
, followed by the fieldName
of a testField
for the testtype
your script plugin is handling, and end the placeholder with a }
.
The following table shows the variables that can be used in the parameters
element of the configuration file.
Variables Available for the parameters Element
${container_name} |
${container_member_count_all} |
${container_member_count_match} |
${affected_containers} |
${department_name} |
${product_name} |
${device_comment} |
${device_address} |
${device_location} |
${device_model} |
${device_name} |
${device_serial_number} |
${device_snmp_cid} |
${device_snmp_version} |
${device_tag1} |
${device_tag2} |
${device_tag3} |
${device_tag4} |
${device_tag5} |
${device_tag1_caption} |
${device_tag2_caption} |
${device_tag3_caption} |
${device_tag4_caption} |
${device_tag5_caption} |
${device_type} |
${device_vendor} |
${test_name} |
${test_serial_number} |
${test_shadow_critical_threshold} |
${test_shadow_warning_threshold} |
${test_sla_threshold} |
${test_sub_type} |
${test_type} |
${test_units} |
${test_user_critical_threshold} |
${test_user_warning_threshold} |
When Traverse calls your script, it will replace the placeholders with the values given when a test was provisioned.
Based on the example above, if you provisioned a test for London, England, Traverse would call the script with the following arguments:
--country=England --state= --city=London
If you don't provide a parameters
element, the script is called without any arguments.
Note: \${device_tag1}
provides the value configured for tag1
for the device. \${device_tag1_caption}
provides the description (caption) of tag1
as configured in the emerald.xml
file.