I guess what I was getting at is that it seems like there is a type
mismatch, so it compares them as a string or something.
I carried out the calculations into the script instead and am just returning
the error codes.
I sent the finished probe to Dartware for posting, so whoever needs it, be
my guest :)
__________________________________________________________
Andrey Gordon | Integrity Interactive | Network Engineer | +1.781.398.3518



> From: Jakob Peterhänsel <[EMAIL PROTECTED]>
> Reply-To: InterMapper Discussion <[email protected]>
> Date: Tue, 7 Oct 2008 23:31:35 +0200
> To: InterMapper Discussion <[email protected]>
> Subject: Re: [IM-Talk] Manipulation of values returned by a CLI probe
> 
> Hi Andrey,
> 
> I can't remember with commandline & TCP probes, but you can with SMTP
> probes.
> 
> In SMTP probes you can do calculations. The important bit there, is
> that the lines are evaluated top-down, so you need to be careful in
> what order the calculations are done.
> 
> 
>      Jakob Peterhänsel
> 
> "Be a part of the Love Generation - carry a smile, not a gun."
> - JP, May 2006
> 
> Email:     [EMAIL PROTECTED]
> AIM:         Marook
> Phone:     +45 30787715
> 
> On 07/10/2008, at 21:25, Andrey Gordon wrote:
> 
>> I have a question. Can I return, say, an integer and compare it to a
>> parameter in a probe?
>> 
>> <parameters>
>>        "Domain"        =       ""
>>        "Username"      =       "Administrator"
>>        "Password*"     =       ""
>>        "Alarm Size"    =       2000
>>        "Warning Size"  =       90
>> </parameters>
>> 
>> <command-line>
>> path = ""
>> cmd = "wmi-queue.sh ${ADDRESS} ${Username} ${Password*} ${Domain}"
>> </command-line>
>> 
>> <command-exit>
>> down: ${EXIT_CODE} = 2
>> alarm: ${EXIT_CODE} = 1
>> alarm: $queue > ${Alarm Size} "The queue is too big"
>> warning: $queue > ${Warning Size} "The queue is big"
>> okay: ${EXIT_CODE} = 0
>> </command-exit>
>> 
>> <command-display>
>> \b5\Service Status\0p\
>>  \4\Service:\0\   The queue on ${addr} is $queue (${chartable: ##### :
>> $queue})
>> </command-display>
>> 
>> The script follows:
>> 
>> pingprog=/bin/ping
>> awkprog=/usr/bin/awk
>> wmicprog=/usr/bin/wmic
>> 
>> reachable=`$pingprog -c 1 $1 | $awkprog '/64 bytes from/ {print
>> $1,$2,$3}'`
>> if [ ! "$reachable" == "64 bytes from" ]
>> then
>>        echo "\{ \$addr := \"$1\" } Host unreachable. Ping failed."
>>        exit 2
>> fi
>> if [ "$4" == "" ]
>> then
>> result=`$wmicprog -U $2%$3 //$1 "Select RemoteQueueLength from
>> Win32_PerfFormattedData_SMTPSVC_SMTPServer" | $awkprog -F\| '$0 ~
>> "_Total"
>> {print $2}'`
>> else
>> result=`$wmicprog -U $4/$2%$3 //$1 "Select RemoteQueueLength from
>> Win32_PerfFormattedData_SMTPSVC_SMTPServer" | $awkprog -F\| '$0 ~
>> "_Total"
>> {print $2}'`
>> fi
>> 
>> if [ "$result" == "" ]
>> then
>>        echo "\{ \$addr := \"$1\" } Query returned an error"
>>        exit 1
>> fi
>> 
>> echo "\{ \$queue := \"$result\" , \$addr := \"$1\" } All Good"
>> 
>> 
>> Here is the status window (it¹s in Œgreen¹ state even though the
>> queue count
>> is over warning)
>> 
>> Device Status
>>       Name: as4
>>   DNS Name: as4.i2c.com.
>>  WINS Name: AS4
>>    Address: 192.168.17.104
>>     Status: UP
>>      Probe: CLI WMI
>>    Up Time: n/a
>>  Availability:            100 % (of 17 minutes, 18 seconds)
>>  Packet Loss:             0.0 % (of 0 total attempts)
>>  Short-term Packet Loss:  0.0 % (of 0 last attempts) [Reset]
>>  Recent Loss:  None
>>  Response time:  669 msec
>> 
>>  Retention Policy: 15day6mo1yr5yr (1), Exportable
>> 
>> Service Status
>>  Service:   The queue on 192.168.17.104 is 100 (100)
>> Last updated Oct 07, 15:23:04; interval: 30 seconds
>> Reason:  All Good
>> 
>> 
>> __________________________________________________________
>> Andrey Gordon | Integrity Interactive | Network Engineer |
>> +1.781.398.3518
>> 
>> 
>> ____________________________________________________________________
>> 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]
> 

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

Reply via email to