<HTML> <HEAD> <TITLE>Nagios plugins</TITLE> <META NAME="Keywords" CONTENT="nagios,plugins,perl,snmp,proy"> <STYLE type="text/css"> <!-- .Default { font-family: verdana,arial,serif; font-size: 10pt; } .ProgramTitle { font-family: verdana,arial,serif; font-size: 18pt; font-weight: bold;} .Copyright { font-family: verdana,arial,serif; font-size: 10pt;} .Email { font-family: verdana,arial,serif; font-size: 10pt;} .NewsItem { font-family: verdana,arial,serif; font-size: 8pt; } .NewsItemOdd { font-family: verdana,arial,serif; font-size: 8pt; background-color: #DBDBDB;} .NewsItemEven { font-family: verdana,arial,serif; font-size: 8pt; background-color: #C4C2C2;} .NewsItemUrgent { font-family: verdana,arial,serif; font-size: 8pt; background-color: #ccff99;} .NewsItemDate { font-family: verdana,arial,serif; font-size: 8pt; font-weight: bold; } .SectionTitle { font-family: verdana,arial,serif; font-size: 9pt; font-weight: bold; text-decoration: underline;} .SectionBody { font-family: verdana,arial,serif; font-size: 8pt; } .ModificationDate { font-family: verdana,arial,serif; font-size: 7pt; } .Disclaimer { font-family: verdana,arial,serif; font-size: 8pt; } A.SideNavBarItem { font-family: verdana,arial,serif; background-color : black; color: #e7e7e7; font-size: 9pt; font-weight: bold; text-decoration: none; } A.SideNavBarItem:Hover { font-family: verdana,arial,serif; background-color : black; color: #ccff33; font-size: 9pt; font-weight: bold; text-decoration: none; } A.SideNavBarHotItem { font-family: verdana,arial,serif; background-color : black; color: #ffcc66; font-size: 9pt; font-weight: bold; text-decoration: none; } A.SideNavBarHotItem:Hover { font-family: verdana,arial,serif; background-color : black; color: #ccff33; font-size: 9pt; font-weight: bold; text-decoration: none; } --> </STYLE> </HEAD> <body background="img/sideback.jpg" bgcolor="#FFFFFF" text="black" class="Default"> <!-- background="img/sideback.jpg" --> <table border="0"> <tr> <td valign=top> <!-- Begin Side Bar --> <table border="0" width="125" valign=top> <tr> <td><a href="http://nagios.manubulon.com/" class="SideNavBarItem" >Home</a></td> </tr> <tr> <td></td> </tr> <tr> <td><BR> </td> </tr> <tr> <td> </td> </tr> </table> <!-- End Side Bar --> </td> <td valign=top> <table border="0" valign=top> <tr> <td class="ProgramTitle"> Snmp storage check</td> </tr> <tr> <td> <p class="NewsItemDate">Script : check_snmp_storage.pl</p> <p class="SectionTitle"> Last update : March 12 2007</p> </td> </tr> <tr> <td valign="top"> <p class="SectionTitle">Description : </p> <p class="SectionBody">This scripts checks by snmp (V1 and v3) disks, memory, swap, everthing in hrStorage table. <br> Storages selection can be done : <br> - by perl regexp on description or index (<i>-m</i>)<br> - and (optional) by storage type (<i>-q</i>) : Other, Ram, VirtualMemory, FixedDisk, RemovableDisk, FloppyDisk, CompactDisk, RamDisk, FlashMemory, NetworkDisk<br> <br> One or multiple storages can be selected.<br> It is also possible to sum all selected storages (<i>-s</i>)<br> <br> Warning and critical levels can be checked based on : <br> - Percent of disk used<br> - Percent of disk left<br> - MB left<br> - MB used</p> <p class="SectionBody"><b> Output options</b> (<i>-S</i>): </p> <p class="SectionBody">-S can have 3 options : <type>[,<where>,<cut>]<br> <i><type></i> : Make the output shorter :<br> 0 : only print the global result except the disk in warning or critical<br> 1 : Don't print all info for every disk <br> <i><where></i> : (optional) if = 1, put the OK/WARN/CRIT at the beginning<br> <i><cut></i> : take the <n> first caracters or <n> last if n<0</p> <p class="SectionBody">With the following disks : /home : 51% used and / : 90% used</p> <table width="83%" border="1"> <tr> <td class="SectionBody" width="13%"><b>Option used</b></td> <td class="SectionBody" width="11%"><b>Warning</b></td> <td class="SectionBody" width="76%"><b>Output</b></td> </tr> <tr> <td class="SectionBody" width="13%"> </td> <td class="SectionBody" width="11%">99%</td> <td class="SectionBody" width="76%">/home: 51%used(1012MB/1969MB) /: 90%used(5781MB/6390MB) (<99%) : OK</td> </tr> <tr> <td class="SectionBody" width="13%"> </td> <td class="SectionBody" width="11%">90%</td> <td class="SectionBody" width="76%">/home: 51%used(1012MB/1969MB) /: 90%used(5781MB/6390MB) (>90%) : WARNING</td> </tr> <tr> <td class="SectionBody" width="13%">-S0</td> <td class="SectionBody" width="11%">90%</td> <td class="SectionBody" width="76%">All selected storages (<99%) : OK</td> </tr> <tr> <td class="SectionBody" width="13%">-S0</td> <td class="SectionBody" width="11%">99%</td> <td class="SectionBody" width="76%">/: 90%used(5781MB/6390MB) (>90%) : WARNING</td> </tr> <tr> <td class="SectionBody" width="13%">-S1</td> <td class="SectionBody" width="11%">90%</td> <td class="SectionBody" width="76%">/home: 51% /: 90% (<99%) : OK</td> </tr> <tr> <td class="SectionBody" width="13%">-S1</td> <td class="SectionBody" width="11%">99%</td> <td class="SectionBody" width="76%">/home: 51% /: 90%<b>used(5781MB/6390MB)</b> (>90%) : WARNING</td> </tr> <tr> <td class="SectionBody" width="13%">-S0,1</td> <td class="SectionBody" width="11%">90%</td> <td class="SectionBody" width="76%"><b>OK</b> : (<99%) All selected storages </td> </tr> <tr> <td class="SectionBody" width="13%">-S0,1</td> <td class="SectionBody" width="11%">90%</td> <td class="SectionBody" width="76%"><b>WARNING</b> : (>90%) /: 90%used(5781MB/6390MB)</td> </tr> <tr> <td class="SectionBody" width="13%">-S1,,<b>2</b></td> <td class="SectionBody" width="11%">99%</td> <td class="SectionBody" width="76%"><b>/h</b>: 51% /: 90% (<99%) : OK</td> </tr> <tr> <td class="SectionBody" width="13%">-S1,,<b>-2</b></td> <td class="SectionBody" width="11%">99%</td> <td class="SectionBody" width="76%"><b>me</b>: 51% /: 90% (<99%) : OK</td> </tr> <tr> <td class="SectionBody" width="13%">-S0,1,-2</td> <td class="SectionBody" width="11%">30%</td> <td class="SectionBody" width="76%">WARNING : (>30%) me: 51%used(1012MB/1969MB) /: 90%used(5781MB/6390MB)</td> </tr> </table> <p class="SectionBody"><b>Performance output </b>(<i>-f</i><b><i> </i></b>option)</p> <p class="SectionBody">The performance will remove any weird caracters ( <b>`~!$%^&*'"<>|?,(= )</b> ) from the drive name.</p> <p class="SectionBody"><b>Msg size option </b>(<i>-o</i><b><i> </i></b>option)</p> <p class="SectionBody">In case you get a "ERROR: running table : Message size exceeded maxMsgSize" error, you may need to adjust the maxMsgSize, i.e. the maximum size of snmp message with the -o option. Try a value with the -o AND the -v option : the script will output the actual value so you can add some octets to it with the -o option.</p> <p class="SectionBody"><span class="SectionTitle">SNMP Login</span><br> </p> <p class="SectionBody">See <a href="index_info.html">snmp info page</a></p> <p class="SectionBody">--- <br> V�rifie par snmp v1 ou v3 l'occupation des disques, mais aussi de la swap, de la m�moire, etc.. tout ce qui est disponible en snmp par la table hrStorage.<br> Les disques sont sélectionnables par expression régulière compatible Perl<br> </p> <p class="SectionTitle">Requirements :</p> <p class="SectionBody"> - Perl in /usr/bin/perl - or just run 'perl script' <br> - Net::SNMP<br> - file 'utils.pm' in plugin diretory (/usr/local/nagios/libexec)<br> </p> <p class="SectionBody"><a href="check_snmp_storage.pl" class="SectionTitle">Dowload lastest version : 1.3.2</a></p> <p class="SectionBody"><a href="index_commands.html" class="SectionTitle">Configurations examples</a></p> <p class="NewsItemDate"><span class="SectionTitle">Changelog</span> : On CVS repository on sourceforge : <a href="http://nagios-snmp.cvs.sourceforge.net/nagios-snmp/plugins/">http://nagios-snmp.cvs.sourceforge.net/nagios-snmp/plugins/</a>.<br> </p> <p class="SectionTitle">Examples :</p> <p class="SectionBody"><br> All examples below are considering the script is local directory. Host to be checked is 127.0.0.1 with snmp community "public".</p> <table border="1" cellspacing="5"> <tr> <td class="NewsItemDate" valign = top width="172"> <p>Get help </td> <td class="SectionBody" width="522"> <p>./check_snmp_storage.pl <b>-h</b></p> </td> </tr> <tr> <td class="NewsItemDate" valign = top width="172">List all storage</td> <td class="SectionBody" width="522">./check_snmp_storage.pl -H 127.0.0.1 -C public -m zzzz -w 80 -c 81 <b>-v</b></td> </tr> <tr> <td class="NewsItemDate" valign = top width="172">snmpv3 login</td> <td class="SectionBody" width="522">./check_snmp_storage.pl -H 127.0.0.1 -l login -x passwd<b></b></td> </tr> <tr> <td class="NewsItemDate" valign = top width="172"> <p> </td> <td class="SectionBody" width="522"> <p class="NewsItemDate">Unix/Linux</p> </td> </tr> <tr> <td class="NewsItemDate" valign = top width="172"> <p>%used of /home is less than 80% and 90% </td> <td class="SectionBody" width="522"> <p>./check_snmp_storage.pl -H 127.0.0.1 -C public <b>-m /home -w 80% -c 90%</b></p> </td> </tr> <tr> <td class="NewsItemDate" valign = top width="172"> <p>%free of /home is above 10% and 5% </td> <td class="SectionBody" width="522"> <p>./check_snmp_storage.pl -H 127.0.0.1 -C public -m /home <b>-w 10% -c 5%</b> <b>-T pl</b></p> </td> </tr> <tr> <td class="NewsItemDate" valign = top width="172"> <p>Mb used of /home is less than 800 Mb and 900 Mb </td> <td class="SectionBody" width="522"> <p>./check_snmp_storage.pl -H 127.0.0.1 -C public -m /home<b> -w 800 -c 900 -T bu</b></p> </td> </tr> <tr> <td class="NewsItemDate" valign = top width="172"> <p>Mb free of /home is above 100Mb and 30Mb </td> <td class="SectionBody" width="522"> <p>./check_snmp_storage.pl -H 127.0.0.1 -C public -m /home<b> -w 100 -c 30 -T bl</b></p> </td> </tr> <tr> <td class="NewsItemDate" valign = top width="172"> <p>All mountpoints have %used less than 80% and 90% </td> <td class="SectionBody" width="522"> <p>./check_snmp_storage.pl -H 127.0.0.1 -C public -m <b>/ </b>-w 80% -c 90%</p> </td> </tr> <tr> <td class="NewsItemDate" valign = top width="172"> %used of / mountpoint only is less than 80% and 90%</td> <td class="SectionBody" width="522"> <p>./check_snmp_storage.pl -H 127.0.0.1 -C public -m <b>/ -r </b>-w 80% -c 90%</p> </td> </tr> <tr> <td class="NewsItemDate" valign = top width="172"> %used of mountpoint index 1 only is less than 80% and 90%</td> <td class="SectionBody" width="522"> <p>./check_snmp_storage.pl -H 127.0.0.1 -C public <b>-m 1 -p </b>-w 80% -c 90%</p> </td> </tr> <tr> <td class="NewsItemDate" valign = top width="172"> Swap %used is less than 80% and 90%</td> <td class="SectionBody" width="522"> <p>./check_snmp_storage.pl -H 127.0.0.1 -C public <b>-m Swap </b>-w 80% -c 90%</p> </td> </tr> <tr> <td class="NewsItemDate" valign = top width="172"> Memory %used is less than 80% and 90%</td> <td class="SectionBody" width="522"> <p>./check_snmp_storage.pl -H 127.0.0.1 -C public <b>-m "Real Memory" </b>-w 80% -c 90%</p> </td> </tr> <tr> <td class="NewsItemDate" valign = top width="172"> </td> <td class="SectionBody" width="522"> <p class="NewsItemDate">Windows</p> </td> </tr> <tr> <td class="NewsItemDate" valign = top width="172"> %used of C is less than 80% and 90%</td> <td class="SectionBody" width="522"> <p>./check_snmp_storage.pl -H 127.0.0.1 -C public -m <b>^C: </b>-w 80% -c 90%</p> </td> </tr> <tr> <td class="NewsItemDate" valign = top width="172"> %used of C, D and E is less than 80% and 90%</td> <td class="SectionBody" width="522"> <p>./check_snmp_storage.pl -H 127.0.0.1 -C public -m <b>^[CDE]: </b>-w 80% -c 90%</p> </td> </tr> <tr> <td class="NewsItemDate" valign = top width="172"> %used of C+D+E is less than 80% and 90%</td> <td class="SectionBody" width="522"> <p>./check_snmp_storage.pl -H 127.0.0.1 -C public -m <b>^[CDE]: -s </b>-w 80% -c 90%</p> </td> </tr> <tr> <td class="NewsItemDate" valign = top width="172"> </td> <td class="SectionBody" width="522"> <p class="NewsItemDate">AS/400 specific</p> </td> </tr> <tr> <td class="NewsItemDate" valign = top width="172"> Sum of all memory storages is less than 90% and 95%</td> <td class="SectionBody" width="522"> <p>./check_snmp_storage.pl -H 127.0.0.1 -C public -m <b>RAM -s </b>-w 80% -c 90%</p> </td> </tr> </table> <p class="NewsItemDate">Output of check_snmp_storage.pl -h</p> <table border="1" cellspacing="5"> <tr> <td class="SectionBody" valign = top> <p class="SectionBody">SNMP Disk Monitor for Nagios version 1.3.2<br> (c)2004-2006 Patrick Proy <p>Usage: check_snmp_storage [-v] -H <host> -C <snmp_community> [-2] | (-l login -x passwd [-X pass -L <authp>,<privp>]) [-p <port>] -m <name in desc_oid> [-q storagetype] -w <warn_level> -c <crit_level> [-t <timeout>] [-T pl|pu|bl|bu ] [-r] [-s] [-i] [-e] [-S 0|1[,1,<car>]] [-o <octet_length>]<br> By default, plugin will monitor %used on drives :<br> warn if %used > warn and critical if %used > crit<br> -v, --verbose<br> print extra debugging information (and lists all storages)<br> -h, --help<br> print this help message<br> -H, --hostname=HOST<br> name or IP address of host to check<br> -C, --community=COMMUNITY NAME<br> community name for the host's SNMP agent (implies SNMP v1)<br> 2, --v2c<br> Use snmp v2c<br> -l, --login=LOGIN ; -x, --passwd=PASSWD<br> Login and auth password for snmpv3 authentication <br> If no priv password exists, implies AuthNoPriv <br> -X, --privpass=PASSWD<br> Priv password for snmpv3 (AuthPriv protocol)<br> -L, --protocols=<authproto>,<privproto><br> <authproto> : Authentication protocol (md5|sha : default md5)<br> <privproto> : Priv protocole (des|aes : default des) <br> -x, --passwd=PASSWD<br> Password for snmpv3 authentication<br> -p, --port=PORT<br> SNMP port (Default 161)<br> -m, --name=NAME<br> Name in description OID (can be mounpoints '/home' or 'Swap Space'...)<br> This is treated as a regexp : -m /var will match /var , /var/log, /opt/var ...<br> Test it before, because there are known bugs (ex : trailling /)<br> No trailing slash for mountpoints !<br> -q, --storagetype=[Other|Ram|VirtualMemory|FixedDisk|RemovableDisk|FloppyDisk<br> CompactDisk|RamDisk|FlashMemory|NetworkDisk]<br> Also check the storage type in addition of the name<br> It is possible to use regular expressions ( "FixedDisk|FloppyDisk" )<br> -r, --noregexp<br> Do not use regexp to match NAME in description OID<br> -s, --sum<br> Add all storages that match NAME (used space and total space)<br> THEN make the tests.<br> -i, --index<br> Parse index table instead of description table to select storage<br> -e, --exclude<br> Select all storages except the one(s) selected by -m<br> No action on storage type selection<br> -T, --type=TYPE<br> pl : calculate percent left<br> pu : calculate percent used (Default)<br> bl : calculate MegaBytes left<br> bu : calculate MegaBytes used<br> -w, --warn=INTEGER<br> percent / MB of disk used to generate WARNING state<br> you can add the % sign <br> -c, --critical=INTEGER<br> percent / MB of disk used to generate CRITICAL state<br> you can add the % sign <br> -f, --perfparse<br> Perfparse compatible output<br> -S, --short=<type>[,<where>,<cut>]<br> <type>: Make the output shorter :<br> 0 : only print the global result except the disk in warning or critical<br> ex: "< 80% : OK"<br> 1 : Don't print all info for every disk <br> ex : "/ : 66 %used (< 80) : OK"<br> <where>: (optional) if = 1, put the OK/WARN/CRIT at the beginning<br> <cut>: take the <n> first caracters or <n> last if n<0<br> -o, --octetlength=INTEGER<br> max-size of the SNMP message, usefull in case of Too Long responses.<br> Be carefull with network filters. Range 484 - 65535, default are<br> usually 1472,1452,1460 or 1440. <br> -t, --timeout=INTEGER<br> timeout for SNMP in seconds (Default: 5)<br> -V, --version<br> prints version number<br> Note : <br> with T=pu or T=bu : OK < warn < crit<br> with T=pl ot T=bl : crit < warn < OK<br> <br> If multiple storage are selected, the worse condition will be returned<br> i.e if one disk is critical, the return is critical<br> <br> example : <br> Browse storage list : <script> -C <community> -H <host> -m <anything> -w 1 -c 2 -v <br> the -m option allows regexp in perl format : <br> Test drive C,F,G,H,I on Windows : -m ^[CFGHI]: <br> Test all mounts containing /var : -m /var<br> Test all mounts under /var : -m ^/var<br> Test only /var : -m /var -r<br> Test all swap spaces : -m ^Swap<br> Test all but swap spaces : -m ^Swap -e<br> </p> </td> </tr> </table> </td> </tr> <tr> <td> <p class="SectionBody">This project is hosted on : <br> <A href="http://sourceforge.net/projects/nagios-snmp"> <IMG src="http://sourceforge.net/sflogo.php?group_id=134917&type=5" width="210" height="62" border="0" alt="SourceForge.net Logo" /></A> </p> <p class="SectionBody"> Nagios and the Nagios logo are registered trademarks of Ethan Galstad.</p> </td> </tr> </table> </td> </tr> </table> <p> </p> </BODY> </HTML>