Page 1 of 1

contacts cfg is failing

Posted: Wed Sep 30, 2015 10:50 am
by sinkak
In nagios.cfg file

i added whole config files folder

# Debian uses by default a configuration directory where nagios3-common,
# other packages and the local admin can dump or link configuration
# files into.
cfg_dir=/usr/local/nagios/etc/conf.d


It showed no error while nagios reload.

But after i added individual file

Code: Select all

# You can specify individual object config files as shown below:
cfg_file=/usr/local/nagios/etc/conf.d/contacts/contacts_nagios2.cfg
Its showing this error

Code: Select all

Warning: Duplicate definition found for contact 'wsawarn' (config file '/usr/local/nagios/etc/conf.d/contacts/contacts_nagios2.cfg', starting on line 18)
Error: Could not add object property in file '/usr/local/nagios/etc/conf.d/contacts/contacts_nagios2.cfg' on line 19.
   Error processing object config files!
i made no changes to contacts.cfg file.

Code: Select all

define contact{
        contact_name                              wsawarn                             <-------------line19
        alias                                            WSAWarn
        service_notification_period          24x7
        host_notification_period               24x7
        service_notification_options         c
        host_notification_options             d
        service_notification_commands    notify-service-by-email
        host_notification_commands        notify-host-by-email
        email                                          [email protected]
       }

define contactgroup{
        contactgroup_name       admins
        alias                       Nagios Administrators
        members                 wsawarn
        }

Re: contacts cfg is failing

Posted: Wed Sep 30, 2015 2:22 pm
by hsmith
The error is telling you that you have this contact defined in multiple spots. If you have it defined in more than once place, you are going to have issues. You'll need to choose one spot that you want the contact and delete it from the other place. Does this make sense ?

Re: contacts cfg is failing

Posted: Wed Sep 30, 2015 2:53 pm
by sinkak
I have only one contact defined.
as shown above and many contact_groups.

it doesn't show error before i when i had this on nagios.cfg.

Code: Select all

cfg_dir=/usr/local/nagios/etc/conf.d
but when i ad individual config file like this on nagios.cfg.

Code: Select all

cfg_file=/usr/local/nagios/etc/conf.d/contacts/contacts_nagios2.cfg
this error comes up.

Re: contacts cfg is failing

Posted: Wed Sep 30, 2015 3:00 pm
by jdalrymple
Do you have both lines in nagios.cfg at the same time? If so you're effectively defining the entire file twice and as such the contact will be read over twice.

Expected behavior...

Re: contacts cfg is failing

Posted: Wed Sep 30, 2015 3:01 pm
by sinkak
Oh thats the reason they are failing. Got it.

Please close this thread.

Re: contacts cfg is failing

Posted: Wed Sep 30, 2015 3:02 pm
by lmiltchev
You shouldn't be modifying the configs manually from the CLI because when you apply configuration, all of the changes that you have made would be wiped out (re-written with whatever is in the database).
All of the changes must be made in the CCM. XI users/contacts can be added by going to Admin->Manage Users->Add New User.

Re: contacts cfg is failing

Posted: Wed Sep 30, 2015 3:17 pm
by sinkak
Sorry.
I posted in wrong forum. I am using nagios core.
Please close this post.