echo "\{ \$RealState := \"${result}\", \$addr := \"$1\" } "Did not seem to do it __________________________________________________________ Andrey Gordon | Integrity Interactive | Network Engineer | +1.781.398.3518 > From: "William W. Fisher" <[EMAIL PROTECTED]> > Reply-To: InterMapper Discussion <[email protected]> > Date: Fri, 12 Sep 2008 10:13:16 -0400 > To: InterMapper Discussion <[email protected]> > Subject: Re: [IM-Talk] CLI probes | String pass back` > > 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 what¹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] > ____________________________________________________________________ List archives: http://www.mail-archive.com/intermapper-talk%40list.dartware.com/ To unsubscribe: send email to: [EMAIL PROTECTED]
