Page 1 of 1

JRUN CPU test Constant bad when CPU usage is Good :(

Posted: Wed Mar 30, 2011 2:50 am
by Executionher
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

JRUN CPU test Constant bad when CPU usage is Good :(

Posted: Wed Mar 30, 2011 6:19 am
by KS-Soft Europe
This Script does not test CPU of your UBUNTU server.
It checks CPU usage of specific process.

Looks like you have not specified required parameters for the script.
This script requires two parameters: <Process Name> <MaxLimit>
E.g parameters may look like: Xorg 10
These parameters should be specified in Params field of Test properties dialog

Please check the manual or visit our web site for more information about Shell Script test parameters:
http://www.ks-soft.net/hostmon.eng/mfra ... m#chkShell