Page 1 of 1

Contact is not defined anywhere

Posted: Fri Jan 03, 2020 12:00 pm
by sevealin
Hello!

I just got Nagios on a vm and I am playing around with it. I am trying to create a custom contact, but for some reason I keep getting the error:

Code: Select all

Jan 03 10:52:56 nagios nagios[4075]: Error: Contact 'test_contact' is not defined anywhere!
Jan 03 10:52:56 nagios nagios[4075]: Error: Could not add contact 'test_contact' to host (config file '/usr/local/nagios/etc/servers/test.cfg', starting on line 12)
Jan 03 10:52:56 nagios nagios[4075]:    Error processing object config files!
I have tried inserting the contact into contacts.cfg, but I receive the same error when restarting Nagios. I've tried inserting the contact directly above the host object (in the host objects .cfg file) as well, receiving the same error. If I insert the contact into contacts.cfg and test.cfg, I receive an error that there is a duplicate contact, so Nagios knows it exists.

test.cfg:

Code: Select all

define contact{
    name                            test_contact
    email                           [email protected]
    service_notification_period     24x7
    host_notification_period        24x7
    service_notification_options    w,u,c,r,f,s
    host_notification_options       d,u,r,f,s
    service_notification_commands   notify-service-by-email
    host_notification_commands      notify-host-by-email
    }

define host{
    host_name              test
    address                192.168.252.148
    check_interval         1
    retry_interval         1
    max_check_attempts     1
    check_command          check-host-alive
    contacts               test_contact
    notification_interval  60
    notification_period    24x7
    }
Thank you!

Re: Contact is not defined anywhere

Posted: Fri Jan 03, 2020 1:03 pm
by scottwilkerson
The definition you are using is incorrect
replace

Code: Select all

name                            test_contact
with

Code: Select all

contact_name                            test_contact

Re: Contact is not defined anywhere

Posted: Fri Jan 03, 2020 1:24 pm
by sevealin
Solved! Thank you. I can't believe I missed that.

Re: Contact is not defined anywhere

Posted: Fri Jan 03, 2020 1:26 pm
by scottwilkerson
sevealin wrote:Solved! Thank you. I can't believe I missed that.
Great!

Locking thread