I have an agent on Linux machine and I try to check number of processes (total). I use " built in" script for that and it works, but reply is always:
Error: Invalid result (number of processes here).
I get the number of processes, but what is this "Error: Invalid result".
Why is the result invalid???
I also tried with ssh test, but reply is the same
linux rma
Linux version?
What exactly script code do you use? Exactly like this?
What exactly script code do you use? Exactly like this?
Code: Select all
#!/bin/sh
if [ $# -ge 1 ]
then
OS=`uname`
case $OS in
AIX) PLIST='ps -A';;
Linux) PLIST='ps -ax';;
FreeBSD)PLIST='ps -ax';;
NetBSD) PLIST='ps -ax';;
OpenBSD)PLIST='ps -ax';;
SunOS) PLIST='ps -e';;
*) echo 'ScriptRes:Unknown:script is not designed for '$OS
exit;;
esac
$PLIST | awk 'BEGIN {count=-1} {count++} END { if (count>'$1') {printf("ScriptRes:Bad:%d\n",count)} else {printf("ScriptRes:Ok:%d\n",count)} }'
else
echo 'ScriptRes:Unknown:not enough parameters specified'
fi
Code: Select all
ps -eo nlwp | tail -n +2 | awk '{ num_threads += $1 } END { print num_threads }'
(like it is in script manager, SYSTEM: # of processes (total)).
2) its not correct script and it returns invalid result
Please use script I posted above (yesterday) - this script comes with HostMonitor. As you may see it uses special keywords like "ScriptRes:Bad", "ScriptRes:Ok".
Please check the manual: "Requirements to the script" section
http://www.ks-soft.net/hostmon.eng/mfra ... hellscript
Regards
Alex[/quote][/code]
I tested your script using script Manager "test" button.
if Params field is empty
----------
- Status: Unknown
- Reply: not enough parameters specified
----------
if params field is: <MaxLimit>
awk: cmd. line:1: BEGIN {count=-1} {count++} END { if (count><MaxLimit>) {printf("ScriptRes:Bad:%d\n",count)} else {printf("ScriptRes:Ok:%d\n",count)} }
awk: cmd. line:1: ^ syntax error
awk: cmd. line:1: BEGIN {count=-1} {count++} END { if (count><MaxLimit>) {printf("ScriptRes:Bad:%d\n",count)} else {printf("ScriptRes:Ok:%d\n",count)} }
awk: cmd. line:1: ^ syntax error
if Params field is empty
----------
- Status: Unknown
- Reply: not enough parameters specified
----------
if params field is: <MaxLimit>
awk: cmd. line:1: BEGIN {count=-1} {count++} END { if (count><MaxLimit>) {printf("ScriptRes:Bad:%d\n",count)} else {printf("ScriptRes:Ok:%d\n",count)} }
awk: cmd. line:1: ^ syntax error
awk: cmd. line:1: BEGIN {count=-1} {count++} END { if (count><MaxLimit>) {printf("ScriptRes:Bad:%d\n",count)} else {printf("ScriptRes:Ok:%d\n",count)} }
awk: cmd. line:1: ^ syntax error