Problem with a script

All questions related to installations, configurations and maintenance of Advanced Host Monitor (including additional tools such as RMA for Windows, RMA Manager, Web Servie, RCC).
Post Reply
mp1
Posts: 199
Joined: Tue Mar 07, 2006 3:24 am

Problem with a script

Post by mp1 »

Hi,

When I want to execute the following script via the linux agent, I get this error:


[15:19:57] Response from the agent: 301 - Script execution error: exec error: No such file or directory

Script:

#!/bin/sh
curl -L -k -s --basic -u root:xxxx https://xxxx | lynx -force_html --dump /dev/stdin | grep "current-connections" | sed -e s/"^[ \t]*"//g | cut -f3- -d" " | sed -e s/"[ ]*"//g | tr "\n" ";"

The script is working on the server without problem.

What I am doing wrong?

Thanks in advance

Martin
KS-Soft Europe
Posts: 2832
Joined: Tue May 16, 2006 4:41 am
Contact:

Post by KS-Soft Europe »

What exact test method do you use? "Shell Script"? "Execute External program"? If you do use ""Shell Script" test method, the script should suit some requirements:
http://www.ks-soft.net/hostmon.eng/mfra ... m#chkShell
-------------------------------------------------------------
The script or external program must write to stdout (standard output stream) single result string. This string should contain 3 parts separated by colon (:).

1. First obligatory part - marker "scriptres" tells to HostMonitor or RMA that this string is the result string.

2. Second obligatory part represents the test status, it can take one of the following values (case insensitive):
Status string - Comment
Host is alive - status means " script executed successfully, target system correctly responds"
No answer - script executed successfully, target system does not respond
Unknown - status means "test cannot be performed for some reason"
Unknown host - use this status when script cannot resolve target host name into IP address
Ok - script executed, result satisfies (some) requirements
Bad - script executed, result does not satisfy (some) requirements
Bad contents - use this status if script found some error in monitored file, web page, etc

3. Third optional part contains Reply value, HostMonitor displays this value in Reply field, writes to log files, uses to displays charts (Log Analyzer), etc. If you want Log Analyzer to process Reply values correctly and display charts, use one of the following formats for Reply value:
* decimal_number (like "123", "0", "6456.45". as decimal separator use symbol that is specified on your system, usually a dot (.) or a comma (,))
* decimal_number + space + "Kb" (like "512 Kb", "64 Kb")
* decimal_number + space + "Mb" (like "1024 Mb", "5 Mb")
* decimal_number + space + "Gb" (like "12 Gb", "4 Gb")
* decimal_number + space + "%" (like "50 %", "99 %")
* decimal_number + space + "ms" (like "100 ms", "5400 ms")
-------------------------------------------------------------

Regards,
Max
mp1
Posts: 199
Joined: Tue Mar 07, 2006 3:24 am

Post by mp1 »

Hi Max,

Thanks for the quick reply.

I use the shell script method and tried now this:

#!/bin/sh
curl -L -k -s --basic -u root:xxxx https://xxxx | lynx -force_html --dump /dev/stdin | grep "current-connections" | sed -e s/"^[ \t]*"//g | cut -f3- -d" " | sed -e s/"[ ]*"//g | tr "\n" ";"
echo 'scriptres:Ok:200'
fi

Got the same error again?

Thanks,

Martin
mp1
Posts: 199
Joined: Tue Mar 07, 2006 3:24 am

Post by mp1 »

ok, just found the problem, although I have no parameters, you need as "Start cmd" %script% %params%

I don't added %params% befor

Thanks,

Martin
KS-Soft Europe
Posts: 2832
Joined: Tue May 16, 2006 4:41 am
Contact:

Post by KS-Soft Europe »

Could you provide more information, please:
- What Linux do you use?
- What version of RMA do you use?
- Is this RMA able to perform any other shell scrips?

Regards,
Max
KS-Soft Europe
Posts: 2832
Joined: Tue May 16, 2006 4:41 am
Contact:

Post by KS-Soft Europe »

mp1 wrote:ok, just found the problem, although I have no parameters, you need as "Start cmd" %script% %params%

I don't added %params% befor
Glad to hear that. Thank you for your feedback. For the linux scripts you may use following cmd line:
/bin/sh -c "%Script% %Params%"

Regards,
Max
mp1
Posts: 199
Joined: Tue Mar 07, 2006 3:24 am

Post by mp1 »

just one quick question, now I get the value back, but with "Error: Inavalid result§

How can I fix this?

The result will look like this:

7;5;5;7;


Thanks,

Martin
KS-Soft Europe
Posts: 2832
Joined: Tue May 16, 2006 4:41 am
Contact:

Post by KS-Soft Europe »

"Invalid result" error means your script does suit requirements. You have to use "ScriptRes" statement, Status statement and then your result as Reply to make it work properly.

When you open "Script Manager", you will find several useful scripts you may use as an example: http://www.ks-soft.net/hostmon.eng/mfra ... m#shellmng

Regards,
Max
mp1
Posts: 199
Joined: Tue Mar 07, 2006 3:24 am

Post by mp1 »

ok, thanks it's working now
Post Reply