Page 1 of 1

Contact Group Options - +, Null, standard

Posted: Wed May 18, 2016 10:38 am
by perric
Hello,

I need help when I have two templates being applied to a host or service. Each template has a contact group specified. I want the contact groups from both templates to receive alerts.

Will this work? If yes, how should I specify the Contact Group options. I tested with + as the contact option on each template and I am not seeing alerts to both groups.

David

Re: Contact Group Options - +, Null, standard

Posted: Wed May 18, 2016 3:18 pm
by tgriep
If you set the + in both of the templates for the contact groups, it should apply both groups to the object.
If you look at this file /usr/local/nagios/var/objects.cache for one of the host or services you are having issues with, what does it show for the contact groups?
Can you post your host or service check you are working on and also the templates so we can review them?

Re: Contact Group Options - +, Null, standard

Posted: Wed May 18, 2016 6:41 pm
by Box293
I also wanted to chime in.

If your host or service object has contact or contactgroups assigned directly you'll also need to use the + on the host or service object for the templates to be inherited.

IF you are relying on the host object contact or contactgroups being inherited by the service objects, then this will not work if your service objects also have a contact or contactgroups assgined directly to the service, the inheritance is ignored at this point.

Re: Contact Group Options - +, Null, standard

Posted: Thu May 19, 2016 8:36 am
by perric
Appreciate the replies. Let me check on this and get back to you.

David

Re: Contact Group Options - +, Null, standard

Posted: Thu May 19, 2016 10:45 am
by tgriep
Let us know how it works out for you.

Re: Contact Group Options - +, Null, standard

Posted: Thu May 26, 2016 8:19 am
by perric
Hello,

I found two problems. I had a template configured with a Contact Group, but no Alert Settings like Notification period, Notification options, etc. Notification enabled was set to skip. This was done, because these fields were configured via a "parent" template. but it appears that if I am adding a Contact or Contact group that I also need to have Alert settings configured on the same template. Is this the expected behavior?

For the second problem, if I use check_xi_service_snmp, it appears to not work with the notification command, notify-service-by-email? Do the xi commands need to be paired up or can we mix and match xi and non-xi commands?

David

Re: Contact Group Options - +, Null, standard

Posted: Thu May 26, 2016 12:14 pm
by tgriep
Depending on the order of templates used an object, could effect those settings.
The settings in the object override the first template and that template overrides the second template, and so on.
That is how Object inheritance works and it is as expected.

The notifications are paired up more by the Mail Method the XI server is using and not the template, unless the template overrides the notification command.
Take a look at this document for more details on this.
https://assets.nagios.com/downloads/nag ... ios-XI.pdf

Re: Contact Group Options - +, Null, standard

Posted: Thu May 26, 2016 1:44 pm
by perric
Tgriep,

I understand your comment about the inheritance.of settings, but if I have a service that is configured with a Site Template and that Site Template has a Master Template configured as described below, why does the Contact Group under the "Site Template" not work unless I add a full set of alerting settings (Notification enabled, Notification Period, etc.) on the "Site Template". Why don't the Master Template settings of "Notification Period, etc. apply to the Site Template for the Contact Group?

Service - No Alerting Settings (no contacts, no Notification period, etc.)
Site Template - For alerting settings, it only has a "Contact Group" specified and no other alerting settings
Master Template - Has all Alert Settings specified, including "Contact Group", Notification Period, Notification enabled, etc.

Also, I checked the link you provided, but I do not see details on the mail method. Do you mean that the notification command needs to be paired with the check commands? If I am using XI checks, I should be using XI notification commands, so that the variables match up?

David

Re: Contact Group Options - +, Null, standard

Posted: Thu May 26, 2016 2:32 pm
by tgriep
Without seeing the service settings and the template settings, I can't give you a definitive answer but the settings should pass through to the service check from the template as long as only one of them have the settings.

Notifications and check commands should have nothing to do with each other.
To check your Mail Method for your server, you would go to Admin > Manage Email Settings.
In that screen, you would either use Sendmail or SMTP as the method.

If you use Sendmail as your method, you should be able to use any notification command
xi_host_notification_handler
xi_service_notification_handler
notify-host-by-email
notify-service-by-email
As long as the Sendmail or Postfix is setup on the server correctly to receive and send emails.

If the Mail method is using SMTP, then you would use the following notification commands.
xi_host_notification_handler
xi_service_notification_handler

All of the above should work is the contact and user accounts are enabled for notifications and have correct information, address etc...
There are exceptions to how notifications are sent out but that would require more settings to be done.