Search All Sites
Nagios Live WebinarsLet our experts show you how Nagios can help your organization.
Don't miss your chance to attend the 2014 Nagios World Conference, Oct 13-16th. Informative Sessions, Networking, Food and Cocktails! Visit go.nagios.com/conference/ for more information or to register.
- Nagios 3.x
It uses SNMP to fetch cpu, load, ram or swap metrics.
All four checks are built into one script, symlinks control how you call the script (and therefore what it returns).
* Written in Perl - easy to modify
* Justin Ellison's check mem for Solaris (ZFS caching)
* Multiple (fallback) OIDs are checked until one returns results
* Flexible controls (e.g. return in MB or % used, above or below thresholds, etc)
* NOTE: Although this script 'falls back' to SSH if SNMP is not working, Solaris SWAP is not supported. It will return results, but the Solaris swap command reports back a summary of both physical memory and swap space together. Therefore, running "swap -s" on Solaris will NOT match the SNMP results you get with this script! A more accurate match can be found by running the "top" command (if you have it installed) and looking at the "total swap" and "free swap" metrics in that tool.
1) Put check_cpu into your Nagios libexec directory
(e.g. /usr/local/Nagios/libexec, or wherever Nagios is installed on your server)
2) Create the symbolic links, being careful not to overwrite any files by the same name already there:
ln –s check_cpu check_load
ln –s check_cpu check_ram
ln –s check_cpu check_swap
(these symlinks dictate how the script is run, as it can check CPU, RAM, load and swap, depending on how it is invoked)
3) If you are checking any Solaris hosts with ZFS:
a) Put the snmpd_check_mem onto any remote ZFS hosts you are monitoring (install it under /usr/local/nagios/libexec)
b) Edit snmpd.conf on remote host.
- If you are using Net-SNMPd version 5.2 or above, add this line to snmpd.conf:
extend checkmem /usr/local/nagios/libexec/snmpd_check_mem
- For versions of Net-SNMPd prior to 5.2 (including the Solaris 10 SMA version 5.0.9), use this line in your snmpd.conf file instead:
exec checkmem /usr/local/bin/perl /usr/local/nagios/libexec/snmpd_check_mem
4) Edit your Nagios commands.cfg file and add some entries like this:
# 'check_cpu' command definition
# w = Warning level (if CPU % idle falls below this level - must be a percentage)
# c = Critical level
command_line $USER1$/check_cpu -H $HOSTADDRESS$ -w $ARG1$ -c $ARG2$ -p $USER3$
# 'check_swap' command definition
# w = Warning level (if % or MB swap free drops below this level)
# c = Critical level
command_line $USER1$/check_swap -H $HOSTADDRESS$ -w $ARG1$ -c $ARG2$ -p $USER3$
# 'check_ram' command definition
# w = Warning level defined as percentage (with % sign) or in megabytes (without % sign)
# c = Critical level (can be defined as percentage or MB independently of warning)
# o = below|above --> if mem [free drops BELOW] or [used rises ABOVE] thresholds
command_line $USER1$/check_ram -H $HOSTADDRESS$ -w $ARG1$ -c $ARG2$ -p $USER3$ -o $ARG3$
# 'check_load' command definition
# w = Warning levels (alert if n,n,n (1,5,15 minute load averages) go above these levels)
# c = Critical levels
command_line $USER1$/check_load -H $HOSTADDRESS$ -w $ARG1$ -c $ARG2$ -p $USER3$
For additional information about Justin's ZFS mem check, see his website:
Please note that the version I include here HAS BEEN MODIFIED and hard coded to return results in a different format.