Relations between .cfg files - problems in Learning Nagios 3.0

Whit Blauvelt whit+nagios at transpect.com
Sun Jun 21 21:47:03 CEST 2009


Hi all,

Due to my not taking to the style of the online docs (good for reference,
not so much for learning), got a copy of Kocjan's "Learning NAGIOS 3.0" -
well organized, good accessible writing style. Gave me a much clearer
picture of the theory. But the examples are partly broken.

First off, every single example of configuration code is like:

define host
{
   ...

Which of course fails validation, since 

define host {
   ... 

is required, at least in 3.0.6. Did his syntax used to work?

The next problem I'm hitting is this error:

# /opt/nagios/bin/nagios -v /etc/nagios/nagios.cfg

Nagios 3.0.6
Copyright (c) 1999-2008 Ethan Galstad (http://www.nagios.org)
Last Modified: 12-01-2008
License: GPL

Reading configuration data...

Error: Could not find any host matching 'ubuntu' (config file '/etc/nagios/services/default.cfg', starting on line 35)
...

Not sure what to fix here to make Nagios happy. My file layout is as recommended in the book:

cfg_dir=/etc/nagios/commands
cfg_dir=/etc/nagios/timeperiods
cfg_dir=/etc/nagios/contacts
cfg_dir=/etc/nagios/hosts
cfg_dir=/etc/nagios/services

in /etc/nagios/hosts/default.cfg:

define host {
    name                    generic-server
    check_command           check-host-alive
    check_interval          5
    retry_interval          1
    max_check_attempts      5
    check_period            24x7
    notification_interval   30
    notification_period     24x7
    notification_options    d,u,r
    register                0
}
...
define host {
    use                     generic-server
    name                    ubuntu
    alias                   ubuntu (scripts)
    address                 192.168.1.136
    contact_groups          linux-admins
}

in /etc/nagios/services/default.cfg:

define service {
    name                    generic-service
    check_interval          10
    retry_interval          2
    max_check_attempts      3
    check_period            24x7
    register                0
}
 
define service {
    name                    workinghours-service
    check_period            workinghours
    notification_interval   30
    notification_period     workinghours
    notification_options    w,c,u,r
    register                0
}
... 
define service {
    use                     workinghours-service,generic-service
    contact_groups          linux-admins
    host_name               ubuntu
    service_description     SSH
    check_command           check_ssh
}

All of this is cribbed closely from the book - trying to get the examples
running. So there a "define host" statement that names a host "ubuntu". It's
in a configuration file in a directory listed above the directory with the
service configurations. But it's not being found, according to verification.
What's needed to have Nagios find it and pass verification here?

Thanks,
Whit

------------------------------------------------------------------------------
Are you an open source citizen? Join us for the Open Source Bridge conference!
Portland, OR, June 17-19. Two days of sessions, one day of unconference: $250.
Need another reason to go? 24-hour hacker lounge. Register today!
http://ad.doubleclick.net/clk;215844324;13503038;v?http://opensourcebridge.org
_______________________________________________
Nagios-users mailing list
Nagios-users at lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nagios-users
::: Please include Nagios version, plugin version (-v) and OS when reporting any issue. 
::: Messages without supporting info will risk being sent to /dev/null





More information about the Users mailing list