Alert if a list of devices that are not related are all down?
list Tom Schmitt
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
I know that the 'route:' can watch a path to a device and make the
devices behind the down devices go YELLOW
and the first device in the path go RED. I don't think that this would
work for this type of alerting.
I think this will require some sort of SCRIPT in the hobbit-alerts.cfg
that is executed if any of the printers do not answer a ping.
I have never written a SCRIPT for XYMON but am eager to learn.
In this case the first printer that goes down, calls the script and the
script would have to check if all the other printers are down.
If I have a printer go down and it calls a bash shell script, is there a
way to see if all the rest of the printers are down.
If not, do not alert
If all down, alert
I would also need to go the other way: if a printer comes up
(RECOVERED) are all the other printers up?
This one is more tricky as you have to see when all the other printers
came up.
It would be a false alarm if a single printer went down and then came
back up because you cannot just check to see if all the other printers
are up.
EXAMPLE: The rest of the printers may have been up and that would not
be a POSSIBLE POWER EVENT. You must be able to see when the other
printers came up last.
The other alternative would be to use my scripts (running on the XYMON
server) to watch the printers and then allow the scripts to trigger a
RED/GREEN event.
I have read where this can be done, but I have not found a good clear
example of creating diamonds and icons for special purposes.
This RED/GREEN event would then trigger the alerting from XYMON.
Again, I have not found a good HOW-TO on setting up additional
devices/diamonds for this purpose.
Thanks,
Tom Schmitt
Senior IT Staff - R&D
L-3 Communication Systems West
640 North 2200 West
P.O. Box 16850
Salt Lake City, UT XXXXX
Phone (XXX) XXX-XXXX
Cell (XXX) XXX-XXXX
eFax (XXX) XXX-XXXX
user-9c1ae820b621@xymon.invalid
I can explain it for you, but I can't understand it for you.
Anonymous
Think Green! Please print only what is necessary!
Attachments (1)
list Henrik Størner
▸
In <user-67705af2b19d@xymon.invalid> user-9c1ae820b621@xymon.invalid 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/ALERTI 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
list Tom Schmitt
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:user-ce4a2c883f75@xymon.invalid]
Sent: Monday, October 05, 2009 3:28 PM
To: user-ae9b8668bcde@xymon.invalid
Subject: Re: [hobbit] Alert if a list of devices that are not related are all down?
In <user-67705af2b19d@xymon.invalid> user-9c1ae820b621@xymon.invalid 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/ALERTI 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
list Bruce White
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: XXX-XXX-XXXX | Fax: XXX-XXX-XXXX | user-58f975e8bf9d@xymon.invalid | 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: user-9c1ae820b621@xymon.invalid [mailto:user-9c1ae820b621@xymon.invalid]
Sent: Monday, October 05, 2009 5:37 PM
To: user-ae9b8668bcde@xymon.invalid
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:user-ce4a2c883f75@xymon.invalid]
Sent: Monday, October 05, 2009 3:28 PM
To: user-ae9b8668bcde@xymon.invalid
Subject: Re: [hobbit] Alert if a list of devices that are not related are all down?
In <user-67705af2b19d@xymon.invalid> user-9c1ae820b621@xymon.invalid 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/ALERTI 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
list Henrik Størner
▸
In <user-d07bf011a4b7@xymon.invalid> user-9c1ae820b621@xymon.invalid writes:
I created the page with all the printers on it.
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.
They're set by hobbitlaunch when it runs the script. For testing, set them by running the "bbcmd" utility - this gives you a new sub-shell with all of the Xymon environment setup. BB is <where-you-installed-xymon>/server/bin/bb BBDISP is the IP of your Xymon server Regards, Henrik
list Tom Schmitt
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 (XXX) XXX-XXXX work
▸
-----Original Message----- From: White, Bruce [mailto:user-58f975e8bf9d@xymon.invalid] Sent: Monday, October 05, 2009 5:02 PM To: user-ae9b8668bcde@xymon.invalid 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: XXX-XXX-XXXX | Fax: XXX-XXX-XXXX | user-58f975e8bf9d@xymon.invalid | 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: user-9c1ae820b621@xymon.invalid [mailto:user-9c1ae820b621@xymon.invalid] Sent: Monday, October 05, 2009 5:37 PM To: user-ae9b8668bcde@xymon.invalid 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:user-ce4a2c883f75@xymon.invalid] Sent: Monday, October 05, 2009 3:28 PM To: user-ae9b8668bcde@xymon.invalid Subject: Re: [hobbit] Alert if a list of devices that are not related are all down? In <user-67705af2b19d@xymon.invalid> user-9c1ae820b621@xymon.invalid 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/ALERTI 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
list Henrik Størner
Den Tue, 06 Oct 2009 09:38:33 -0600 skrev d.tom.schmitt:
▸
Thanks Bruce I've got the data. Is the time in seconds since Jan 1, 1970 or some other calculation?
Seconds since Jan 1st 1970 00:00 UTC.
Is there a utility with Xymon to convert it to date and time?
No, but if you only want to use it to check how long ago something happened, then you don't need to convert it to human-readable form. Just compare it against the value from "date +%s". I have a simple C program that will do the conversion, I think it is trivial to do in Perl as well (not a Perl person myself, though).
▸
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 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
You didn't specify "test=conn" in that command, so you're getting the result from the "conn" status as well as the "trends" and "info" columns (you can see that if you add "testname" in the fields-list).
P.S. Is there a location with all the fields you can request?
See the bb(1) man-page. Regards, Henrik
list Thomas R. Brand
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: user-9c1ae820b621@xymon.invalid [mailto:user-9c1ae820b621@xymon.invalid]
Sent: Tuesday, October 06, 2009 11:39 AM
To: user-ae9b8668bcde@xymon.invalid
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
(XXX) XXX-XXXX work
-----Original Message-----
From: White, Bruce [mailto:user-58f975e8bf9d@xymon.invalid]
Sent: Monday, October 05, 2009 5:02 PM
To: user-ae9b8668bcde@xymon.invalid
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 WhiteSenior Enterprise Systems Engineer | Phone: XXX-XXX-XXXX | Fax: XXX-XXX- 1648 | user-58f975e8bf9d@xymon.invalid | 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: user-9c1ae820b621@xymon.invalid [mailto:user-9c1ae820b621@xymon.invalid] Sent: Monday, October 05, 2009 5:37 PM To: user-ae9b8668bcde@xymon.invalid 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:user-ce4a2c883f75@xymon.invalid] Sent: Monday, October 05, 2009 3:28 PM To: user-ae9b8668bcde@xymon.invalid Subject: Re: [hobbit] Alert if a list of devices that are not related are all down? In <user-67705af2b19d@xymon.invalid> user-9c1ae820b621@xymon.invalid 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/ALERTI 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 OutageAssuming 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
06:19:00
18:23:00