Well in my testing the result of the command execution gets assigned to the $result variable which will be just the word "Running". If I echo that variable with in the script out I can see that the content of $result is there and IS "Running". So I want to pass that result back into the probe for future manipulation.
/bin/sh is actually /bin/bash in my case

Basically at the end I want to be able to pass the content of that variable back into the probe along with the reason for the content. In other words the script will be able to detect even when the host is down and obviously wmi is not available for query, so just stdout won't be enough. Like I said, the content of $result is there, but does not get passed back in, but changing it to $2 will actually pass in the argument from the calling cli
I'll try ${result} when I get to my computer.

----------------------------
Sent from my iPhone

On Sep 12, 2008, at 10:13 AM, "William W. Fisher" <[EMAIL PROTECTED] > wrote:

Andrey Gordon wrote:
I¹m trying to finish my crusade in monitoring windows services so I wrote up
the CLI probe that calls the following script (it¹s a draft):
#!/bin/sh
# Expects wmi-service.sh ${ADDRESS} ${Service Name} ${State} $ {Domain}
${Username} ${Password}
result=`wmic -U $4/$5%$6 //$1 "Select Name,State from Win32_Service where
name='$2'" | awk -F\| -v msx=$2 '$0 ~ msx {print $2}'`
echo "\{ \$RealState := \"$result\", \$addr := \"$1\" } "
For some reason, the result variable does not get passed back into the probe. If I take out the first \ in the echo I can actually see wh at¹s being
passed back into the probe
Reason: { $RealState := "", $addr := "10.1.0.16" }

What is the value of $result at the end of the script? There could be two possibilities: either the value of $result is "" or you might need to use the full syntax for the shell variable "${result}" for your version of /bin/sh? Is there any difference if you run under / bin/bash?

Here's another tip. In 5.0.3 and later you can use the ${^stdout} variable in your command-display section. This inserts the stdout of your command-line probe into the status window.

<command-display>
...

${^stdout}
</command-display>

After you echo the first line, echo more debug information from the script to double-check the values.

Bill Fisher
Dartware, LLC
____________________________________________________________________
List archives:
http://www.mail-archive.com/intermapper-talk%40list.dartware.com/
To unsubscribe: send email to: [EMAIL PROTECTED]

Reply via email to