HOW TO:
SNMP specific OID monitor with CheckMK
-
Search via ‘setup’ menu where your device is located (which folder), take note
-
Click setup and type “Integrate nagios plugins”
-
Scroll down and select the correct folder where your device is located, if selected, click on ‘Create rule in folder’
-
- Give you check a name in the ‘Description’
- Add a comment if you would like
- tick the box for ‘Command Line’ and enter following command:
check_snmp -H $HOSTADDRESS$ -C public -o 1.3.6.1.4.1.3097.6.5.1.1.0 -P2c -w 19 -c 18
- tick the box for explicit hosts and select your device
Explanation of the command line:
-
Check_snmp: use SNMP to run the monitoring
-
-H $hostaddress$ The device’s IP or dns name is filled in here automatically
-
-C public The community string (change public to what you have config’d)
-
-o x.x.x.x.x.x.x The OID that needs to be checked
-
-P2c Which version on SNMP to use
-
-w xx On which number to set to ‘Warning state’
-
-c xx On which number to set to ‘Critical state’
Adjust according to this link: Monitoring Plugins Development Guidelines (copied below for reference)
2.5. Threshold and ranges
A range is defined as a start and end point (inclusive) on a numeric scale (possibly negative or positive infinity).
A threshold is a range with an alert level (either warning or critical). Use the set_thresholds(thresholds *, char *, char *) function to set the thresholds.
The theory is that the plugin will do some sort of check which returns back a numerical value, or metric, which is then compared to the warning and critical thresholds. Use the get_status(double, thresholds *) function to compare the value against the thresholds.
This is the generalised format for ranges:
[@]start:end
Notes:
-
start ≤ end
-
start and “:” is not required if start=0
-
if range is of format “start:” and end is not specified, assume end is infinity
-
to specify negative infinity, use “~”
-
alert is raised if metric is outside start and end range (inclusive of endpoints)
-
if range starts with “@”, then alert if inside this range (inclusive of endpoints)
Note: Not all plugins are coded to expect ranges in this format yet. There will be some work in providing multiple metrics.
Table 3. 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}) |
Table 4. 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 (will be critical if “stuff” is less than 0) |
check_stuff -c5:6 | Critical if “stuff” is less than 5 or more than 6 |
check_stuff -c@10:20 | OK if stuff is less than 10 or higher than 20, otherwise critical |