Contact is not defined anywhere

Support forum for Nagios Core, Nagios Plugins, NCPA, NRPE, NSCA, NDOUtils and more. Engage with the community of users including those using the open source solutions.
Locked
sevealin
Posts: 2
Joined: Fri Jan 03, 2020 11:50 am

Contact is not defined anywhere

Post 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!
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

Re: Contact is not defined anywhere

Post by scottwilkerson »

The definition you are using is incorrect
replace

Code: Select all

name                            test_contact
with

Code: Select all

contact_name                            test_contact
Former Nagios employee
Creator:
Human Design Website
Get Your Human Design Chart
sevealin
Posts: 2
Joined: Fri Jan 03, 2020 11:50 am

Re: Contact is not defined anywhere

Post by sevealin »

Solved! Thank you. I can't believe I missed that.
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

Re: Contact is not defined anywhere

Post by scottwilkerson »

sevealin wrote:Solved! Thank you. I can't believe I missed that.
Great!

Locking thread
Former Nagios employee
Creator:
Human Design Website
Get Your Human Design Chart
Locked