Search Exchange
Search All Sites
Nagios Live Webinars
Let our experts show you how Nagios can help your organization.Login
Directory Tree
check_cpu
1.9.2
2011-03-17
- Nagios 3.x
151469
File | Description |
---|---|
check_cpu | check_cpu script |
snmpd_check_mem | modified version of Justin Ellison's check_mem.pl |
Meet The New Nagios Core Services Platform
Built on over 25 years of monitoring experience, the Nagios Core Services Platform provides insightful monitoring dashboards, time-saving monitoring wizards, and unmatched ease of use. Use it for free indefinitely.
Monitoring Made Magically Better
- Nagios Core on Overdrive
- Powerful Monitoring Dashboards
- Time-Saving Configuration Wizards
- Open Source Powered Monitoring On Steroids
- And So Much More!
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).
Features:
* SNMP
* 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
define command{
command_name check_cpu
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
define command{
command_name check_swap
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
define command{
command_name check_ram
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
define command{
command_name check_load
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:
http://www.sysadminsjourney.com/content/2009/06/05/new-and-improved-checkmempl-nagios-plugin
Please note that the version I include here HAS BEEN MODIFIED and hard coded to return results in a different format.
.
.
.
* 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
define command{
command_name check_cpu
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
define command{
command_name check_swap
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
define command{
command_name check_ram
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
define command{
command_name check_load
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:
http://www.sysadminsjourney.com/content/2009/06/05/new-and-improved-checkmempl-nagios-plugin
Please note that the version I include here HAS BEEN MODIFIED and hard coded to return results in a different format.
Reviews (2)
bybaugustoss, December 12, 2012
It Works Great!! Help me to monitor my infrastructure.
Nice job
Nice job
I used this plugin to check cpu, swap and memory of Solaris machines without nrpe client and find this easy to use and configure.