Writing scripts for measurement threshold policies
You need to use a script to determine the threshold for your
measurement threshold policy if
the source that you choose delivers something other than a number
or a Boolean value or if you want to evaluate multiple sources. A
script makes it possible for you to perform your own calculations
and decide if the threshold has been crossed. Here is how a script
works together with a measurement threshold policy:
First, you create a policy that monitors one or more threshold sources. You assign a
Short Name to each source in the policy.
If the source has multiple instances (for example, multiple
logical disks), then use the measurement
threshold processing options to indicate if the script should
process only one instance at a time, or should process all
instances at once.
Next, you create a threshold rule
that uses VB Script or Perl to determine the threshold limit. The
script should use the short names and the policy object model to
access the value for each source, and should perform some
calculation to determine if a threshold has been crossed. The
script should set the Rule Object to TRUE if threshold has
been crossed or FALSE if it has not been crossed.
When the policy is deployed, the script will evaluate the
sources and sets the rule object to TRUE or FALSE after each
polling interval. If rule object is set to TRUE, the policy will
carry out the Start,
Continue, or End Actions depending on how long the threshold
has been crossed. You can also use the script to send messages or
execute commands directly if you require more flexibility than the
Start, Continue, and End Actions provide.
NOTE:
The agent runs as a service that has no standard input, standard
output, or standard error streams. Therefore, the predefined file
handles STDIN, STDOUT, and STDERR are not available for Perl
scripts in measurement threshold policies. It is also not possible
to open file handles that use command pipes or capture the standard
output from commands within backticks (`).