Nagios plugin - check CPU performance : check_cpu_perf.sh

Support forum for Nagios Core, Nagios Plugins, NCPA, NRPE, NSCA, NDOUtils and more. Engage with the community of users including those using the open source solutions.
Locked
perumalr
Posts: 1
Joined: Thu Aug 21, 2014 12:35 pm

Nagios plugin - check CPU performance : check_cpu_perf.sh

Post by perumalr »

When the Server Timestamp goes 00:00:00, the plugin throws unknown alert - /usr/local/nagios/check_cpu_perf.sh: line 200: [: -lt: unary operator expected.

Did anyone out there faced this issue ? Any solution for this bug ?

Code: Select all

SARCPU=`/usr/bin/sar -P ALL|grep all|grep -v Average|tail -1`
…
…
SARCPUIDLE=`echo ${SARCPU}|awk '{print $8}'|awk -F. '{print $1}'`

++ awk -F. '{print $1}'
++ awk '{print $8}'
++ echo
+ SARCPUIDLE=
++ awk '{print "CPU Idle = " $8 "% | " "CpuUser=" $3 "; CpuNice=" $4 "; CpuSystem=" $5 "; CpuIowait=" $6 "; CpuSteal=" $7 "; CpuIdle=" $8""}'
++ echo
+ CPU='CPU Idle = % | CpuUser=; CpuNice=; CpuSystem=; CpuIowait=; CpuSteal=; CpuIdle='
+ '[' '' == false ']'
+ ALERT=true
+ '[' -lt 10 ']'
/usr/local/nagios/check_cpu_perf.sh: line 200: [: -lt: unary operator expected
+ '[' -lt 20 ']'
/usr/local/nagios/check_cpu_perf.sh: line 204: [: -lt: unary operator expected
tmcdonald
Posts: 9117
Joined: Mon Sep 23, 2013 8:40 am

Re: Nagios plugin - check CPU performance : check_cpu_perf.s

Post by tmcdonald »

Have you tried contacting the author? http://exchange.nagios.org/directory/Pl ... ce/details

We can certainly help troubleshoot, but I would suggest first reaching out to the author on Github for comment. Could be a simple fix that would take us a bit longer to find.
Former Nagios employee
Locked