Archive for August, 2008

Nagios plugin: check_cpu.sh and check_mem.sh

Saturday, August 23rd, 2008

I have written a couple more Nagios plugins for use with NRPE on linux machines. The first one, “check_cpu.sh ,” grabs the cpu state from “/proc/stats” and sends back a status result and perfdata. You can tell it to send back either the aggregate data from all cpus as a single total or can have it return all cpus individually. Be aware though, that if you wish to have it send data on all cpu’s you will need to patch Nagios to allow for a larger perfdata return buffer. I didn’t want to mess with doing that, so I just have it watch the aggregate data.

check_cpu.sh preview

The second plugin, “check_mem.sh,” will parse the output of “free -mt” to give you a look at the current memory and swap utilization.

check_mem.sh preview

Nagios plugin: check_snmp_ifstatus.pl

Wednesday, August 13th, 2008

While looking around for a nagios plugin to monitor the ethernet interfaces on my equipment, I just could not find one that did exactly what I wanted. So… I did exactly what OSS was designed for.  I took a plugin that had similar functionality as a starting point and re-wrote it to operate the way I needed. This is the result of my re-write of check_iftraffic.pl found on NagiosExchange.

“check_snmp_ifstatus.pl” will take a host IP address and interface name and return the current status of the interface. The returned data includes the UP/DOWN status, the interface line speed, and the current RX/TX bps. This status is returned as both an OK/Warning/Critical description and performance data usable with rrdtool. I have also created a pnp4nagios template for use with the plugin so that the perfdata can be easily viewed.

# check_snmp_ifstatus.pl -H 10.0.0.1 -i "Ethernet0/0"
OK: Ethernet0/0 is UP at 10Mbps. RX=72.27Kbps (0.72%), TX=4.094Kbps (0.04%) | RXbps=72271;8500000;9800000;0;10000000 TXbps=4094;8500000;9800000;0;10000000 RXpct=0.72%;85;98;0;100 TXpct=0.04%;85;98;0;100 elapsed=30s;3435;;;

(more…)