SNMP Check like in : https://forum.checkmk.com/t/add-specific-snmp-checks-to-already-discovered-host/27061/3

Hello

I’m trying to create an snmp check (manual) but i’m not sure how to do it.

I saw that it’s possible on this topic but i can’t find this menu on my checkmk (trial).

→ check_snmp Nagios plugin so you can create “Classical active and passive Monitoring checks” rules which runs the plugin against the OIDs you need.

Can anyone help me ?

Best regards,

Anas Simri

HOW TO:

SNMP specific OID monitor with CheckMK

  1. Search via ‘setup’ menu where your device is located (which folder), take note

  2. Click setup and type “Integrate nagios plugins”

  3. 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:

  1. start ≤ end

  2. start and “:” is not required if start=0

  3. if range is of format “start:” and end is not specified, assume end is infinity

  4. to specify negative infinity, use “~”

  5. alert is raised if metric is outside start and end range (inclusive of endpoints)

  6. 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

Hi @Steven1 Steven,
Thank you for your answer,

i’ve done this :

But it’s not working :confused:

Best regards

@AnasSplit if you like have a look one of the checks from the Exchange. The first one is basicaly a WATO rule set for check_snmp and the second one add’s a metric (perffdata) to the check.

https://exchange.checkmk.com/p/check-snmp

https://exchange.checkmk.com/p/check-snmp-metric

you will find the latest versions of this plugins on github.

1 Like

@thl-cmk Tank you very much it worked !

image

I tested my check on the OID .1.3.6.1.4.1.9.9.63.1.3.8.5.1.1.1 with the 3 ways :

Best regards,
Anas Simri

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed. Contact an admin if you think this should be re-opened.