I use /etc/nagios4/conf.d/contacts.cfg:
define contact { host_notifications_enabled 1 service_notifications_enabled 1 contact_name root service_notification_period 24x7 host_notification_period 24x7 service_notification_options w,u,c,r host_notification_options d,r service_notification_commands notify-service-by-email host_notification_commands notify-host-by-email email root@localhost } define contactgroup { contactgroup_name admins alias Nagios Administrators members root }
I get an error when I include the following in contacts.cfg (If I remove this, the error goes away):
define contactgroup { contactgroup_name admins alias Nagios Administrators members root }
The error I receive is the following:
Warning: Duplicate definition found for contactgroup 'admins' (config file '/etc/nagios4/objects/contacts.cfg', starting on line 46)
Error: Could not add object property in file '/etc/nagios4/objects/contacts.cfg' on line 48.
Error: Service notification period '24x7' specified for contact 'root' is not defined anywhere!
Error: Could not register contact (config file '/etc/nagios4/conf.d/contacts.cfg', starting on line 1)
Error processing object config files!
Hey Travis,
The error is saying that you have a duplicate contactgroup for admins. If you look in your contactgroups.cfg file admins should be set up already by default unless it was removed. If you want to change your contactgroup go to contactgroups.cfg in the same location and you should be able to edit it to be what you need. The secondary error mentions 24x7 not being defined in the root contact as well so while your in contacts.cfg make sure that the root contact has a valid notification period. Let us know if this helps.
Thanks for the advice.
I replaced /etc/nagios4/objects/contacts.cfg with /etc/nagios4/conf.d/contacts.cfg and it fixed the problem.
Even though the contacts.cfg template at https://github.com/NagiosEnterprises/nagioscore/blob/master/sample-config/template-object/contacts.cfg.in states, "You don't need to keep these definitions in a separate file from your other object definitions," it needs to be clarified in this template that only /etc/nagios4/objects/contacts.cfg can exist, but not at the same time as /etc/nagios4/conf.d/contacts.cfg.
That's fair enough. Do you have an account on github to create an issue for that. If not, I can create one on your behalf.