2 notification method,
2 notification method,
Hi,
I would like to have 2 different notification setup. for example email, and SMS.
what i am trying to achieve is , nagios will always send notification using 1st method,ie.email.. however if the email services down, then nagios will use 2nd method.ie.sms to send out notification
may i know is this possible to do? kindly advise
I would like to have 2 different notification setup. for example email, and SMS.
what i am trying to achieve is , nagios will always send notification using 1st method,ie.email.. however if the email services down, then nagios will use 2nd method.ie.sms to send out notification
may i know is this possible to do? kindly advise
-
- Former Nagios Staff
- Posts: 4583
- Joined: Wed Sep 21, 2016 10:29 am
- Location: NoLo, Minneapolis, MN
- Contact:
Re: 2 notification method,
You can set up two, but there isn't any sort of failover mechanism. You could set up both but just have the sms notification command commented out. You could have a script uncomment those lines if the mail server is down. You could do this through an event handler: https://assets.nagios.com/downloads/nag ... dlers.html
Re: 2 notification method,
Hi dwhitfield, thanks for your reply.
understand that there is no failover mechanism , however i would like to ask is my steps below do-able/correct? is there a better way of doing this as workaround? thanks
1. in command.cfg, commented out sms method
2. setup another service check .ie. check_smtp,
when check_smtp is critical, it goes to event-handler
sed some keyword and comment all sms method
nagios will now send sms.
however, is there any way to to re-comment out sms method once the check_smtp is recovered?
Thanks
understand that there is no failover mechanism , however i would like to ask is my steps below do-able/correct? is there a better way of doing this as workaround? thanks
1. in command.cfg, commented out sms method
2. setup another service check .ie. check_smtp,
when check_smtp is critical, it goes to event-handler
sed some keyword and comment all sms method
nagios will now send sms.
however, is there any way to to re-comment out sms method once the check_smtp is recovered?
Thanks
Re: 2 notification method,
More sed/awk!liangwh wrote: however, is there any way to to re-comment out sms method once the check_smtp is recovered?
If this were my problem to solve, I'd bake the logic into my notification handler.
Code: Select all
if( send email command fails ) {
// try to send SMS
}
Former Nagios employee
https://www.mcapra.com/
https://www.mcapra.com/
-
- Former Nagios Staff
- Posts: 4583
- Joined: Wed Sep 21, 2016 10:29 am
- Location: NoLo, Minneapolis, MN
- Contact:
Re: 2 notification method,
This is true!mcapra wrote: It's certainly cleaner and less tough on the Nagios daemon than modifying config files on the fly.
I guess it ultimately depends on how comfortable the OP is in not using the default notification commands. Event handlers are a great place for "custom" stuff, but there's certainly nothing stopping you from using custom notification scripts.
There are also escalations, which definitely don't do exactly what you want, but could be used as a work around if acknowledging issues is the norm in your environment: https://assets.nagios.com/downloads/nag ... tions.html -- the major caveat here is that it will take some time for the escalation to kick in. You control the time, but there's no logic to check that mail is down.
Re: 2 notification method,
ya ..but what i asking was, since the check_smtp recover will go to (same) event handler . so comment and uncomment should be all done in 1 script , am i correct.mcapra wrote:More sed/awk!liangwh wrote: however, is there any way to to re-comment out sms method once the check_smtp is recovered?
Thanks for pointing this out, i didnt know there's notification handler.If this were my problem to solve, I'd bake the logic into my notification handler.It's certainly cleaner and less tough on the Nagios daemon than modifying config files on the fly.Code: Select all
if( send email command fails ) { // try to send SMS }
how does it work compare to a normal event_handler. i tried google it but seems like its hard to find the link about it. appreciate if you could provide link so i can look it up before asking more question.
thanks alot
thanks
-
- Former Nagios Staff
- Posts: 4583
- Joined: Wed Sep 21, 2016 10:29 am
- Location: NoLo, Minneapolis, MN
- Contact:
Re: 2 notification method,
What did you find? I can give you links, but I don't want to double-dip. The place to start is https://assets.nagios.com/downloads/nag ... tions.htmlliangwh wrote: i tried google it but seems like its hard to find the link about it.
You should read the entire document, but "Notification Methods" is going to be the most useful section for you.
Re: 2 notification method,
Hi,
I am sorry i cant find any notification handler to handle "if email fails, then sms"
Appreciate if you could share some idea
or is it still ok to use the steps earlier: check_smtp > critical > event handler >script to sed
Thanks
I am sorry i cant find any notification handler to handle "if email fails, then sms"
Appreciate if you could share some idea
or is it still ok to use the steps earlier: check_smtp > critical > event handler >script to sed
Thanks
-
- Former Nagios Staff
- Posts: 4583
- Joined: Wed Sep 21, 2016 10:29 am
- Location: NoLo, Minneapolis, MN
- Contact:
Re: 2 notification method,
There isn't one. As @mcapra noted, you have to write the handler yourself. The documentation is there to help you write your handler. Someone may also be able to help you write it as this is a public forum, but it's not something support techs do as a matter of policy.liangwh wrote: I am sorry i cant find any notification handler to handle "if email fails, then sms"
We do also offer custom development if that would be of interest.
Re: 2 notification method,
Hi ,
I would like to try to write the handler. However I still cant get the idea how this handler works.
If i use global event handler, and the handler is if email fails then sms,
does that mean that contacts should not have any host/service notification enabled , because that already configured on the handler.
For the custom development, I might need to check with my commercial team. Meaning for now i would like to test it by myself first.
thanks
I would like to try to write the handler. However I still cant get the idea how this handler works.
If i use global event handler, and the handler is if email fails then sms,
does that mean that contacts should not have any host/service notification enabled , because that already configured on the handler.
For the custom development, I might need to check with my commercial team. Meaning for now i would like to test it by myself first.
thanks