Exec script from server

Remote Monitoring Agent for Linux, FreeBSD, and other UNIX-like platforms.
Post Reply
User avatar
Pomodoro
Posts: 16
Joined: Thu Aug 31, 2006 2:25 pm

Exec script from server

Post 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
KS-Soft Europe
Posts: 2832
Joined: Tue May 16, 2006 4:41 am
Contact:

Post by KS-Soft Europe »

You may use Shell Script method.
http://www.ks-soft.net/hostmon.eng/mfra ... m#chkShell

Regards,
Max
User avatar
Pomodoro
Posts: 16
Joined: Thu Aug 31, 2006 2:25 pm

Post 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?
KS-Soft Europe
Posts: 2832
Joined: Tue May 16, 2006 4:41 am
Contact:

Post 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
User avatar
Pomodoro
Posts: 16
Joined: Thu Aug 31, 2006 2:25 pm

Post 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)
KS-Soft Europe
Posts: 2832
Joined: Tue May 16, 2006 4:41 am
Contact:

Post 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
User avatar
Pomodoro
Posts: 16
Joined: Thu Aug 31, 2006 2:25 pm

Post by Pomodoro »

A little durty script that i put on HM are

#/bin/sh
COMMAND=$1
CHECK_COMMAND=`$1`
echo $CHECK_COMMAND


it works :-)
KS-Soft
Posts: 12887
Joined: Wed Apr 03, 2002 6:00 pm
Location: USA
Contact:

Post by KS-Soft »

Actually you may keep "Script" field empty and use just "Start cmd" property of the script profile

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

Post 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
User avatar
Pomodoro
Posts: 16
Joined: Thu Aug 31, 2006 2:25 pm

Post by Pomodoro »

thaks!! all it works

8) 8) 8) 8) 8) 8) 8)
Post Reply