Trouble with initial configuration...

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
fpruitt
Posts: 2
Joined: Fri Oct 07, 2011 8:07 pm

Trouble with initial configuration...

Post by fpruitt »

Hey guys,

I'm having trouble with the initial configuration of nagios. I'm working on getting it running on a fairly large cluster of HPC's, but I'm trying it out on a single node right now.
Before you guys jump all over me, I do realize that the error messages in Nagios are FANTASTIC compared to, well, the vast majority of open source software, but I've rewritten all of my object definitions logically connected to this from the bottom up and can't really figure it out. Here's the dump after I run the nagios -v /etc/nagios/nagios.cfg command:

Code: Select all

Nagios Core 3.3.1                                                                                                                                                     
Copyright (c) 2009-2011 Nagios Core Development Team and Community Contributors                                                                                       
Copyright (c) 1999-2009 Ethan Galstad                                                                                                                                 
Last Modified: 07-25-2011                                                                                                                                             
License: GPL                                                                                                                                                          
                                                                                                                                                                      
Website: http://www.nagios.org                                                                                                                                        
Reading configuration data...                                                                                                                                         
   Read main config file okay...                                                                                                                                      
Processing object config directory '/etc/nagios/mysite'...                                                                                                            
Processing object config directory '/etc/nagios/mysite/windows'...                                                                                                    
Processing object config directory '/etc/nagios/mysite/windows/hosts'...                                                                                              
Processing object config directory '/etc/nagios/mysite/windows/services'...                                                                                           
Processing object config directory '/etc/nagios/mysite/linux'...                                                                                                      
Processing object config directory '/etc/nagios/mysite/linux/hosts'...                                                                                                
Processing object config file '/etc/nagios/mysite/linux/hosts/bigfrog0102.cfg'...
Processing object config directory '/etc/nagios/mysite/linux/hosts/hostgroups'...
Processing object config file '/etc/nagios/mysite/linux/hosts/hostgroups/bigfrog.cfg'...
Processing object config directory '/etc/nagios/mysite/linux/services'...
Processing object config file '/etc/nagios/mysite/linux/services/ping.cfg'...
Processing object config directory '/etc/nagios/mysite/switch'...
Processing object config directory '/etc/nagios/mysite/switch/hosts'...
Processing object config directory '/etc/nagios/mysite/switch/services'...
Processing object config file '/etc/nagios/mysite/switch.cfg'...
Processing object config file '/etc/nagios/mysite/windows.cfg'...
Processing object config file '/etc/nagios/mysite/timeperiods.cfg'...
Processing object config file '/etc/nagios/mysite/templates.cfg'...
Processing object config file '/etc/nagios/mysite/contacts.cfg'...
Processing object config file '/etc/nagios/mysite/localhost.cfg'...
Processing object config file '/etc/nagios/mysite/commands.cfg'...
Processing object config file '/etc/nagios/mysite/printer.cfg'...
   Read object config files okay...

Running pre-flight check on configuration data...

Checking services...
        Checked 22 services.
Checking hosts...
        Checked 5 hosts.
Checking host groups...
        Checked 5 host groups.
Checking service groups...
        Checked 0 service groups.
Checking contacts...
Error: Contact 'fpruitt' has no service notification commands defined!
Error: Contact 'fpruitt' has no host notification commands defined!
Error: Contact 'wedmondson' has no service notification commands defined!
Error: Contact 'wedmondson' has no host notification commands defined!
        Checked 2 contacts.
Checking contact groups...
        Checked 2 contact groups.
Checking service escalations...
        Checked 0 service escalations.
Checking service dependencies...
        Checked 0 service dependencies.
Checking host escalations...
        Checked 0 host escalations.
Checking host dependencies...
        Checked 0 host dependencies.
Checking commands...
        Checked 24 commands.
Checking time periods...
        Checked 5 time periods.
Checking for circular paths between hosts...
Checking for circular host and service dependencies...
Checking global event handlers...
Checking obsessive compulsive processor commands...
Checking misc settings...

Total Warnings: 0
Total Errors:   4

***> One or more problems was encountered while running the pre-flight check...

[nagios@nagios nagios]$ tree
.
├── cgi.cfg
├── htpasswd.users
├── localhost.cfg
├── mysite
│   ├── commands.cfg
│   ├── contacts.cfg
│   ├── linux
│   │   ├── hosts
│   │   │   ├── bigfrog0102.cfg
│   │   │   └── hostgroups
│   │   │       └── bigfrog.cfg
│   │   └── services
│   │       └── ping.cfg
│   ├── localhost.cfg
│   ├── printer.cfg
│   ├── switch
│   │   ├── hosts
│   │   └── services
│   ├── switch.cfg
│   ├── templates.cfg
│   ├── timeperiods.cfg
│   ├── windows
│   │   ├── hosts
│   │   └── services
│   └── windows.cfg
├── nagios.cfg
└── resource.cfg
The contact.cfg file (some info edited out):

Code: Select all

define contact{
        contact_name                    fpruitt                 ; Short name of user
        alias                                   xxx
        host_notifications_enabled      1
        service_notifications_enabled   1
        host_notification_period        24x7
        service_notification_period     24x7
        service_notification_options    w,u,c,r
        host_notification_options       d,u,r
        email                           forrest@xxx
        can_submit_commands             1
        }
define contact{
        contact_name                    wedmondson                 ; Short name of user
        alias                                 xxx                               ; Full name of user
        host_notification_period        workhours
        service_notification_period     workhours
        service_notification_options    w,u,c,r
        host_notification_options       d,u,r
        email                           wedmondson@xxxxx
        can_submit_commands             1
        }
The commands.cfg file:

Code: Select all

# 'process-host-perfdata' command definition
define command{
        command_name    process-host-perfdata
        command_line    /usr/bin/printf "%b" "$LASTHOSTCHECK$\t$HOSTNAME$\t$HOSTSTATE$\t$HOSTATTEMPT$\t$HOSTSTATETYPE$\t$HOSTEXECUTIONTIME$\t$HOSTOUTPUT$\t$HOSTPERFDATA$\n" >> /var/nagios/host-perfdata.out
        }


# 'process-service-perfdata' command definition
define command{
        command_name    process-service-perfdata
        command_line    /usr/bin/printf "%b" "$LASTSERVICECHECK$\t$HOSTNAME$\t$SERVICEDESC$\t$SERVICESTATE$\t$SERVICEATTEMPT$\t$SERVICESTATETYPE$\t$SERVICEEXECUTIONTIME$\t$SERVICELATENCY$\t$SERVICEOUTPUT$\t$SERVICEPERFDATA$\n" >> /var/nagios/service-perfdata.out
        }
A host configuration, bigfrog0102.cfg :

Code: Select all

define host{
   host_name              bigfrog0102
   hostgroups             bigfrog
   alias                  bigfrog0102
   address                172.16.151.2
   max_check_attempts     3
   check_period           24x7
   contact_groups         localadmins
   notification_interval  120
   notification_period    24x7
   notification_options   d,u,r
#  parents                switch
}
And finally, the contact group definition:

Code: Select all

define contactgroup{
        contactgroup_name       localadmins
        alias                   Nagios Administrators
        members                 fpruitt, wedmondson
        }

Am I missing something completely obvious?
Thanks for your time,

-fpruitt
Last edited by fpruitt on Sat Oct 08, 2011 7:21 pm, edited 1 time in total.
crfriend
Posts: 61
Joined: Thu Sep 01, 2011 7:53 am
Location: Central New England (USA)
Contact:

Re: Trouble with initial configuration...

Post by crfriend »

fpruitt wrote:I'm having trouble with the initial configuration of nagios. I'm working on getting it running on a fairly large cluster of HPC's, but I'm trying it out on a single node right now.
Getting the initial config working is always the hard part. Been there, done that, lost some hair over it.

The errors you're seeing, specifically:

Code: Select all

Error: Contact 'fpruitt' has no service notification commands defined!
Error: Contact 'fpruitt' has no host notification commands defined!
call out the problem explicitly -- you're missing the "host_notification_commands" and "service_notification_commands" declarations from your contact definition. Those lines, which are required for each contact, link to the command_name that you should have in your "commands.cfg" file for sending notifications. (Note: you can use inheritance to specify those commands via the "use" declaration in each contact definition and point that declaration to your template.)
fpruitt
Posts: 2
Joined: Fri Oct 07, 2011 8:07 pm

Re: Trouble with initial configuration...

Post by fpruitt »

Thanks so much, after a bit of tinkering with this I got it!
Locked