Nagios check_netsnmp_memory and RHEL6

Today I was searching for a nagios check which gets memory information over snmp. So I came across check_netsnmp_memory. It has also a nice php template for pnp4nagios.

To test the command I run:

# ./check_netsnmp_memory -L “Memory Utilization” -A ‘*’ -H graylog2.domb.net -C public -a ‘total,user,cached,buffer,%used_real,%used_swap,%user_real,%cached_real’ -w ‘,,,500MB,,65%,65%,’  -c ‘,,,800MB,,80%,80%,’

As a result I got this:

ERROR: snmp get_request failed – Received noSuchName(2) error-status at error-index 7.

Seems that one of the snmp checks does not get a value back. So i looked at the check_netsnmp_memory script.

On line  56  you’ll find  “shared=snmp(1.3.6.1.4.1.2021.4.13.0),1000,/,round(1),’ MB’,+”,

This queries the following value UCD-SNMP-MIB::memShared.0.

Aha 🙂 memShared.

As far as I now “memShared” is no longer valid in Linux >= 2.6 kernel and was dropped from
net-snmp. Because we know that this value should be always ‘0’ you can comment  line 56 and replace shared with a ‘0’ on line 65.

line 56:

“shared=snmp(1.3.6.1.4.1.2021.4.13.0),1000,/,round(1),’ MB’,+”,
+ # “shared=snmp(1.3.6.1.4.1.2021.4.13.0),1000,/,round(1),’ MB’,+”,

line 65:

“user=total_real,avail_real,-,total_swap,+,avail_swap,-,buffer,-,shared,-,cached,-,’ MB’,+”,
+ “user=total_real,avail_real,-,total_swap,+,avail_swap,-,buffer,-,0,-,cached,-,’ MB’,+”,

Now run the command again:

# ./check_netsnmp_memory -L “Memory Utilization” -A ‘*’ -H graylog2.domb.net -C public -a ‘total,user,cached,buffer,%used_real,%used_swap,%user_real,%cached_real’ -w ‘,,,500MB,,65%,65%,’  -c ‘,,,800MB,,80%,80%,’

Memory Utilization OK – total is 24846.1 MB [16457.5 MB real 8388.6 MB swap : 8734.0 MB free], user is 7149 MB, cached is 8803.8 MB, buffer is 159.3 MB, %used_real is 97.76%, %used_swap is 0.27%, %user_real is 43.44%, %cached_real is 53.49% | total_free=8734.0 %avail_real=2.24 %avail_swap=99.73 %buffer_real=0.97 user=7149 %user_real=43.44 avail_swap=8365.7 %used_real=97.76 used_swap=22.9 total=24846.1 %cached_real=53.49 cached=8803.8 total_swap=8388.6 buffer=159.3 min_swap=16.0 avail_real=368.3 total_real=16457.5 %used_swap=0.27