Can Xymon send an email when changing from BLUE to GREEN?
Hi,
Is it possible to configure Xymon to send an email when an alert changes from BLUE to GREEN?
I've already got RECOVERED on the entry in alerts.cfg and that's working for RED, YELLOW, and PURPLE when they go GREEN.
I did a quick search and didn't come up with anything germane, so I figured that it was work asking if this is possible before spending a lot of time combing through seemingly non-germane to make sure there wasn't a hint therein.
-- Grant. . . . unix || die
On 02/12/2024 18:23, Grant Taylor via Xymon wrote:
Hi,
Is it possible to configure Xymon to send an email when an alert changes from BLUE to GREEN?
I've already got RECOVERED on the entry in alerts.cfg and that's working for RED, YELLOW, and PURPLE when they go GREEN.
I did a quick search and didn't come up with anything germane, so I figured that it was work asking if this is possible before spending a lot of time combing through seemingly non-germane to make sure there wasn't a hint therein.
This isn't functionality I make use of so read the following as "a thought that might or might not be useful" rather than "this will definitely work".
I suspect you should look at the values of:
ALERTCOLORS : Comma-separated list of the colors that may trigger an alert-message. The default is "red,yellow,purple".
OKCOLORS : Comma-separated list of the colors that may trigger a recovery-message. The default is "green,clear,blue"
...as defined in your xymonserver.cfg (and I've quoted from man xymonserver.cfg). Taking blue out of OKCOLORS and adding it to ALERTCOLORS is probably required for what you want (and then restart xymond), but that might also have unexpected effects on your other rules in alerts.cfg unless you've been careful to always specify a COLOR on those.
Adam
On 12/2/24 1:06 PM, Adam Thorn via Xymon wrote:
This isn't functionality I make use of so read the following as "a thought that might or might not be useful" rather than "this will definitely work".
Understood. I'm treating this as "something I found on a mailing list that I'm going to try and see if it helps". Emphasis on "I" and "try". Meaning that I'm responsible for any side effects, not you. ;-)
I suspect you should look at the values of:
ALERTCOLORS : Comma-separated list of the colors that may trigger an alert-message. The default is "red,yellow,purple".
OKCOLORS : Comma-separated list of the colors that may trigger a recovery-message. The default is "green,clear,blue"
...as defined in your xymonserver.cfg (and I've quoted from man xymonserver.cfg). Taking blue out of OKCOLORS and adding it to ALERTCOLORS is probably required for what you want (and then restart xymond), but that might also have unexpected effects on your other rules in alerts.cfg unless you've been careful to always specify a COLOR on those.
I think I understand.
It sounds like I want to try treating BLUE as a color that should alert / have reminders sent out about.
As such, changing from alert able BLUE to non-alert able GREEN should cause a recovered email to be sent.
Thank you Adam, that is both something specific to read up on and what I was asking for. :-)
-- Grant. . . . unix || die
I think Adam's solution is probably the best fit for your needs. However, if you need a bit more flexibility (eg if adding BLUE to ALERTCOLORS causes blue dots to show on your "Current non-green systems" page, as if they were active faults), there may be (ie, I have not tested) another solution. You can use the "xymond_channel" binary to tap into the "stachg" (status change) channel, filtering for any event that changes colour from red to blue or from blue to red (or any other transition you're interested in). The following command waits for such events, and for each it spits out the associated status message that you might use in an email message: $ sudo -u xymon xymoncmd xymond_channel --channel=stachg --metafilter='\|(blue\|red|red\|blue)\|' cat Here I'm using "cat" to send the message stream into, just for demonsting. You would want to replace "cat" with a script that extracts the text between lines matching regex /^@@/ and inject them into an email program. There might be a way to redirect this output back into to Xymon on the "page" channel, which then allows your existing alerts.cfg configuration to be used for managing your emails in the same way you would for red alerts, etc. However I suspect there will be limited features (eg there isn't a DELAYBLUE option) or work-arounds required (eg specifying a colour of "!red,!yellow,!purple" to match "blue" events?) J On Tue, 3 Dec 2024 at 07:53, Grant Taylor via Xymon <xymon@xymon.com> wrote:
On 12/2/24 1:06 PM, Adam Thorn via Xymon wrote:
This isn't functionality I make use of so read the following as "a thought that might or might not be useful" rather than "this will definitely work".
Understood. I'm treating this as "something I found on a mailing list that I'm going to try and see if it helps". Emphasis on "I" and "try". Meaning that I'm responsible for any side effects, not you. ;-)
I suspect you should look at the values of:
ALERTCOLORS : Comma-separated list of the colors that may trigger an alert-message. The default is "red,yellow,purple".
OKCOLORS : Comma-separated list of the colors that may trigger a recovery-message. The default is "green,clear,blue"
...as defined in your xymonserver.cfg (and I've quoted from man xymonserver.cfg). Taking blue out of OKCOLORS and adding it to ALERTCOLORS is probably required for what you want (and then restart xymond), but that might also have unexpected effects on your other rules in alerts.cfg unless you've been careful to always specify a COLOR on those.
I think I understand.
It sounds like I want to try treating BLUE as a color that should alert / have reminders sent out about.
As such, changing from alert able BLUE to non-alert able GREEN should cause a recovered email to be sent.
Thank you Adam, that is both something specific to read up on and what I was asking for. :-)
-- Grant. . . . unix || die
_______________________________________________ Xymon mailing list -- xymon@xymon.com To unsubscribe send an email to xymon-leave@xymon.com
On 12/2/24 7:47 PM, Jeremy Laidman wrote:
I think Adam's solution is probably the best fit for your needs.
I guess I did something wrong as when I tested Adam's solution I wasn't able to get things to work as well as they were before. So I reverted. I assume that I did something wrong.
However, if you need a bit more flexibility ..., there may be ... another solution. You can use the "xymond_channel" binary to tap into the "stachg" ... channel, filtering for any event that changes colour from red to blue or from blue to red .... The following command waits for such events, and for each it spits out the associated status message that you might use in an email message:
$ sudo -u xymon xymoncmd xymond_channel --channel=stachg --metafilter='\|(blue\|red|red\|blue)\|' cat
My initial testing of this has been very promising. I'll be greenfielding some code to receive the data from the channel and send emails that I need.
There might be a way to redirect this output back into to Xymon on the "page" channel, which then allows your existing alerts.cfg configuration to be used for managing your emails in the same way you would for red alerts, etc. However I suspect there will be limited features (eg there isn't a DELAYBLUE option) or work-arounds required (eg specifying a colour of "!red,!yellow,!purple" to match "blue" events?)
For now I just need to send a helper email to ServiceNow when a test goes from blue to green; as if Disable until OK was chosen.
-- Grant. . . . unix || die
participants (3)
-
Adam Thorn
-
Grant Taylor
-
Jeremy Laidman