![]() ![]() ![]()
|
|
Plugin Monitors
12.1 Overview
The plugin monitor functionality in Helix allows creating new monitors in Java or any other programming language such as C, perl, shell, etc. The system treats such plugin monitors as an integrated component of Helix and provides a similar multi-threaded framework as it uses internally for its own monitors.
Each plugin monitor has an associated XML configuration file describing the test type, default thresholds and various display parameters. The configuration files are installed in the
HELIX_HOME/plugin/monitors/directory and the actual plugin monitor file is installed in a subdirectory under theplugin/monitorsdirectory. The name of the subdirectory must match the monitor type specified in the configuration file.12.2 Adding A New Test Type
Each test configured in Helix is assigned a type and sub-type. The test type and sub-type combination serve as the key for global default information that is read from various configuration files. If Helix is unable to locate the configuration information for a particular test type and sub-type, it will be ignored (with an error message logged). Such configuration information is loaded from
HELIX_HOME/etc/TestTypes.xmland other plugin configuration files (described in the sections that follow).When creating new (plugin) monitors, you will need to create a unique test type and sub-type for that monitor and provide various default values and other parameters. The entries in
HELIX_HOME/etc/TestTypes.xmlor other directories should not be edited (unless you are instructed to edit them by Fidelia support) as it may adversely affect or cause failure of Helix components. Any changes made to these directories may also be lost when a new version of Helix is installed. All user customizations are expected to placed inHELIX_HOME/pluginand its subdirectories.Sample testTypes entry<testtype> <displayName>Current Temperature</displayName> <displayCategory>application</displayCategory> <subType>temperature</subType> <units>degrees C</units> <severityAscendsWithValue>true</severityAscendsWithValue> <defaultWarningThreshold>100</defaultWarningThreshold> <defaultCriticalThreshold>120</defaultCriticalThreshold> <shadowWarningThreshold>100</shadowWarningThreshold> <shadowCriticalThreshold>120</shadowCriticalThreshold> <slaThreshold>120</slaThreshold> <testInterval>180</testInterval> <showAsGroup>true</showAsGroup> <testField> <fieldName>city</fieldName> <fieldDisplayName>City</fieldDisplayName> <isRequired>true</isRequired> <isPassword>false</isPassword> <defaultValue>Muskogee</defaultValue> </testField> <testField> <fieldName>state</fieldName> <fieldDisplayName>State/Province</fieldDisplayName> <isRequired>true</isRequired> <isPassword>false</isPassword> <defaultValue>OK</defaultValue> </testField> <testField> <fieldName>country</fieldName> <fieldDisplayName>Country</fieldDisplayName> <isRequired>true</isRequired> <isPassword>false</isPassword> <defaultValue>US</defaultValue> </testField> </testtype>The testtype element includes the following child elements:
12.3 Creating A New Plugin Script Monitor
12.3.1 Configuration File Format
Helix 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>The first element is the
monitorelement. Themonitorelement defines what monitor the different tests belong to. There are two attributes for themonitorelement:
The
monitorelement also requires atestTypedefinition as described above.The second element is the
scriptelement. This element describes the way the script should be run. The script element has two attributes,typeandsubType, that will associate the script with a test type. Thetypeattribute for the script should have the same value as thetypeattribute of themonitorelement. In this case, they're bothweather. The value of thesubTypeattribute should match thesubTypeattribute of one of thetestTypeelements 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 itssubTypethe same value,temperature, as thesubTypefor the temperature test type.The next two child elements are fairly straightforward. The
rootScriptelement gives the name of the script to run, and thetimeoutelement 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 Helix 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
parameterselement, which defines how arguments are passed to the script. You can enter any text for theparametersobject, and you can also usetestFieldplaceholders to indicate wheretestFieldvalues 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}.In addition, the following variables can also be used in the
parameterselement of the configuration file:
When Helix 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, Helix would call the script with the following arguments:
If you don't provide a
parameterselement, the script is called without any arguments.12.3.2 Writing The Plugin Script
You can write your script in any language you want. When called with the set of arguments you defined in the parameters element of your plugin XML file, your script should run a test based on the arguments. If the test was completed successfully, your script should print a zero or a positive integer on standard out that corresponds to the value determined by testing. If your test failed for some reason, you can print one of the following error codes: -1, to indicate that the test failed for an unknown reason, or -2 to indicate that the test failed for a known reason.
You can also pass out debugging or error information from your script. Any lines beginning with the string "DEBUG:" will be logged to the Helix debug log (this log is turned off by default in the typical Helix installation. Contact Helix support for instructions to turn it on.). Any lines beginning with the string "ERROR:" will be logged to the Helix error log.
Once you're done writing your script, you should test it out separately on the command line to be sure it works. Next, place your script in
HELIX_HOME/plugin/monitors/<test_type>directory (where<test_type>is the type name specified in the config file. Place the XML test descriptor inHELIX_HOME/plugin/monitors. If Helix is installed in a distributed environment (multiple hosts), the monitor script and configuration file should be installed on each host running Helix. The Web Application and DGE components will need to be restarted before the new monitor is usable.12.3.3 Provisioning Plugin Tests
The Web Application and DGE components will need to be restarted before the new monitor is usable. When Helix starts, it will scan the monitor plugin directory for XML matching script files. If an XML file has an error in it, a message will be written to the error log, and the XML file will be ignored. Each different XML file results in a separate test queue in the Helix DGE.
To create a plugin test in the web application, choose Create New Advanced Tests from the Manage Tests page. The test settings you defined in the plugin XML file should show up on this page (remember to restart the Web Application and the DGE after editing your XML file). Fill in the form fields, select the Provision? checkbox next to each test you want to provision, and click the Provision Tests button at the bottom of the page. You should be able to update or delete your newly created plugin tests in the same manner you update and delete the other test.
|
Fidelia Technology, Inc. Contact Us |
![]() ![]() ![]()
|