Executionher
Joined: 21 May 2010 Posts: 4
|
Posted: Wed Mar 30, 2011 2:50 am Post subject: JRUN CPU test Constant bad when CPU usage is Good :( |
|
|
Hi We have a shell script testing the CPU of our UBUNTU server: Process:%CPU usage (avarage)
#!/bin/sh
if [ $# -ge 2 ]
then
OS=`uname`
case $OS in
AIX) PSLIST='ps -Ao comm,pcpu';;
Linux) PSLIST='ps h -eo ucmd,pcpu';;
FreeBSD) PSLIST='ps -axco command,%cpu';;
NetBSD) PSLIST='ps -axco command,%cpu';;
OpenBSD) PSLIST='ps -axco command,%cpu';;
SunOS) PSLIST='ps -eo fname,pcpu';;
*) echo 'ScriptRes:Unknown:script is not designed for '$OS
exit;;
esac
$PSLIST | awk 'BEGIN { maxusage=0 } $1=="'$1'" {if ($2>maxusage) {maxusage=$2}} \
END { if (maxusage<='$2') {printf("ScriptRes:Ok:%d %%\n",maxusage)} else {printf("ScriptRes:Bad:%d %%\n",maxusage)} }'
else
echo "ScriptRes:Unknown:not enough parameters specified"
fi[/b]
This script was working correctly and for some or other reason it just became bad and is constantly bad It sucks
When I test it I get these results:
[10:50:03 AM] Script executed, correct result received:
----------
- Status: Unknown
- Reply: not enough parameters specified
----------
Any help here guys??
Regards CBW |
|