Page 1 of 1
Exec script from server
Posted: Tue Sep 12, 2006 3:37 am
by Pomodoro
Hi all
I have a server script where rma run
like
/home/script/mycustomcheck.sh
it return a OK if chesk work or KO if checK fault
How can i use that test thought HS and RMA?
thanks a lot
Posted: Tue Sep 12, 2006 4:06 am
by KS-Soft Europe
Posted: Tue Sep 12, 2006 4:09 am
by Pomodoro
I know
but in script method
the code are on HM server
i need that the code must remain on client side (where rma run)
I need to do a custom script that launch a server script?
Posted: Tue Sep 12, 2006 4:36 am
by KS-Soft Europe
Pomodoro wrote:the code are on HM server
i need that the code must remain on client side (where rma run)
But you may select certain RMA in "Test by" property and test will be performed by RMA on machine, where RMA is running.
Pomodoro wrote:I need to do a custom script that launch a server script?
Could you provide more information. I could not understand the problem. If you want to execute script on the server, where RMA is running, you just should create Schell Script test, create script in Script manager and select that RMA in Test By dropdown using Test Properties window. Of course, also you may create wrapper, that would execute particular sh script , located on server.
Regards,
Max
Posted: Tue Sep 12, 2006 4:45 am
by Pomodoro
My customer check his application by run his /home/script/mychecj.sh
i can't put that script on HM schell scripting becase
it can change every day by customer
so i need capability to run script that are on server
(where rma run) and not on HM server
kind regards (sorry 4 my terrible english)
Posted: Tue Sep 12, 2006 5:11 am
by KS-Soft Europe
So, you should do the folowing:
1. Invoke script manager, and create script, that executes /home/script/mychecj.sh, parses output and according to output (OK or KO), returns value to HostMonitor. See. Requirements to the script section (
http://www.ks-soft.net/hostmon.eng/mfra ... m#shellmng)
2. Create new Schell Script test using foregoing script and select appropriate RM agent in "Test By" dropdown.
Thats all.
Regards,
Max
Posted: Tue Sep 12, 2006 5:57 am
by Pomodoro
A little durty script that i put on HM are
#/bin/sh
COMMAND=$1
CHECK_COMMAND=`$1`
echo $CHECK_COMMAND
it works

Posted: Tue Sep 12, 2006 6:09 am
by KS-Soft
Actually you may keep "Script" field empty and use just "Start cmd" property of the script profile
Regards
Alex
Posted: Tue Sep 12, 2006 6:10 am
by KS-Soft Europe
Glad to hear it.
Quote from manual:
The following rules must be obeyed when creating a script:
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")
Several examples:
String printed by script "Status" of the test "Reply" field of the test
scriptres:Host is alive:1000 ms Host is alive 1000 ms
scriptres:Unknown host: Unknown host
scriptres:Ok:300 Kb Ok 300 Kb
scriptres:Bad:90 % Bad 90 %
That's it. Everything else is entirely up to you
Please, take a look on examples in Script Manager.
Regards,
Max
Posted: Tue Sep 12, 2006 9:19 am
by Pomodoro