Nagios Thresholds and Ranges

When creating alerts, I did not even realize at first there were functions that could more narrowly / flexibly define the thresholds such as this.  There are a few cases when you want the to trigger an alert when a value is too low, or less than a certain level. 

 

Ref: http://nagiosplug.sourceforge.net/developer-guidelines.html

Example ranges

Range definition

Generate an alert if x...

10 < 0 or > 10, (outside the range of {0 .. 10})
10: < 10, (outside {10 .. ∞})
~:10 > 10, (outside the range of {-∞ .. 10})
10:20 < 10 or > 20, (outside the range of {10 .. 20})
@10:20 ≥ 10 and ≤ 20, (inside the range of {10 .. 20})

Command line examples

Command line

Meaning

check_stuff -w10 -c20 Critical if "stuff" is over 20, else warn if over 10 (will be critical if "stuff" is less than 0)
check_stuff -w~:10 -c~:20 Same as above. Negative "stuff" is OK
check_stuff -w10: -c20 Critical if "stuff" is over 20, else warn if "stuff" is below 10 (will be critical if "stuff" is less than 0)
check_stuff -c1: Critical if "stuff" is less than 1
check_stuff -w~:0 -c10 Critical if "stuff" is above 10; Warn if "stuff" is above zero
check_stuff -c5:6 The only noncritical range is 5:6
check_stuff -c10:20 Critical if "stuff" is 10 to 20

NOTE: sometimes you need to escape the special characters.  See the example below...

./check_mssql -H hostname -p 1433 -U username -P password -D database -w 2.0 -c 3.5 \
 -q "exec database.dbo.StoredProcedure variable1, variable2" -W32\: -C10\: -s

The above will WARN when the value my stored procedure returns is LESS than 32 and CRITICAL when LESS than 10.