Snmp memory check

Script : check_snmp_mem.pl

Last update : Sept 4 2006

Description :

Checks by snmp v1, v2c or v3 :

- Memory and swap usage on Linux given by Net-snmp.
It checks memory and swap usage independantly : one warning and critical level for each of them.

- Memory usage on cisco routers or Pix : the plugin will add all of the memory pool and then checks the warning and critical levels.
On cisco routeurs, it will add 'IO' and 'Processor' memory
On Pix, it will check the memory used (one memory pool only on Pix).

- Memory usage on HP Procurve switch.
Memory segments will be added then the free memory will be checked.

Vérification de :
- l'utilisation mémoire et swap sur Linux/Net-snmp
- l'utilisation mémoire sur Cisco (routeurs et Pix).
Pour d'autres SE (Windows, AS400), lire la suite.

Checking memory for other os :

AS/400 : use the check_snmp_storage command to check the RAM

./check_snmp_storage.pl -H <IP> -C <community> -m RAM -s -w <warn%> -c <crit%>

Windows : use the check_snmp_storage command to check the virtual memory (RAM+Swap)

./check_snmp_storage.pl -H <IP> -C <community> -m "^Virtual Memory$" -w <warn%> -c <crit%>

SNMP Login

See snmp info page

Requirements :

- Perl in /usr/bin/perl - or just run 'perl script'
- Net::SNMP
- file 'utils.pm' in plugin diretory (/usr/local/nagios/libexec)

Dowload lastest version : 1.1

Configurations examples

Changelog : On CVS repository on sourceforge : http://nagios-snmp.cvs.sourceforge.net/nagios-snmp/plugins/.

Examples :

All examples below are considering the script is local directory. Host to be checked is with snmp community "public".

Get help

./check_snmp_mem.pl -h

Verbose output ./check_snmp_mem.pl -H <IP> -C <com> -w 80 -c 81 -v
snmpv3 login ./check_snmp_mem.pl -H -l login -x passwd



%used of
- RAM < 99% and 100%
- Swap : < 20% and 30%

./check_snmp_mem.pl -H <IP> -C <com> -w 99,20 -c 100,30

Same with no warning levels for memory

./check_snmp_mem.pl -H <IP> -C <com> -w 0,20 -c 100,30

Check memory on Cisco

./check_snmp_mem.pl -H <IP> -C <com> -I -w 90% -c 98%

Output of check_snmp_mem.pl -h <

SNMP Memory Monitor for Nagios version 1.1

(c)2004-2006 - Patrick Proy

Usage: ./check_snmp_mem.pl [-v] -H <host> -C <snmp_community> [-2] | (-l login -x passwd [-X pass -L <authp>,<privp>])  [-p <port>] -w <warn level> -c <crit level> [-I|-N|-E] [-f] [-m] [-t <timeout>] [-V]

-v, --verbose

   print extra debugging information (including interface list on the system)

-h, --help

   print this help message

-H, --hostname=HOST

   name or IP address of host to check

-C, --community=COMMUNITY NAME

   community name for the host's SNMP agent (implies SNMP v1 or v2c with option)

-2, --v2c

   Use snmp v2c

-l, --login=LOGIN ; -x, --passwd=PASSWD

   Login and auth password for snmpv3 authentication 

   If no priv password exists, implies AuthNoPriv 

-X, --privpass=PASSWD

   Priv password for snmpv3 (AuthPriv protocol)

-L, --protocols=<authproto>,<privproto>

   <authproto> : Authentication protocol (md5|sha : default md5)

   <privproto> : Priv protocole (des|aes : default des) 

-P, --port=PORT

   SNMP port (Default 161)

-w, --warn=INTEGER | INT,INT

   warning level for memory in percent (0 for no checks) 

     Default (-N switch) : comma separated level for Real Memory and Swap 

     -I switch : warning level

-c, --crit=INTEGER | INT,INT

   critical level for memory in percent (0 for no checks)

     Default (-N switch) : comma separated level for Real Memory and Swap 

     -I switch : critical level

-N, --netsnmp (default)

   check linux memory & swap provided by Net SNMP 

-m, --memcache

   include cached memory in used memory (only with Net-SNMP)

-I, --cisco

   check cisco memory (sum of all memory pools)

-E, --hp

   check HP proccurve memory

-f, --perfdata

   Performance data output

-t, --timeout=INTEGER

   timeout for SNMP in seconds (Default: 5)

-V, --version

   prints version number

This project is hosted on :
SourceForge.net Logo

Nagios and the Nagios logo are registered trademarks of Ethan Galstad.