Alert script "BBCOLORLEVEL" is red when recovered
list Jeremy Laidman
Hi I'm running Xymon v4.3.3. I'm using an alert script to create log entries for a corporate alarming system to monitor. When a test fails in a red status, my script gets: RECOVERED=0, BBCOLORLEVEL=red and BBALPHAMSG="red bla bla bla" When the test goes green again, it gets: RECOVERED=1, BBCOLORLEVEL=red and BBALPHAMSG="green bla bla bla" The BBCOLORLEVEL is "red" in both messages even though for the second the state had returned to green. The "alerts" doco/manpage says that BBCOLORLEVEL is "the current color of the status". But it seems to show the color of the status when it first entered the failure status. Is this a bug, or is the doco wrong, or am I mis-reading the doco? A related question: Some tests include a URL in the BBALPHAMSG text (saying "See http://.../") but other tests don't. I can't work out which tests do and which don't. Is there a pattern to this that I'm not seeing? Can the URL be enabled for all alert messages? In all cases, the SCRIPT definition sets "FORMAT=TEXT", which should be including the URL. Here's an example: HOST=%^lxdns01[01]\d\. SERVICE=ntp DURATION>30 RECOVERED SCRIPT /usr/local/utils/xymon-scripts/xymon-logger "" FORMAT=TEXT REPEAT=1d Cheers Jeremy
list Rob McBroom
▸
On Aug 31, 2011, at 11:26 PM, Jeremy Laidman wrote:
The BBCOLORLEVEL is "red" in both messages even though for the second the state had returned to green.
I was waiting for an official answer on this, but it doesn’t look like one’s coming. I’ve noticed this too, and all I can give you is my guess: You know it’s green because it’s recovered, but this allows you to also see what it recovered from (in case you care). -- Rob McBroom <http://www.skurfer.com/>;
list Henrik Størner
▸
On 21-09-2011 20:27, Rob McBroom wrote:
On Aug 31, 2011, at 11:26 PM, Jeremy Laidman wrote:The BBCOLORLEVEL is "red" in both messages even though for the second the state had returned to green.I was waiting for an official answer on this, but it doesn’t look like one’s coming. I’ve noticed this too, and all I can give you is my guess: You know it’s green because it’s recovered, but this allows you to also see what it recovered from (in case you care).
I thought I had answered this, but maybe not. Your analysis is correct, RECOVERED tells you it is OK, and the color tells you how serious it was when there was an alert. Providing "green" as the color would be rather meaningless - it is evident from the fact that it recovered. So better to provide some additional info like how serious the problem was in the color-value. Regards, Henrik
list Kris Springer
I know this is old, but it's still an issue.? I have a script that uses $BBCOLORLEVEL that works great, except the RECOVERED messages come in as Red.? They don't say 'Recovered', they say 'Red'.? I'm not much of a coder, but is there perhaps some way to have my bash script figure out if the message is a 'recovered' message and print that as the BBCOLORLEVEL instead of printing Red? -- Kris Springer
list Jeremy Laidman
Kris I suspect $BBCOLORLEVEL is set to the color of the original condition. According to the man page for alerts.cfg, if the word &COLOR& is in the recipient parameter, it is replaced by the colour of the alert. This might give the updated colour after the alert recovered, instead of the alert colour. Or, you can use something like this: NEWCOL=`$XYMON $XYMSRV "xymondboard host=$BBHOSTNAME test=$BBSVCNAME fields=color"` Cheers Jeremy On Wed, 26 Aug 2020 at 08:38, Kris Springer <user-c2caa0a7a8d5@xymon.invalid>
▸
wrote:
I know this is old, but it's still an issue. I have a script that uses $BBCOLORLEVEL that works great, except the RECOVERED messages come in as Red. They don't say 'Recovered', they say 'Red'. I'm not much of a coder, but is there perhaps some way to have my bash script figure out if the message is a 'recovered' message and print that as the BBCOLORLEVEL instead of printing Red? -- Kris Springer
list Ralph Mitchell
Call me crazy if you like, but in the alerts.cfg file, in the list of
environment variables passed to the script, it says:
# BBCOLORLEVEL - The color of the alert: "red", "yellow" or
"purple"
... [snip] ...
# RECOVERED - Is "1" if the service has recovered.
So, um, just check $RECOVERED ??
if [ $RECOVERED -eq 1 ]; then
# send recovery email
fi
Ralph Mitchell
▸
On Tue, Aug 25, 2020 at 8:04 PM Jeremy Laidman <user-0608abae5e7c@xymon.invalid> wrote:
Kris I suspect $BBCOLORLEVEL is set to the color of the original condition. According to the man page for alerts.cfg, if the word &COLOR& is in the recipient parameter, it is replaced by the colour of the alert. This might give the updated colour after the alert recovered, instead of the alert colour. Or, you can use something like this: NEWCOL=`$XYMON $XYMSRV "xymondboard host=$BBHOSTNAME test=$BBSVCNAME fields=color"` Cheers Jeremy On Wed, 26 Aug 2020 at 08:38, Kris Springer <user-c2caa0a7a8d5@xymon.invalid> wrote:I know this is old, but it's still an issue. I have a script that uses $BBCOLORLEVEL that works great, except the RECOVERED messages come in as Red. They don't say 'Recovered', they say 'Red'. I'm not much of a coder, but is there perhaps some way to have my bash script figure out if the message is a 'recovered' message and print that as the BBCOLORLEVEL instead of printing Red? -- Kris Springer
list Kris Springer
Thanks Ralph, I got the 'Recovered' emails working now.? On to the 'Info' emails!? I've tried added an elif line to look for the word INFO in the message content, but it doesn't seem to work.? Any thoughts?? Here's the line I'm using. elif [[ $BBALPHAMSG = *INFO* ]]; then echo "Info found" Kris Springer
▸
On 8/25/20 7:32 PM, Ralph M wrote:Call me crazy if you like, but in the alerts.cfg file, in the list of environment variables passed to the script, it says: ? ? ?# ? ?BBCOLORLEVEL ?- The color of the alert: "red", "yellow" or "purple" ? ? ?... [snip] ... ? ? ?# ? ?RECOVERED ? ? - Is "1" if the service has recovered. So, um, just check $RECOVERED ?? ? ? ?if [ $RECOVERED -eq 1 ]; then
? ? ? ? ? # send recovery?email
▸
? ? ?fi
Ralph Mitchell
On Tue, Aug 25, 2020 at 8:04 PM Jeremy Laidman <user-0608abae5e7c@xymon.invalid
<mailto:user-0608abae5e7c@xymon.invalid>> wrote:
Kris
I suspect $BBCOLORLEVEL is set to the color of the original condition.
According to the man page for alerts.cfg, if the word &COLOR&?is
▸
in the recipient parameter, it is replaced by the colour of the
alert. This might give the updated colour after the alert
recovered, instead of the alert colour.
Or, you can use something like this:
NEWCOL=`$XYMON $XYMSRV "xymondboard host=$BBHOSTNAME
test=$BBSVCNAME fields=color"`
Cheers
Jeremy
On Wed, 26 Aug 2020 at 08:38, Kris Springer
<user-c2caa0a7a8d5@xymon.invalid <mailto:user-c2caa0a7a8d5@xymon.invalid>>
▸
wrote:
I know this is old, but it's still an issue.? I have a script
that uses
$BBCOLORLEVEL that works great, except the RECOVERED messages
come in as
Red.? They don't say 'Recovered', they say 'Red'.? I'm not
much of a
coder, but is there perhaps some way to have my bash script
figure out
if the message is a 'recovered' message and print that as the
BBCOLORLEVEL instead of printing Red?
--
Kris Springer
list Torsten Richter
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Hi Kris, maybe you should try elif [[ $BBALPHAMSG =~ INFO ]] and see if that works. Cheers, Torsten
▸
On 26.08.2020 17:48, Kris Springer wrote:Thanks Ralph, I got the 'Recovered' emails working now. On to the 'Info' emails! I've tried added an elif line to look for the word INFO in the message content, but it doesn't seem to work. Any thoughts? Here's the line I'm using. elif [[ $BBALPHAMSG = *INFO* ]]; then echo "Info found" Kris Springer On 8/25/20 7:32 PM, Ralph M wrote:Call me crazy if you like, but in the alerts.cfg file, in the list of environment variables passed to the script, it says: # BBCOLORLEVEL - The color of the alert: "red", "yellow" or "purple" ... [snip] ... # RECOVERED - Is "1" if the service has recovered. So, um, just check $RECOVERED ?? if [ $RECOVERED -eq 1 ]; then # send recovery email fi Ralph Mitchell On Tue, Aug 25, 2020 at 8:04 PM Jeremy Laidman <user-0608abae5e7c@xymon.invalid <mailto:user-0608abae5e7c@xymon.invalid>> wrote: Kris I suspect $BBCOLORLEVEL is set to the color of the original condition. According to the man page for alerts.cfg, if the word &COLOR& is in the recipient parameter, it is replaced by the colour of the alert. This might give the updated colour after the alert recovered, instead of the alert colour. Or, you can use something like this: NEWCOL=`$XYMON $XYMSRV "xymondboard host=$BBHOSTNAME test=$BBSVCNAME fields=color"` Cheers Jeremy On Wed, 26 Aug 2020 at 08:38, Kris Springer <user-c2caa0a7a8d5@xymon.invalid <mailto:user-c2caa0a7a8d5@xymon.invalid>> wrote: I know this is old, but it's still an issue. I have a script that uses $BBCOLORLEVEL that works great, except the RECOVERED messages come in as Red. They don't say 'Recovered', they say 'Red'. I'm not much of a coder, but is there perhaps some way to have my bash script figure out if the message is a 'recovered' message and print that as the BBCOLORLEVEL instead of printing Red? -- Kris Springer
- -- +---------------------------------------------------------+
| E-mail : user-c862b499d9fa@xymon.invalid | | | | Homepage: http://www.richter-it.net/ | +---------------------------------------------------------+ Download my public key from: http://keys.gnupg.net/pks/lookup?search=0x899093AC&op=get -----BEGIN PGP SIGNATURE----- iF0EARECAB0WIQQJ3zkARmUgZ5/ufuPsOWbGiZCTrAUCX0c8uQAKCRDsOWbGiZCT rMPiAKDPsq0JkjD7++YhAJ/+SInZ5/+XSgCg3R/ArtLfgnoCv6vzUoxq+JVpIhc= =pAQS -----END PGP SIGNATURE-----
list Kris Springer
I did a lot of searching and tried all sorts of different variations with no success. So I gave up on it unless someone has a known functioning line of code they can share. Thanks, Kris Springer
▸
-----Original Message-----
From: Torsten Richter <user-c862b499d9fa@xymon.invalid>
To: Kris Springer <user-c2caa0a7a8d5@xymon.invalid>
Cc: Xymon MailingList <xymon at xymon.com>
Sent: Wed, 26 Aug 2020 10:55 PM
Subject: Re: [Xymon] Alert script "BBCOLORLEVEL" is red when recovered
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Hi Kris,
maybe you should try
elif [[ $BBALPHAMSG =~ INFO ]]
and see if that works.
Cheers,
Torsten
On 26.08.2020 17:48, Kris Springer wrote:Thanks Ralph, I got the 'Recovered' emails working now. On to the 'Info' emails! I've tried added an elif line to look for the word INFO in the message content, but it doesn't seem to work. Any thoughts? Here's the line I'm using. elif [[ $BBALPHAMSG = *INFO* ]]; then echo "Info found" Kris Springer On 8/25/20 7:32 PM, Ralph M wrote:Call me crazy if you like, but in the alerts.cfg file, in the list of environment variables passed to the script, it says: # BBCOLORLEVEL - The color of the alert: "red", "yellow" or "purple" ... [snip] ... # RECOVERED - Is "1" if the service has recovered. So, um, just check $RECOVERED ?? if [ $RECOVERED -eq 1 ]; then # send recovery email fi Ralph Mitchell On Tue, Aug 25, 2020 at 8:04 PM Jeremy Laidman <user-0608abae5e7c@xymon.invalid <mailto:user-0608abae5e7c@xymon.invalid>> wrote: Kris I suspect $BBCOLORLEVEL is set to the color of the original condition. According to the man page for alerts.cfg, if the word &COLOR& is in the recipient parameter, it is replaced by the colour of the alert. This might give the updated colour after the alert recovered, instead of the alert colour. Or, you can use something like this: NEWCOL=`$XYMON $XYMSRV "xymondboard host=$BBHOSTNAME test=$BBSVCNAME fields=color"` Cheers Jeremy On Wed, 26 Aug 2020 at 08:38, Kris Springer <user-c2caa0a7a8d5@xymon.invalid <mailto:user-c2caa0a7a8d5@xymon.invalid>> wrote: I know this is old, but it's still an issue. I have a script that uses $BBCOLORLEVEL that works great, except the RECOVERED messages come in as Red. They don't say 'Recovered', they say 'Red'. I'm not much of a coder, but is there perhaps some way to have my bash script figure out if the message is a 'recovered' message and print that as the BBCOLORLEVEL instead of printing Red? -- Kris Springer
- -- +---------------------------------------------------------+ | E-mail : user-c862b499d9fa@xymon.invalid | | | | Homepage: http://www.richter-it.net/ | +---------------------------------------------------------+ Download my public key from: http://keys.gnupg.net/pks/lookup?search=0x899093AC&op=get -----BEGIN PGP SIGNATURE----- iF0EARECAB0WIQQJ3zkARmUgZ5/ufuPsOWbGiZCTrAUCX0c8uQAKCRDsOWbGiZCT rMPiAKDPsq0JkjD7++YhAJ/+SInZ5/+XSgCg3R/ArtLfgnoCv6vzUoxq+JVpIhc= =pAQS -----END PGP SIGNATURE-----
list Ralph Mitchell
How about this?
INFO=`echo "$BBALPHAMSG" | grep -c INFO`
if [ ........ ]; then
# something
elif [ $INFO -gt 0 ]; then
echo "INFO found"
fi
Ralph Mitchell
▸
On Thu, Aug 27, 2020 at 1:18 AM <user-c2caa0a7a8d5@xymon.invalid> wrote:
I did a lot of searching and tried all sorts of different variations with no success. So I gave up on it unless someone has a known functioning line of code they can share. Thanks, Kris Springer -----Original Message----- From: Torsten Richter <user-c862b499d9fa@xymon.invalid> To: Kris Springer <user-c2caa0a7a8d5@xymon.invalid> Cc: Xymon MailingList <xymon at xymon.com> Sent: Wed, 26 Aug 2020 10:55 PM Subject: Re: [Xymon] Alert script "BBCOLORLEVEL" is red when recovered -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Hi Kris, maybe you should try elif [[ $BBALPHAMSG =~ INFO ]] and see if that works. Cheers, Torsten On 26.08.2020 17 <2608202017>:48, Kris Springer wrote:Thanks Ralph, I got the 'Recovered' emails working now. On to the 'Info' emails! I've tried added an elif line to look for the word INFO in the message content, but it doesn't seem to work. Any thoughts? Here's the line I'm using. elif [[ $BBALPHAMSG = *INFO* ]]; then echo "Info found" Kris Springer On 8/25/20 7:32 PM, Ralph M wrote:Call me crazy if you like, but in the alerts.cfg file, in the list of environment variables passed to the script, it says: # BBCOLORLEVEL - The color of the alert: "red", "yellow" or "purple" ... [snip] ... # RECOVERED - Is "1" if the service has recovered. So, um, just check $RECOVERED ?? if [ $RECOVERED -eq 1 ]; then # send recovery email fi Ralph Mitchell On Tue, Aug 25, 2020 at 8:04 PM Jeremy Laidman <user-0608abae5e7c@xymon.invalid <mailto:user-0608abae5e7c@xymon.invalid>> wrote: Kris I suspect $BBCOLORLEVEL is set to the color of the original condition. According to the man page for alerts.cfg, if the word &COLOR& is in the recipient parameter, it is replaced by the colour of the alert. This might give the updated colour after the alert recovered, instead of the alert colour. Or, you can use something like this: NEWCOL=`$XYMON $XYMSRV "xymondboard host=$BBHOSTNAME test=$BBSVCNAME fields=color"` Cheers Jeremy On Wed, 26 Aug 2020 at 08:38, Kris Springer <user-c2caa0a7a8d5@xymon.invalid <mailto:user-c2caa0a7a8d5@xymon.invalid>> wrote: I know this is old, but it's still an issue. I have a script that uses $BBCOLORLEVEL that works great, except the RECOVERED messages come in as Red. They don't say 'Recovered', they say 'Red'. I'm not much of a coder, but is there perhaps some way to have my bash script figure out if the message is a 'recovered' message and print that as the BBCOLORLEVEL instead of printing Red? -- Kris Springer- -- +---------------------------------------------------------+ | E-mail : user-c862b499d9fa@xymon.invalid | | | | Homepage: http://www.richter-it.net/ | +---------------------------------------------------------+ Download my public key from: http://keys.gnupg.net/pks/lookup?search=0x899093AC&op=get -----BEGIN PGP SIGNATURE----- iF0EARECAB0WIQQJ3zkARmUgZ5/ufuPsOWbGiZCTrAUCX0c8uQAKCRDsOWbGiZCT rMPiAKDPsq0JkjD7++YhAJ/+SInZ5/+XSgCg3R/ArtLfgnoCv6vzUoxq+JVpIhc= =pAQS -----END PGP SIGNATURE-----
list Kris Springer
It worked! Well done Ralph.? Thank you. Here's my updated instructions to close the loop on this topic. https://krisspringer.com/posts/xymon-email-alerts.php Kris Springer
▸
On 8/27/20 7:12 AM, Ralph M wrote:How about this? ? ? ?INFO=`echo "$BBALPHAMSG" | grep -c INFO` ? ? ?if [ ........ ]; then ? ? ? ? ? # something ? ? ?elif [ $INFO -gt 0 ]; then ? ? ? ? ? echo "INFO found" ? ? ?fi Ralph Mitchell On Thu, Aug 27, 2020 at 1:18 AM <user-c2caa0a7a8d5@xymon.invalid <mailto:user-c2caa0a7a8d5@xymon.invalid>> wrote: I did a lot of searching and tried all sorts of different variations with no success. So I gave up on it unless someone has a known functioning line of code they can share. Thanks, Kris Springer -----Original Message----- From: Torsten Richter <user-c862b499d9fa@xymon.invalid <mailto:user-c862b499d9fa@xymon.invalid>> To: Kris Springer <user-c2caa0a7a8d5@xymon.invalid Cc: Xymon MailingList <xymon at xymon.com <mailto:xymon at xymon.com>> Sent: Wed, 26 Aug 2020 10:55 PM Subject: Re: [Xymon] Alert script "BBCOLORLEVEL" is red when recovered -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Hi Kris, maybe you should try elif [[ $BBALPHAMSG =~ INFO ]] and see if that works. Cheers, Torsten On 26.08.2020 17 <tel:XXXXXXXXXX>:48, Kris Springer wrote:Thanks Ralph, I got the 'Recovered' emails working now.? On to the 'Info' emails!? I've tried added an elif line to look for the word INFO in the message content, but it doesn't seem to work. Any thoughts? Here's the line I'm using. elif [[ $BBALPHAMSG = *INFO* ]]; then echo "Info found" Kris Springer On 8/25/20 7:32 PM, Ralph M wrote:Call me crazy if you like, but in the alerts.cfg file, in the list of environment variables passed to the script, it says: ????? #??? BBCOLORLEVEL? - The color of the alert: "red","yellow" or"purple" ????? ... [snip] ... ????? #??? RECOVERED???? - Is "1" if the service has recovered. So, um, just check $RECOVERED ?? ????? if [ $RECOVERED -eq 1 ]; then ?????????? # send recovery email ????? fi Ralph Mitchell On Tue, Aug 25, 2020 at 8:04 PM Jeremy Laidman<user-0608abae5e7c@xymon.invalid <mailto:user-0608abae5e7c@xymon.invalid><mailto:user-0608abae5e7c@xymon.invalid <mailto:user-0608abae5e7c@xymon.invalid>>> wrote: ???? Kris ???? I suspect $BBCOLORLEVEL is set to the color of the original condition. ???? According to the man page for alerts.cfg, if the word&COLOR& is???? in the recipient parameter, it is replaced by the colour of the ???? alert. This might give the updated colour after the alert ???? recovered, instead of the alert colour. ???? Or, you can use something like this: ???? NEWCOL=`$XYMON $XYMSRV "xymondboard host=$BBHOSTNAME ???? test=$BBSVCNAME fields=color"` ???? Cheers ???? Jeremy ???? On Wed, 26 Aug 2020 at 08:38, Kris Springer ???? <user-c2caa0a7a8d5@xymon.invalid ???? wrote: ???????? I know this is old, but it's still an issue.? I have a script ???????? that uses ???????? $BBCOLORLEVEL that works great, except the RECOVERED messages ???????? come in as ???????? Red.? They don't say 'Recovered', they say 'Red'.? I'm not ???????? much of a ???????? coder, but is there perhaps some way to have my bash script ???????? figure out ???????? if the message is a 'recovered' message and print that as the ???????? BBCOLORLEVEL instead of printing Red? ???????? -- ???????? Kris Springer
???????? Xymon mailing list ???? _______________________________________________ ???? Xymon mailing list- -- +---------------------------------------------------------+ | E-mail? : user-c862b499d9fa@xymon.invalid <http://richter-it.net>; ? |
▸
| ? | | Homepage: http://www.richter-it.net/ ? | +---------------------------------------------------------+ Download my public key from: http://keys.gnupg.net/pks/lookup?search=0x899093AC&op=get -----BEGIN PGP SIGNATURE----- iF0EARECAB0WIQQJ3zkARmUgZ5/ufuPsOWbGiZCTrAUCX0c8uQAKCRDsOWbGiZCT rMPiAKDPsq0JkjD7++YhAJ/+SInZ5/+XSgCg3R/ArtLfgnoCv6vzUoxq+JVpIhc= =pAQS -----END PGP SIGNATURE-----