Page 3 of 4

Re: Error: Could not read object configuration data!

Posted: Thu Feb 14, 2013 11:08 am
by ukzerosniper
I searched in my nagios.cfg file and could not find anywhere "nagios-admin". I didnt include the "" :).

Re: Error: Could not read object configuration data!

Posted: Thu Feb 14, 2013 11:52 am
by slansing
Whoops my mistake I looked at that backwards and am now going to use the "I need more caffeine" excuse. Check your commands.cfg file, usually located in:

Code: Select all

/usr/local/nagios/etc/commands.cfg
Make sure that you have the following defined:

Code: Select all

define command {
       command_name                             notify-host-by-email
       command_line                             /usr/bin/printf "%b" "***** Nagios Monitor XI Alert *****\n\nNotification Type: $NOTIFICATIONTYPE$\nHost: $HOSTNAME$\nState: $HOSTSTATE$\nAddress: $HOSTADDRESS$\nInfo: $HOSTOUTPUT$\n\nDate/Time: $LONGDATETIME$\n" | /bin/mail -s "** $NOTIFICATIONTYPE$ Host Alert: $HOSTNAME$ is $HOSTSTATE$ **" $CONTACTEMAIL$
}

define command {
       command_name                             notify-service-by-email
       command_line                             /usr/bin/printf "%b" "***** Nagios Monitor XI Alert *****\n\nNotification Type: $NOTIFICATIONTYPE$\n\nService: $SERVICEDESC$\nHost: $HOSTALIAS$\nAddress: $HOSTADDRESS$\nState: $SERVICESTATE$\n\nDate/Time: $LONGDATETIME$\n\nAdditional Info:\n\n$SERVICEOUTPUT$" | /bin/mail -s "** $NOTIFICATIONTYPE$ Service Alert: $HOSTALIAS$/$SERVICEDESC$ is $SERVICESTATE$ **" $CONTACTEMAIL$
}

Re: Error: Could not read object configuration data!

Posted: Thu Feb 14, 2013 12:02 pm
by ukzerosniper
Hi,

Mine is located at

Code: Select all

/etc/nagios/objects/commands.cfg
and is configured as follows.

Code: Select all

# 'notify-host-by-email' command definition
define command{
	command_name	notify-host-by-email
	command_line	/usr/bin/printf "%b" "***** Nagios *****\n\nNotification Type: $NOTIFICATIONTYPE$\nHost: $HOSTNAME$\nState: $HOSTSTATE$\nAddress: $HOSTADDRESS$\nInfo: $HOSTOUTPUT$\n\nDate/Time: $LONGDATETIME$\n" | /bin/mail -s "** $NOTIFICATIONTYPE$ Host Alert: $HOSTNAME$ is $HOSTSTATE$ **" $CONTACTEMAIL$
	}

# 'notify-service-by-email' command definition
define command{
	command_name	notify-service-by-email
	command_line	/usr/bin/printf "%b" "***** Nagios *****\n\nNotification Type: $NOTIFICATIONTYPE$\n\nService: $SERVICEDESC$\nHost: $HOSTALIAS$\nAddress: $HOSTADDRESS$\nState: $SERVICESTATE$\n\nDate/Time: $LONGDATETIME$\n\nAdditional Info:\n\n$SERVICEOUTPUT$\n" | /bin/mail -s "** $NOTIFICATIONTYPE$ Service Alert: $HOSTALIAS$/$SERVICEDESC$ is $SERVICESTATE$ **" $CONTACTEMAIL$
	}

Does that all look ok to you?

Re: Error: Could not read object configuration data!

Posted: Thu Feb 14, 2013 12:37 pm
by abrist
It does not look like your commands.cfg file is included in your nagios.cfg file. You will have to uncomment or add some cfg_file directives to the object config file section of nagios.cfg. For example, /etc/nagios/objects/commands.cfg is not defined in your nagios.cfg, so you will want to add the line:

Code: Select all

cfg_file=/etc/nagios/objects/commands.cfg
There seems to be a bunch of inconsistencies with your nagios.cfg compared to the cfg files on your system. The following cfg files are declared:

Code: Select all

cfg_file=/etc/nagios/checkcommands.cfg
cfg_file=/etc/nagios/misccommands.cfg
cfg_file=/etc/nagios/minimal.cfg
And the following cfg files are commented out:

Code: Select all

#cfg_file=/etc/nagios/contactgroups.cfg
#cfg_file=/etc/nagios/contacts.cfg
#cfg_file=/etc/nagios/dependencies.cfg
#cfg_file=/etc/nagios/escalations.cfg
#cfg_file=/etc/nagios/hostgroups.cfg
#cfg_file=/etc/nagios/hosts.cfg
#cfg_file=/etc/nagios/services.cfg
#cfg_file=/etc/nagios/timeperiods.cfg
#cfg_file=/etc/nagios/hostextinfo.cfg
#cfg_file=/etc/nagios/serviceextinfo.cfg
#cfg_dir=/etc/nagios/servers
#cfg_dir=/etc/nagios/printers
#cfg_dir=/etc/nagios/switches
#cfg_dir=/etc/nagios/routers
Could you post a listing of the following directories?

Code: Select all

ls -la /etc/nagios
ls -la /etc/nagios/objects

Re: Error: Could not read object configuration data!

Posted: Thu Feb 14, 2013 1:10 pm
by ukzerosniper
Sure thing.

Code: Select all

# ls -la /etc/nagios
total 156
drwxr-xr-x.  3 root   root    4096 Feb 14 16:56 .
drwxr-xr-x. 69 root   root    4096 Feb  4 16:22 ..
-rw-rw-r--.  1 nagios nagios  9506 Oct 20 20:50 cgi.cfg
-rw-r--r--.  1 root   root    4816 Oct 20 20:50 checkcommands.cfg
-rw-r--r--.  1 root   root   15860 Nov 26  2010 command-plugins.cfg
-rw-r--r--.  1 root   root      26 Oct 20 20:50 htpasswd.users
-rw-r--r--.  1 root   root   11330 Oct 20 20:50 minimal.cfg
-rwxrwxrwx   1 root   root    1568 Feb 14 09:02 misccommands.cfg
-rw-rw-r--.  1 nagios nagios 30519 Oct 20 20:50 nagios.cfg
-rw-rw-r--   1 root   root   30521 Feb 14 08:51 nagios.cfg.test
-rw-r--r--.  1 root   root    7207 Nov 11  2010 nrpe.cfg
-rw-r--r--.  1 root   root    5326 Nov 12  2010 nsca.cfg
drwxr-xr-x.  2 nagios nagios  4096 Oct 20 20:47 objects
-rw-r--r--   1 root   root       0 Feb 14 08:53 One
-rw-rw----.  1 nagios nagios  1340 Nov 26  2010 resource.cfg
-rw-r--r--.  1 root   root    1628 Nov 12  2010 send_nsca.cfg
# ls -la /etc/nagios/objects
total 56
drwxr-xr-x. 2 nagios nagios  4096 Oct 20 20:47 .
drwxr-xr-x. 3 root   root    4096 Feb 14 16:56 ..
-rw-rw-r--. 1 nagios nagios  7696 Nov 26  2010 commands.cfg
-rw-rw-r--. 1 nagios nagios  2166 Nov 26  2010 contacts.cfg
-rw-rw-r--. 1 nagios nagios  5403 Nov 26  2010 localhost.cfg
-rw-rw-r--. 1 nagios nagios  3124 Nov 26  2010 printer.cfg
-rw-rw-r--. 1 nagios nagios  3293 Nov 26  2010 switch.cfg
-rw-rw-r--. 1 nagios nagios 10812 Nov 26  2010 templates.cfg
-rw-rw-r--. 1 nagios nagios  3209 Nov 26  2010 timeperiods.cfg
-rw-rw-r--. 1 nagios nagios  4019 Nov 26  2010 windows.cfg


Re: Error: Could not read object configuration data!

Posted: Thu Feb 14, 2013 2:46 pm
by scottwilkerson

Code: Select all

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

Re: Error: Could not read object configuration data!

Posted: Thu Feb 14, 2013 2:49 pm
by ukzerosniper
That produces the following

Code: Select all

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

Nagios Core 3.2.3
Copyright (c) 2009-2010 Nagios Core Development Team and Community Contributors
Copyright (c) 1999-2009 Ethan Galstad
Last Modified: 10-03-2010
License: GPL

Website: http://www.nagios.org
Reading configuration data...
Warning: comment_file variable ignored.  Comments are now stored in the status a                                                 nd retention files.
Warning: downtime_file variable ignored.  Downtime entries are now stored in the                                                  status and retention files.
Warning: aggregate_status_updates directive ignored.  All status file updates ar                                                 e now aggregated.
   Read main config file okay...
Processing object config file '/etc/nagios/checkcommands.cfg'...
Processing object config file '/etc/nagios/misccommands.cfg'...
Processing object config file '/etc/nagios/minimal.cfg'...
   Read object config files okay...

Running pre-flight check on configuration data...

Checking services...
        Checked 5 services.
Checking hosts...
        Checked 1 hosts.
Checking host groups...
        Checked 1 host groups.
Checking service groups...
        Checked 0 service groups.
Checking contacts...
        Checked 1 contacts.
Checking contact groups...
        Checked 1 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 20 commands.
Checking time periods...
        Checked 1 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:   0

Things look okay - No serious problems were detected during the pre-flight check

Re: Error: Could not read object configuration data!

Posted: Thu Feb 14, 2013 3:22 pm
by abrist
Looks like you are set to start configuring hosts/services and fire up the web interface.

Re: Error: Could not read object configuration data!

Posted: Thu Feb 14, 2013 3:44 pm
by ukzerosniper
Lol, thanks for the help so far,

I am still getting this message :?

Code: Select all

Whoops!

Error: Could not read object configuration data!

Here are some things you should check in order to resolve this error:

Verify configuration options using the -v command-line option to check for errors.
Check the Nagios log file for messages relating to startup or status data errors.
Make sure you read the documentation on installing, configuring and running Nagios thoroughly before continuing. If all else fails, try sending a message to one of the mailing lists. More information can be found at http://www.nagios.org.

Re: Error: Could not read object configuration data!

Posted: Thu Feb 14, 2013 4:11 pm
by abrist
Nagios might have a problem finding the correct cfg file to use. How are you starting the nagios process?