View previous topic :: View next topic |
Author |
Message |
Arto
Joined: 19 Jan 2016 Posts: 3
|
Posted: Tue Jan 19, 2016 1:05 pm Post subject: linux rma |
|
|
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 |
|
Back to top |
|
|
KS-Soft
Joined: 03 Apr 2002 Posts: 12795 Location: USA
|
Posted: Tue Jan 19, 2016 2:23 pm Post subject: |
|
|
Linux version?
What exactly script code do you use? Exactly like this?
Code: | #!/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 |
|
|
Back to top |
|
|
Arto
Joined: 19 Jan 2016 Posts: 3
|
Posted: Wed Jan 20, 2016 3:08 am Post subject: |
|
|
ubuntu 14.04.3 LTS (GNU/Linux 3.19.0-25-generic x86_64
command is:
ps -eo nlwp | tail -n +2 | awk '{ num_threads += $1 } END { print num_threads }'
(like it is in script manager, SYSTEM: # of processes (total)).
if I run it from server console it works fine, no errors just correct result. |
|
Back to top |
|
|
KS-Soft
Joined: 03 Apr 2002 Posts: 12795 Location: USA
|
Posted: Wed Jan 20, 2016 7:06 am Post subject: |
|
|
Code: | ps -eo nlwp | tail -n +2 | awk '{ num_threads += $1 } END { print num_threads }'
(like it is in script manager, SYSTEM: # of processes (total)). |
1) by default script manager does not have such script, its your own script;
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/mframe.htm#tests.htm#createshellscript
Regards
Alex[/quote][/code] |
|
Back to top |
|
|
Arto
Joined: 19 Jan 2016 Posts: 3
|
Posted: Wed Jan 20, 2016 8:35 am Post subject: |
|
|
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 |
|
Back to top |
|
|
KS-Soft
Joined: 03 Apr 2002 Posts: 12795 Location: USA
|
Posted: Wed Jan 20, 2016 8:45 am Post subject: |
|
|
<MaxLimit> is name of the parameter. You should set some specific value - integer NUMBER that tells script when Bad status should be triggered
Regards
Alex |
|
Back to top |
|
|
|