[hobbit] Alert if a list of devices that are not related are all down?
Brand, Thomas R.
TRBrand at cvs.com
Tue Oct 6 22:38:44 CEST 2009
If you need to convert 'seconds since Jan 1, 1970' format to another format, and have GNU date command available, you can use '@seconds' with the '-d' flag:
Using SuSE Linux 10.1:
# date -d "jan 23 2008 14:32:05" +%s
1201116725
# date -d "@1201116725"
Wed Jan 23 14:32:05 EST 2008
Using MacOS X:
date -r 1201116725
Wed Jan 23 14:32:05 EST 2008
> -----Original Message-----
> From: d.tom.schmitt at L-3com.com [mailto:d.tom.schmitt at L-3com.com]
> Sent: Tuesday, October 06, 2009 11:39 AM
> To: hobbit at hswn.dk
> Subject: RE: [hobbit] Alert if a list of devices that are not related are
> all down?
>
> Thanks Bruce I've got the data.
> Is the time in seconds since Jan 1, 1970 or some other calculation?
> Is there a utility with Xymon to convert it to date and time?
>
> There are three entries in the file for each device on the page=PW: part
> of /tmp/PW file
> Printer070|green|0
> Printer070|green|0
> Printer070|green|1254781165
>
> Printer087|green|0
> Printer087|green|0
> Printer087|green|1254781165
>
> Here is the command I used:
> /home/xymon/server/bin/bb 127.0.0.1 "hobbitdboard page=PW
> color=red,green,lastchange fields=hostname,color,lastchange" >/tmp/PW
>
>
> P.S. Is there a location with all the fields you can request?
>
> Thanks
> Tom Schmitt
> (801) 594-3030 work
>
>
> -----Original Message-----
> From: White, Bruce [mailto:bewhite at fellowes.com]
> Sent: Monday, October 05, 2009 5:02 PM
> To: hobbit at hswn.dk
> Subject: RE: [hobbit] Alert if a list of devices that are not related are
> all down?
>
> BB = the path to your hobbit binaries + the bb binary itself. (i.e.
> /hobbit/server/bin/bb).
>
> BBDISP = the IP address or name (if you have dns running) of your
> BBDISPLAY server. If everything is on the same machine, you can use the
> loopback address.
>
> .....Bruce
>
>
>
>
> Bruce White
> Senior Enterprise Systems Engineer | Phone: 630-671-5169 | Fax: 630-893-
> 1648 | bewhite at fellowes.com | http://www.fellowes.com/
>
>
>
> Disclaimer: The information contained in this message may be privileged
> and confidential and protected from disclosure. If the reader of this
> message is not the intended recipient or an employee or agent responsible
> for delivering this message to the intended recipient, you are hereby
> notified that any dissemination, distribution or copying of this
> communication is strictly prohibited. If you have received this
> communication in error, please notify us immediately by replying to the
> message and deleting it from your computer. Thank you. Fellowes, Inc.
>
> -----Original Message-----
> From: d.tom.schmitt at L-3com.com [mailto:d.tom.schmitt at L-3com.com]
> Sent: Monday, October 05, 2009 5:37 PM
> To: hobbit at hswn.dk
> Subject: RE: [hobbit] Alert if a list of devices that are not related are
> all down?
>
> I created the page with all the printers on it.
>
> #----------------------------------------------------------------------
> # PowerWatch - Watch multiple printers per building
> # Requires some scripting see Email archive 5Oct2009
> #----------------------------------------------------------------------
> page PW <h4>Power Watch</h4>
> group-compress <h4>Building E&F</h4>
> 128.170.70.7 Printer007
> 128.170.70.151 Printer151
> 128.170.70.14 Printer014
> 128.170.70.4 Printer004
> 128.170.70.33 Printer033
> 128.170.70.142 Printer142
> 128.170.70.156 Printer156
> group-compress <h4>Building C</h4>
> 128.170.70.10 Printer010
> 128.170.70.170 Printer170
> 128.170.70.97 Printer097
> group-compress <h4>Building D</h4>
> 128.170.70.126 Printer126
> 128.170.70.38 Printer038
> 128.170.70.70 Printer070
> 128.170.70.87 Printer087
> 128.170.70.116 Printer116
> group-compress <h4>Building R</h4>
> 128.170.70.227 Printer227
> 128.170.70.228 Printer228
>
> I tried the command but there was no output. I tried it with and without
> 'lastchange'.
>
> What are BB and BBDISP set to.
> When I echo them they are empty.
>
> $BB $BBDISP "hobbitdboard page=PW color=red,green
> fields=hostname,color,lastchange"
> -bash: hobbitdboard page=PW color=red,green
> fields=hostname,color,lastchange: command not found
>
> [root at monitor1 ~]# su - xymon
> [xymon at monitor1 ~]$ echo $BB
>
> [xymon at monitor1 ~]$ echo $BBDISP
>
> [xymon at monitor1 ~]$
>
> Thanks
> Tom
>
> -----Original Message-----
> From: Henrik "Størner [mailto:henrik at hswn.dk]
> Sent: Monday, October 05, 2009 3:28 PM
> To: hobbit at hswn.dk
> Subject: Re: [hobbit] Alert if a list of devices that are not related are
> all down?
>
> In <2B2CEF0E4EE10B449E5D9BB95E6DA0E8FD11A0 at MAIL2.csw.l-3com.com>
> d.tom.schmitt at L-3com.com writes:
>
> >I would like to have XYMON:
> > E.G. All printers are down at the same time - ALERT
> > All printers just came back up at the same time -
> NOTIFY/ALERT
>
> >I need to watch multiple printers in a building to see if they are ALL
> >down (or come up) at the same time.
>
> >This is the makings of a POWER OUTAGE EVENT for that building since the
> >printers are not attached to a UPS.
>
> >If all down, Possible Power Outage
>
> Assuming you have some way of easily identifying your printers
> - e.g. they are all on the same webpage in the Xymon display, or
> they have some sort of standard name - then you can use the
> 'hobbitdboard' command to check the status of all of them at
> once.
>
> E.g. if you have all the printers on a page called "printers",
> then this would tell you if they were all down:
>
> #!/bin/sh
>
> # Grab "conn" status of all systems on "printers" page
> # Only pick the red and green ones, so we ignore those that
> # have been disabled.
> $BB $BBDISP "hobbitdboard page=printers color=red,green test=conn
> fields=hostname,color" >/tmp/printstatus.$$
> PRINTERCOUNT=`wc -l /tmp/printstatus.$$`
> DOWNCOUNT=`grep '^|red$' /tmp/printstatus.$$ | wc -l`
>
> if test $PRINTERCOUNT = $DOWNCOUNT
> then
> echo "All printers down!"
> fi
>
> What I would do is feed the information from this script back into
> Xymon as a new status - one that shows red if all printers are down,
> and green if at least one of them is up. Then you can trigger the
> alert from this status, instead of mucking about with the alert
> scripts for each of the printers. So you could modify the script
> above to become a Xymon server-side extension:
>
> #!/bin/sh
>
> # ... beginning is the same ...
>
> if test $PRINTERCOUNT = $DOWNCOUNT
> then
> # All printers are down
> $BB $BBDISP "status whitehouse.power red `date`
> Possible power-loss at 1600 Pennsylvania Av"
> else
> # At least one printer is up
> $BB $BBDISP "status whitehouse.power green `date`
> Power OK"
> fi
>
>
> And then setup an alert that goes off when the "power" status for
> host "whitehouse" goes red.
>
> You'd run the script from hobbitlaunch.cfg every so often, e.g.
> to run it every 5 minutes add
> [powercheck]
> CMD $BBHOME/ext/powercheck.sh
> INTERVAL 5m
> to hobbitlaunch.cfg
>
>
> If you must check if the change for each printer happened "recently"
> (e.g. within the past 5 minutes which is the default network test
> frequency), then you can add "lastchange" to the list of the fields
> retrieved in the hobbitdboard command. That will give you the Unix
> timestamp when the status last changed; you can then have the script
> compare that to the current timestamp and do whatever appropriate if
> the change happened more or less recently. (The GNU 'date' utility
> can give you the current timestamp with "date +%s").
>
>
> Hope this gives you some inspiration to put this together.
>
>
> Regards,
> Henrik
>
> --
> Henrik Storner
>
> To unsubscribe from the hobbit list, send an e-mail to
> hobbit-unsubscribe at hswn.dk
>
>
>
> No virus found in this incoming message.
> Checked by AVG - www.avg.com
> Version: 8.5.420 / Virus Database: 270.14.3/2414 - Release Date: 10/05/09
> 06:19:00
>
> To unsubscribe from the hobbit list, send an e-mail to
> hobbit-unsubscribe at hswn.dk
>
>
>
> To unsubscribe from the hobbit list, send an e-mail to
> hobbit-unsubscribe at hswn.dk
>
>
> No virus found in this incoming message.
> Checked by AVG - www.avg.com
> Version: 8.5.420 / Virus Database: 270.14.4/2416 - Release Date: 10/05/09
> 18:23:00
More information about the Xymon
mailing list