Page 1 of 2

Notifications to a Contact Group

Posted: Fri Sep 20, 2013 12:50 pm
by aravindreddy114
I have create 15 contacts and added them to a contact group. I included this contact group in all the service checks.

In the TO section of email notifications that i receive from nagios, i am not seeing list of people in the contact group. I only see my name.
What should i do to see the names of all the people in the contact group, when i receive any alert

Re: Notifications to a Contact Group

Posted: Fri Sep 20, 2013 1:33 pm
by slansing
You will not see other peoples email addresses from a notification email, this is a privacy thing as emails are sent out from nagios to all of the contact addresses.

Re: Notifications to a Contact Group

Posted: Fri Sep 20, 2013 2:26 pm
by aravindreddy114
Is there a way where we can change this, that way people will know who is getting the mails
Thanks Araivnd

Re: Notifications to a Contact Group

Posted: Mon Sep 23, 2013 9:20 am
by slansing
Not easily, you could create a few custom notification handlers and hand include each contact's email address in the mail body, however you would need to manually change this whenever you added or removed contacts.

Re: Notifications to a Contact Group

Posted: Tue Sep 24, 2013 12:20 pm
by aravindreddy114
How can i create custom notification handlers

Re: Notifications to a Contact Group

Posted: Tue Sep 24, 2013 1:00 pm
by abrist
You can use the macro: $NOTIFICATIONRECIPIENTS$
This will show the short (display) names of the contacts associated with the object.

1. Go to --> Admin --> Notification Management.
2. Add the following to the body of the service and host emails:

Code: Select all

Contacts: %contacts%
3. Now go to --> Configure --> Core Config Manager --> Commands. Search for "notification_handler". Add the following to the end of the command for the two commands (xi_host_notification_handler and xi_service _notification_handler):

Code: Select all

--contacts="$NOTIFICATIONRECIPIENTS$" 
Save out and apply configuration.

Now your emails should include a list of the contacts also on the object.

Re: Notifications to a Contact Group

Posted: Tue Sep 24, 2013 1:32 pm
by aravindreddy114
Thanks

Re: Notifications to a Contact Group

Posted: Tue Sep 24, 2013 1:48 pm
by abrist
No problem. This works for any core macro (http://nagios.sourceforge.net/docs/3_0/macrolist.html). Just map the macro to a name and put it at the end of the xi notification handlers:

Code: Select all

--<name>="<$macro$>"
Then add the name (with bookended percents) to the notification message:

Code: Select all

Whatever: %<name>%
Note: This only works with XI notifications, not core. Core notifications would use just the core macro and would have to be embedded in the body portion of the core notification handler.

Re: Notifications to a Contact Group

Posted: Tue Sep 24, 2013 8:44 pm
by aravindreddy114
It there a way to edit the Macro NOTIFICATIONRECIPIENTS

Re: Notifications to a Contact Group

Posted: Wed Sep 25, 2013 10:00 am
by abrist
No, not without altering the Nagios core source. It is a built-in macro.