Build precise queries to find exactly what you need
Press ESC to close
Join our next live webinar: “Advanced Nagios Monitoring Techniques” – Register Now
Your review has been submitted and is pending approval.
This shell script checks cpu utilization (user,system,iowait,idle in %) with iostat accepting seperate threshholds and returning the data in a format suitable for performance data processing
Current Version
Last Release Date
June 15, 2009
Owner
Nagios Exchange
Compatible With
text/plain
The script is based on the original script of Steve Bosek. I have modified it so it accepts different thresholds for user/system/iowait and prints output that can be automatically parsed by pnp performance data processing.
It requires sysstat package for iostat
Hi Is there any reason it print such a huge user percent of 5599% nagios@cubic:~> ./chk_perf_cpu.sh -uw 70 -iw 95 -sw 85 -uc 80 -ic 98 -sc 95 -n 5 CPU CRITICAL : user=5599% system=10% iowait=88% idle=2% | cpu_user=5599%;70;80; cpu_sys=10%;85;95; cpu_iowait=88%;95;98; cpu_idle=2%; nagios@cubic:~>
Good plugin. I use it on my job. I found a little difference in my environment iostat results. I'll try to explain it showing you modified lines: 1) idle parameter position: CPU_IDLE=`echo $CPU_REPORT | cut -d ";" -f 7` 2) test for thresholds: if [[ $CPU_IOWAIT > $IO_CPU_C || $CPU_USER > $U_CPU_C || $CPU_SYSTEM > $S_CPU_C ]]; then echo "CPU CRITICAL : user=${CPU_USER}% system=${CPU_SYSTEM}% iowait=${CPU_IOWAIT}% idle=${CPU_IDLE}% | cpu_user=${CPU_USER}%;${U_CPU_W};${U_CPU_C}; cpu_sys=${CPU_SYSTEM}%;${S_CPU_W};${S_CPU_C}; cpu_iowait=${CPU_IOWAIT}%;${IO_CPU_W};${IO_CPU_C}; cpu_idle=${CPU_IDLE}%;" exit $STATE_CRITICAL fi ...and obviously for WARNING test. P.S. I use zLinux servers in OS/390 environment. my uname is: 2.6.18-194.el5 #1 SMP Tue Mar 16 22:05:06 EDT 2010 s390x s390x s390x GNU/Linux Hope it helps. Paolo
The script is really good. Just few updated needed: as the new version is using vmstat and not iostat, so it would be nice to check vmstat: here is my modification: #IOSTAT=/usr/bin/iostat VMSTAT=/usr/bin/vmstat and the check: # if [ ! -x $IOSTAT ]; then if [ ! -x $VMSTAT ]; then # echo "UNKNOWN: iostat not found or is not executable by the nagios user." echo "UNKNOWN: vmstat not found or is not executable by the nagios user." exit $STATE_UNKNOWN fi
works remotely through nrpe. can be graphed with pnp4nagios, does execute from command line ./check_cpu.sh but doesn't work locally when defined in nagios services and commands says (timeout) that's at least on gentoo.
You must be logged in to submit a review.
To:
From: