Debugging Nagios Configuration

configurationnagios

I have this nagios configuration that won't validate.

I'm trying to set up contacts and the various groups of contacts. My Contacts are based off of my generic-manager template:

define contact {

    contact_name                    generic-manager
    name                            generic-manager
    email                           defaultemail@mydomain.com
    alias                           Manager Template
    service_notification_period     hours
    host_notification_period        hours
    service_notification_options    w,c,r                        
    host_notification_options       d,u,r                        
    service_notification_commands   notify-service-by-email,             
    host_notification_commands      notify-host-by-email,
    register                        0 }

My Contact definition:

define contact {

    use                             generic-manager  
    name                            manager-1  
    contact_name                    First Manager  
    contactgroups                   branch  
    email                           branchmanager@mydomain.com }

Contact Group definition:

define contactgroup {

    contactgroup_name       branch
    alias                   Contacts for Branch  
    members                 admins,manager-1 }

When I verify the configuration nagios -v /etc/nagios3/nagios.cfg I get the following errors.

Error: Could not find any contact matching 'manager-1'
Error: Could not expand member contacts specified in contactgroup

I've made sure that everything is spelled correctly, but it doesn't seem to be working. Any suggestions?

Best Answer

According to http://nagios.sourceforge.net/docs/3_0/objectdefinitions.html#contact "contact_name" should be used for the short name (that is used in groups etc.) and "alias" for the longer name. So you should change it to:

contact_name manager-1
alias First Manager

Also, you should use either "contactgroups" in a contact or "members" in a contactgroup, not both. While it will not break anything now, it might lead to confusion later if you update only one and find that it has no effect.