Build precise queries to find exactly what you need
Press ESC to close
Join our next live webinar: “Advanced Nagios Monitoring Techniques” – Register Now
Your review has been submitted and is pending approval.
This plugin can check memory and swap usage on Windows or Linux Server using SNMP v1 queries.
Current Version
2.0
Last Release Date
2018-06-02
Owner
LAMY
Website
https://github.com/ynlamy/check_snmp_memory
Download URL
https://raw.githubusercontent.com/ynlamy/check_snmp_memory/master/check_snmp_memory
License
GPL
Compatible With
check_snmp_memory is written in Bash and is distributed under the GPLv2 license. This plugin have been created by Yoann LAMY. Usage: ./check_snmp_memory -H xxx.xxx.xxx.xxx -C public -w 80 -c 90 -H ADDRESS Name or IP address of host (default: 127.0.0.1) -C STRING Community name for the host's SNMP agent (default: public) -w INTEGER Warning level for memory in percent (default: 0) -c INTEGER Critical level for memory in percent (default: 0) -h Print this help screen -V Print version and license information This plugin uses the 'snmpget' command included with the NET-SNMP package. This plugin support performance data output. If the percentage of the warning and critical levels are set to 0, then the script returns a OK state. This nagios plugins comes with ABSOLUTELY NO WARRANTY. You may redistribute copies of the plugins under the terms of the GNU General Public License v2.
On linux system this plugin creates false alerts by exceeding thresholds without any reason. The way the memory usage is calclulated is just plain wrong. It tries to tell us that most systems have 98% usage just because the buffers for I/O are using them but they have to be subtracted before taking the thresholds into account.
I have this plugin up and running and it works really well. One issue that I am having is that I cannot get the Warning and Critical state to trigger an alarm. I have -w 80 -c 90 set and I have a server at 98% ram utilization, but the status in Nagios shows as Green status. Any suggestions?
I do some change to the script to support faulty Windows 2000. Defined 2 new OID: OID_TOTAL_W2K="HOST-RESOURCES-MIB::hrMemorySize" OID_USED_W2K="HOST-RESOURCES-MIB::hrSWRunPerfMem" and then added after MEMORY_USED_ID=`$CMD_SNMPWALK -t 2 -r 2 -v 1 -c $COMMUNITY $HOSTNAME $OID_TAGMEMORY | $CMD_GREP -i 'Physical Memory|Real Memory' | $CMD_AWK '{ print $1}' | $CMD_AWK -F "." '{print $NF}'` this test: if [ -z "$MEMORY_USED_ID" ]; then MEMORY_USED_ID="0" fi finally, in main block: if [ $MEMORY_USED_ID != "0" ]; then MEMORY_TOTAL=`$CMD_SNMPGET -t 2 -r 2 -v 1 -c $COMMUNITY -OvqU $HOSTNAME ${OID_TOTAL}.${MEMORY_USED_ID}` SWAP_TOTAL=`$CMD_SNMPGET -t 2 -r 2 -v 1 -c $COMMUNITY -OvqU $HOSTNAME ${OID_TOTAL}.${SWAP_USED_ID}` MEMORY_UNIT=`$CMD_SNMPGET -t 2 -r 2 -v 1 -c $COMMUNITY -OvqU $HOSTNAME ${OID_UNIT}.${MEMORY_USED_ID}` SWAP_UNIT=`$CMD_SNMPGET -t 2 -r 2 -v 1 -c $COMMUNITY -OvqU $HOSTNAME ${OID_UNIT}.${SWAP_USED_ID}` MEMORY_USED=`$CMD_SNMPGET -t 2 -r 2 -v 1 -c $COMMUNITY -OvqU $HOSTNAME ${OID_USED}.${MEMORY_USED_ID}` SWAP_USED=`$CMD_SNMPGET -t 2 -r 2 -v 1 -c $COMMUNITY -OvqU $HOSTNAME ${OID_USED}.${SWAP_USED_ID}` else # Windows 2000 MEMORY_TOTAL=`$CMD_SNMPGET -t 2 -r 2 -v 1 -c $COMMUNITY -OvqU $HOSTNAME ${OID_TOTAL_W2K}.0` SWAP_TOTAL=`$CMD_SNMPGET -t 2 -r 2 -v 1 -c $COMMUNITY -OvqU $HOSTNAME ${OID_TOTAL}.${SWAP_USED_ID}` MEMORY_UNIT=1024 SWAP_UNIT=`$CMD_SNMPGET -t 2 -r 2 -v 1 -c $COMMUNITY -OvqU $HOSTNAME ${OID_UNIT}.${SWAP_USED_ID}` MEMORY_USED=`$CMD_SNMPWALK -t 2 -r 2 -v 1 -c $COMMUNITY $HOSTNAME ${OID_USED_W2K} | cut -f 4 -d " " |paste -sd+|bc` SWAP_USED=`$CMD_SNMPGET -t 2 -r 2 -v 1 -c $COMMUNITY -OvqU $HOSTNAME ${OID_USED}.${SWAP_USED_ID}` fi Maybe isn't best way, but t works. Regards Cristiano
It needs only one change when deciding whether to notify for WARNING or CRITICAL status: ------------------------ instead of: if [ $MEMORY_USED_REAL_POURCENT -gt $WARNING ] && [ $WARNING != 0 ]; then STATE=$STATE_WARNING this line shall be like this: if [ $MEMORY_USED_REAL_POURCENT -gt $WARNING ] && [ $MEMORY_USED_REAL_POURCENT -lt $CRITICAL ] && [ $WARNING != 0 ]; then STATE=$STATE_WARNING ---------------------------- Also, the value for size should be changed from Go to GB.
Thank you, it is corrected. Regards.
on a 12 GB memory produces an error: ./check_snmp_memory.txt -H 172.16.1.100 -C snmp -w 80 -c 90 ./check_snmp_memory.txt: line 123: /usr/bin/bc: No such file or directory ./check_snmp_memory.txt: line 123: /usr/bin/bc: No such file or directory ./check_snmp_memory.txt: line 123: /usr/bin/bc: No such file or directory ./check_snmp_memory.txt: line 123: /usr/bin/bc: No such file or directory Memory usage : Go used for a total of Go (92%), SWAP usage : Go used for a total of Go (45%)| total=12873891840B;10299113472;11586502656;0 used=11957960704B;0;0;0 swap=12575440896B;0;0;0 buffer=0B;0;0;0 cache=0B;0;0;0
This error indicates that the command bc was not found. - yum install bc - whereis bc Regards.
This plugins is very useful. I support procotol version. https://gist.github.com/1097533 Thanks.
You must be logged in to submit a review.
To:
From: