[Xymon] Xymon Digest, Vol 31, Issue 27

Steff Watkins s.watkins at nhm.ac.uk
Mon Sep 2 12:43:57 CEST 2013


> -----Original Message-----
> Message: 3
> Date: Fri, 30 Aug 2013 11:09:33 -0600
> From: Shawn Heisey <hobbit at elyograg.org>
> To: xymon at xymon.com
> Subject: [Xymon] Two hosts, monitor a service that should be running
> 	on only one of them
> Message-ID: <5220D1CD.7000200 at elyograg.org>
> Content-Type: text/plain; charset=ISO-8859-1; format=flowed
> 
> I have a pair of machines running BBWin in central mode.  Is there any way in
> analysis.cfg to indicate that a particular service exists on both of them but
> should only be running on one of them?  If that service is running on both
> servers or neither server, I want to see a red alarm.
> 
> Thanks,
> Shawn

Hello Shawn,

 I have pretty much the same requirement for a couple of the hosts I look after (backup client on distributed disk setup). I haven't implemented my solution in analysis.cfg so this may not be of any use to you. As my central BHX[1] server is a linux box I just run a script that looks in the $XYMSRV/data/logs directory for the <hostname>.procs files of the systems involved.  Again, if you're not using a linux/unix central server this may not apply.

The routine looks in the $XYMSRV/data/logs/ directory for the <hostname>.procs files of the systems involved. The logfiles are plain text so it scans through the first of the logfiles looking for the process name. If the script finds the process listed, the script scores two (add two to a $TEMPVAR). If it doesn't find a match, then nothing is scored. The script does this again for the second system this time score ONE if it gets a match, zero if there is no match.

Now working out the service status is easy. If the score is either one or two then everything is "Green, OK". However if the score if either 3 or zero then "Panic!, Red".

(Actually, this is a bit of a fib as my version of the script checks for the exclusivity of two separate processes on each system. Both processes have to be running on the same system, but only one system at a time.  So I use the scores 1000, 100, 10 and 1 then check for scores of 1100 or 11 for success).

The rest of the script composes the output page and then sends it through bin/bb to the server process.

To make sure it all fits nicely together the script is defined in tasks.cfg so it is run by the xymon daemon and  generates its own column on the webpages. 

I should imagine that you could do something similar with wsh if you're $XYMSRV is a windows box although the data directory location may be different.

Good luck with getting it working,
Steff

[1] BHX - B(ig brother)/H(_bbit)/X(ymon)

-----
Steff Watkins			Natural History Museum, Cromwell Road, London,SW75BD 
Systems programmer		Email: s.watkins at nhm.ac.uk 
Infrastructure Team		Phone: +44 (0)20 7942 6000 opt 2
 ======== 
"Many were increasingly of the opinion that they'd all made a big mistake in coming down from the trees in the first place. And some said that even the trees had been a bad move, and that no one should ever have left the oceans." - HHGTTG





More information about the Xymon mailing list