Page 1 of 1
different number of notifications for email and phone calls
Posted: Mon Apr 21, 2014 4:43 pm
by vvz
HI!
For a host in DOWN status, can I have a host definition which allows me to receive 3 phone calls and only 1 email?
Or I have to create 2 host definitions for the same host, one for phone calls and another for emails?
Thank you
Re: different number of notifications for email and phone ca
Posted: Mon Apr 21, 2014 4:46 pm
by tmcdonald
Considering all the timing-related notification options (notification_interval, first_notification_delay, notification_period, etc) are in the host definition, these isn't a way built in to separate out the notifications like that. However you can always edit the notification handler to take the current notification into consideration and then make the decision on whether to email or call based on that.
Re: different number of notifications for email and phone ca
Posted: Mon Apr 21, 2014 4:48 pm
by slansing
Are you looking to get a email and a sms message/call together on the first notification? What you could do, is you could create an additional contact for your text message/call and then define an escalation, so you would receive either an email for the first notification and calls/messages there after, or vice versa.
Re: different number of notifications for email and phone ca
Posted: Mon Apr 21, 2014 5:21 pm
by vvz
Thank you, I already did that, but I wanna keep as less as possible in Nagios configuration and event handler looks more suitable for that.
I give 4 parameters to my script, like this
command_line $USER2$/asteriks-service-phone-call $SERVICESTATE$ $SERVICESTATETYPE$ $SERVICEATTEMPT$ $CONTACTEMAIL$
No limits for number of parameters (other than for bash) in event handlers? Can I use $CONTACTEMAIL$ macros here? The reason I'm asking event handler works with the first three parameters (of course with some changes in the script)
Thank you
Re: different number of notifications for email and phone ca
Posted: Tue Apr 22, 2014 2:43 pm
by abrist
vvz wrote:Can I use $CONTACTEMAIL$ macros here?
The $CONTACTEMAIL$ can only be used with notification handlers. If you are attempting to access this macro from an event handler, it will not work.
vvz wrote:No limits for number of parameters (other than for bash) in event handlers?
No limits, but you must change the syntax for a passed variable larger than nine. Where you would normally use $1, $2, etc, after nine, you need to use ${10}, ${11}, etc.
Re: different number of notifications for email and phone ca
Posted: Tue Apr 22, 2014 2:50 pm
by vvz
Thank you, it's clear