2

Trying to get nagios up and running and been stuck here awhile, not exactly sure what I am doing wrong.. Any help would be great =)

/usr/local/nagios/bin/nagios -v /etc/nagios/nagios.cfg

Checking contacts...
Error: Contact 'nagios' has no service notification commands defined!
Error: Contact 'nagios' has no host notification commands defined!

So I figure this is an issue with my contacts.cfg?

define contact 
  contact_name          nagios 
  alias             Nagios Admin 
  host_notification_period24x7 
  service_notification_period   24x7 
  service_notification_options  w,u,c,r 
  host_notification_options d,u,r email             
  nagios-admin@localhost 
  can_submit_commands       1

Or maybe my contactgroups.cfg?

define contactgroup
  contactgroup_name localadmins
  alias             Local Site Administrators
  members           nagios

Thanks for the help!

4 Answers 4

2

Did you copy all of the sample cfg files to start from?

You should have these two lines in either your contact or your contactgroup:

service_notification_commands notify-service-by-email
host_notification_commands notify-host-by-email

Also, they need to be defined as commands, which by default should be the sample commands.cfg

2

It Appears that you are missing several things.

First, Make sure that when you define a contact that it is defined propery ie..

define contact {                     
    contact_name                    INSERT_NAME_HERE;
    alias                           SOME_ALIAS_HERE;
    email                           EMAIL@EXAMPLE;
    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; send service notifications via email
    host_notification_commands      notify-host-by-email; send host notifications via email                  
    }

From your post, it appears that you are missing the { } that define the beginning and end of the contact. It looks like you are also missing exactly what the error message states. In my deployment, I use templates, in fact the generic templates in the templates file are a good starting point. When creating a contact you can reference these generic templates by calling it in your define statement like so:

define contact {
     contact_name                       INSERT_NAME_HERE;
     use                                generic-contact;
     alias                              SOME_ALLIAS_HERE;
     email                              EMAIL@EXAMPLE;
     }

Then your contact definition will inherit all the default values from the generic template.

Hope this helps.

1

You are missing the options service_notification_commands and host_notification_commands notify-host-by-email so nagios doesn't know what to do when it gets an alert.

You're also missing the email keyword before the email address

My nagios contact looks like this:

define contact {
        contact_name    george
        alias   george
        service_notification_period     24x7
        host_notification_period        24x7
        service_notification_options    w,u,c,r
        host_notification_options       d,r
        service_notification_commands   notify-service-by-email <-- Missing
        host_notification_commands      notify-host-by-email    <-- Missing
        email   [email protected]
}

This tells nagios to send an email to the account specified in the email option. in this case [email protected]

0

Its a old post, but sharing my input if anyone comes across the issue.
You can add the commands in UI under
CoreConfigManager->Contacts->(Select Contact)->Alert Settings.

Dont forget Apply Config after that. :)

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .