Page 1 of 1

unable to delete contacts.cfg present in static dir

Posted: Tue Nov 06, 2018 4:55 am
by nagiosEngie
Hello Nagios Crew,
I am having a strange issue with my contacts.cfg file. This file is present in /usr/local/nagios/etc/ and in /usr/local/nagios/etc/static.


I am unable to delete the contacts.cfg file in the stic directory. Every time nagios restarts it will recreate this file in the static directory giving me errors every time I add a contact or contact group:

Error: Could not find any contact matching 'francesco.surace' (config file '/usr/local/nagios/etc/contactgroups.cfg', starting on line 70)
Error: Failed to expand contacts for contactgroup 'WEBMETHODS' (config file '/usr/local/nagios/etc/contactgroups.cfg', starting at line 70)
Error: Contact 'sandro.ginnari' is not defined anywhere!
Error: Could not add contact 'sandro.ginnari' to host (config file '/usr/local/nagios/etc/hosts/EINAGFUITMI01.cfg', starting on line 16)

If I look in contacts.cfg (the one in /usr/local/nagios/etc/):

define contact {
contact_name francesco.surace
alias WEBMETHODS
host_notifications_enabled 1
service_notifications_enabled 1
host_notification_period webmethods_notification_times
service_notification_period webmethods_notification_times
host_notification_options d,r,
service_notification_options w,c,r,
host_notification_commands xi_host_event_handler
service_notification_commands xi_service_event_handler
email [email protected]
use xi_contact_generic
}

AND

define contact {
contact_name sandro.ginnari
alias sandro.ginnari
host_notifications_enabled 1
service_notifications_enabled 1
host_notification_period sandro.ginnari_notification_times
service_notification_period sandro.ginnari_notification_times
host_notification_options d,r,
service_notification_options w,c,r,
email [email protected]
use xi_contact_generic
}


If I lookin my contactgroup.cfg I see:

define contactgroup {
contactgroup_name WEBMETHODS
alias WEBMETHODS
members daniele.devenezia,francesco.surace
}

define contactgroup {
contactgroup_name xi_contactgroup_all
alias All Contacts
members *
}
which looks ok to me.

I think all this mess is due to the presence of the contacts.cfg in the static dir. How do I delete it permanently?


Thanks
Sandro

Re: unable to delete contacts.cfg present in static dir

Posted: Tue Nov 06, 2018 8:02 am
by scottwilkerson
It looks like the contacts file in the static directory contains some of the contacts that are assigned to some groups you have.

Here's the best thing you can so, move the contacts file from the static directory to the import directory and try to apply configuration

Code: Select all

mv /usr/local/nagios/etc/static/contacts.cfg /usr/local/nagios/etc/import/contacts.cfg
This will add the missing items to the CCM and then it won't re-populate if the configuration applies successfully.

Re: unable to delete contacts.cfg present in static dir

Posted: Tue Nov 06, 2018 8:10 am
by nagiosEngie
Worked!
Nice job!
Thanks

Sandro

Re: unable to delete contacts.cfg present in static dir

Posted: Tue Nov 06, 2018 9:31 am
by scottwilkerson
nagiosEngie wrote:Worked!
Nice job!
Thanks

Sandro
Glad to help.

Locking topic