This is an example of a sample atmosphere pressure monitor which uses discrete thresholds.
plugin/monitors/my_atmosphere.xml
with the following contents.<monitor type="atmosphere" plugintype="script">
<testtype>
<displayName>Atmospheric Pressure</displayName>
<displayCategory>application</displayCategory>
<subType>pressure</subType>
<units>psi</units>
<severity_ascends_with_value>discrete</severity_ascends_with_value>
<defaultWarningThreshold>2,5</defaultWarningThreshold>
<defaultCriticalThreshold>4,8-10,99</defaultCriticalThreshold>
<shadowWarningThreshold>2,5</shadowWarningThreshold>
<shadowCriticalThreshold>4,8-10,99</shadowCriticalThreshold>
<slaThreshold>8-10</slaThreshold>
<testInterval>60</testInterval>
</testtype>
<script type="atmosphere" subType="pressure">
<rootScript>run.sh</rootScript>
<parameters></parameters>
<waitForTerminate>true</waitForTerminate>
<timeout>15</timeout>
</script>
</monitor>
Note how the thresholds have been specified as discrete values. If the polled result is 2 or 5, the test is in a warning state. Critical is 4,8,9,10 and 99. Everything else is OK.
plugins/monitors/
directory under a directory with the same name as the test type, and name it as indicated in the test type definition above (plugins/monitors/atmosphere/run.sh
)#!/bin/sh
#if [ -f "/tmp/atmosphere.dat" ]; then
cat /tmp/atmosphere.dat
else
echo 0
fi
/tmp/atmosphere.dat
and you can see the test status change in each polling cycle:echo 99 >/tmp/atmosphere.dat
echo 5 > /tmp/atmosphere.dat
echo 6 > /tmp/atmosphere.dat