different number of notifications for email and phone calls

Support forum for Nagios Core, Nagios Plugins, NCPA, NRPE, NSCA, NDOUtils and more. Engage with the community of users including those using the open source solutions.
Locked
vvz
Posts: 187
Joined: Wed Oct 30, 2013 5:15 pm

different number of notifications for email and phone calls

Post 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
tmcdonald
Posts: 9117
Joined: Mon Sep 23, 2013 8:40 am

Re: different number of notifications for email and phone ca

Post 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.
Former Nagios employee
slansing
Posts: 7698
Joined: Mon Apr 23, 2012 4:28 pm
Location: Travelling through time and space...

Re: different number of notifications for email and phone ca

Post 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.
vvz
Posts: 187
Joined: Wed Oct 30, 2013 5:15 pm

Re: different number of notifications for email and phone ca

Post 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
abrist
Red Shirt
Posts: 8334
Joined: Thu Nov 15, 2012 1:20 pm

Re: different number of notifications for email and phone ca

Post 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.
Former Nagios employee
"It is turtles. All. The. Way. Down. . . .and maybe an elephant or two."
VI VI VI - The editor of the Beast!
Come to the Dark Side.
vvz
Posts: 187
Joined: Wed Oct 30, 2013 5:15 pm

Re: different number of notifications for email and phone ca

Post by vvz »

Thank you, it's clear
Locked