[xymon] alert on proc while both hosts running the same process at the same time

Vernon Everett everett.vernon at gmail.com
Tue Jul 13 05:52:49 CEST 2010


You can do it all server side.

Try something like this. (Pseudo-code - alter to taste)

COLOUR=red
RUNNINGON=""
PROCNAME=clusterprocess
RUNNING=1 #Assume it isn't running
for CLUSTERHOST in host1 host2 host3        # Add all cluster hosts here.
do
    wget -o /dev/null
http://hobbit/hobbit-cgi/bb-hostsvc.sh\?HOST\=$CLUSTERHOST\&SERVICE\=proc
| grep $PROCNAME
   CHECK=$?
   ((RUNNING=RUNNING*CHECK))                # If it's running anywhere
then $RUNNING=0
   [ $CHECK -eq 0 ] && RUNNINGON="$CLUSTERHOST $RUNNINGON"  # So we
know where it's running
done
[ $RUNNING -eq 0 ] && COLOUR=green
[ $(echo $RUNNINGON | wc -w) -gt 1 ] && COLOUR=yellow # Running on
more than one host. Might be an issue.

$BB $BBDISP "status $MACHINE.cluster $COLOUR $(date;echo;echo
$PROCNAME running on host $RUNNINGON"

Cheers
      Vernon




On Tue, Jul 13, 2010 at 9:14 AM, Patrick Nixon <pnixon at gmail.com> wrote:
> Honestly, you can write a ext script in a few lines that will do this
> and you won't have to guess what's going on.
>
> clientlog will pull the procs section and you can grep it for the
> relevant process name and do your logic there.
>
> On Mon, Jul 12, 2010 at 8:01 PM, Cleaver, Japheth <jcleaver at soe.sony.com> wrote:
>>> -----Original Message-----
>>> From: Asif Iqbal [mailto:vadud3 at gmail.com]
>>> Sent: Monday, July 12, 2010 4:33 PM
>>> To: xymon at xymon.com
>>> Subject: [xymon] alert on proc while both hosts running the same process at the same time
>>>
>>> HOST=%host1|host2
>>>   PROC  myproc ?? ??
>>>
>>> How do I setup using PROC or may be some other method to alert when a process
>>> myproc is running either on both server or on no server?
>>>
>>> only one myproc is suppose to run on only one of the two hosts, host1 or host2
>>> if myproc does not run on either of the hosts that should alert too.
>>>
>>>
>>> so here is the condition
>>>
>>> total number of myproc process on the hosts. each row is reprensenting a time
>>>
>>>           host1            host2
>>>           --------            --------
>>> time1     0                   0
>>> time2     0                   1
>>> time3     1                   0
>>> time4     1                   1
>>>
>>> alert during time1 and time4
>>>
>>> Is it possible to achieve this using stock hobbit? The other option
>>> would be writing a server side script.
>>>
>>> --
>>> Asif Iqbal
>>
>>
>> You could try bbcombotest here, but you'd have to dedicate all of your proc monitoring status to this. And you'd want to disable alerting on the individual tests and then define a new bbcombotest to alert on.
>>
>> A XOR would almost give you what you want, but it doesn't seem to be available according to bbcombotest.cfg in 4.3.0-beta2. You can do arithmetic on the Boolean values though, which makes it easy to ensure 1 and only 1 is green at once.
>>
>> Overall.clustertest = (host1.proc + host2.proc) == 1
>>
>> If you wanted this proc test to be only one of many procs you're testing on these hosts, you'll probably need to write something server-side for it. This is better for tests that don't have multiple things that can cause a status change.
>>
>> HTH,
>>
>> -jc
>>
>> Side note: XOR and NOT support in bbcombotest would be awesome
>>
>>
>
> To unsubscribe from the xymon list, send an e-mail to
> xymon-unsubscribe at xymon.dk
>
>
>



More information about the Xymon mailing list