Notifications to a Contact Group

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
aravindreddy114
Posts: 55
Joined: Tue May 07, 2013 12:48 pm

Notifications to a Contact Group

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

Re: Notifications to a Contact Group

Post 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.
aravindreddy114
Posts: 55
Joined: Tue May 07, 2013 12:48 pm

Re: Notifications to a Contact Group

Post by aravindreddy114 »

Is there a way where we can change this, that way people will know who is getting the mails
Thanks Araivnd
slansing
Posts: 7698
Joined: Mon Apr 23, 2012 4:28 pm
Location: Travelling through time and space...

Re: Notifications to a Contact Group

Post 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.
aravindreddy114
Posts: 55
Joined: Tue May 07, 2013 12:48 pm

Re: Notifications to a Contact Group

Post by aravindreddy114 »

How can i create custom notification handlers
abrist
Red Shirt
Posts: 8334
Joined: Thu Nov 15, 2012 1:20 pm

Re: Notifications to a Contact Group

Post 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.
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.
aravindreddy114
Posts: 55
Joined: Tue May 07, 2013 12:48 pm

Re: Notifications to a Contact Group

Post by aravindreddy114 »

Thanks
abrist
Red Shirt
Posts: 8334
Joined: Thu Nov 15, 2012 1:20 pm

Re: Notifications to a Contact Group

Post 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.
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.
aravindreddy114
Posts: 55
Joined: Tue May 07, 2013 12:48 pm

Re: Notifications to a Contact Group

Post by aravindreddy114 »

It there a way to edit the Macro NOTIFICATIONRECIPIENTS
abrist
Red Shirt
Posts: 8334
Joined: Thu Nov 15, 2012 1:20 pm

Re: Notifications to a Contact Group

Post by abrist »

No, not without altering the Nagios core source. It is a built-in macro.
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.
Locked