Whoops! Error: Could not read object configuration data!


#1

I am trying to srtup nagios. I ran check and no warnings or errors. I started nagios but cannot access any of the cgi links

Here is the error

Error: Could not read object configuration data!
]
help


#2

permission problems in the configuration files?
what user are you logging in?

did you follow the steps in the docs for setting up the interface?

Luca


#3

I have the same problem, but, i have problem already starting nagios, bcause I get this error.
Executing /etc/rc.d/init.d/nagios restart …

Running configuration check… FAILED! Restart aborted. Check your Nagios configuration.


#4

You might get more insight into why Nagios fails to start by running

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

See what the configuration check turns up. That should get you started. We’ll worry about your object configuration errors once we can actually get Nagios running.


#5

when I run that I get
Usage: nagios {start|stop|restart|reload|force-reload|status}

I have fedora core3 and a path is a little differend.
/etc/rc.d/init.d/nagios -v /etc/nagios/nagios.cfg


#6

that is a startup script not the nagios executable.
check in the nagios install dir an then in the bin subdirectory.

Luca


#7

I have downloaded a rpm file from the nagios site in install it, and a plugins too, but when I restart nagios I get this error

Executing /etc/rc.d/init.d/nagios restart …

Running configuration check… FAILED! Restart aborted. Check your Nagios configuration.

Should I use tar file?


#8

It’s always best to install Nagios from source. The RPM install is pretty messy. It’s like dipping a paintbrush in a can of paint and flinging it at a wall. Bits of paint go everywhere. No fun. The source install keeps it all nice and neat in one location.

Btw, I’ve got two Nagios boxes, one running FC3 and the other on FC4, so I know how your default install should look.


#9

I did install nagios from tar, but the result is the same.
I did configure what I think I should, but doesn’t work.
I have been missing something but don’t know what.


#10

When you configured Nagios, what prefix did you define?


#11

So now you have both the rpm install and the source install? Getting kinda messy isn’t it?

I can see exactly what you are missing.
The docs.
nagios.sourceforge.net/docs/2_0/toc.html

You missed the best part of the docs.
nagios.sourceforge.net/docs/2_0/ … onfig.html

If you have no errors, and you did read and follow the docs, then double/triple check everything. Your file permissions are wrong, or some little simple thing like that.


#12

I don’t know what you mean with perfix?

No I don’t have both instalations, I did uninstall the RPMs and then install the TAR version


#13

he means, type
./conrigure --help
it will show you all the options available to configure.
One of them is
–prefix
which you should leave as the default setting of /usr/local/nagios


#14

I did leave all default, but is still the same

Executing /etc/rc.d/init.d/nagios restart …

Running configuration check… FAILED! Restart aborted. Check your Nagios configuration.


#15

Hey guys :slight_smile: Don’t get mixed up in the TS’s confusion. He still hasn’t understood your original point of validating the configuration.

@Blisk:
We still need you to validate your configuration using the Nagios executable. This is what SonOfThunder was refering to earlier. When he said:

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

He was referring to the real Nagios binary and -not- the /etc/init.d start script. So please run that instead. If the path to either file is incorrect we can help you find out what they should be (which I believe SOT is currently attempting).

The command above will let Nagios do a dry-run test of your configuration files. This will point out any errors that are present in your config, allowing you to fix them before you restart Nagios.


#16

File /usr/local/bin/nagios wasn’t there so i copied it from /user/local/nagios/bin/nagios
but ether way get the same error

when I run
/usr/local/bin/nagios -v -c /usr/local/nagios/etc/nagios.cfg

I get this
[root@jhj /]# /usr/local/nagios/bin/nagios -v -c /usr/local/nagios/etc/nagios.cfg
/usr/local/nagios/bin/nagios: invalid option – c

Nagios 2.0
Copyright © 1999-2006 Ethan Galstad (nagios.org)
Last Modified: 02-07-2006
License: GPL

Usage: /usr/local/nagios/bin/nagios [option] <main_config_file>

Options:

-v Reads all data in the configuration files and performs a basic
verification/sanity check. Always make sure you verify your
config data before (re)starting Nagios.

-s Shows projected/recommended check scheduling information based
on the current data in the configuration files.

-d Starts Nagios in daemon mode (instead of as a foreground process).
This is the recommended way of starting Nagios for normal operation.

Visit the Nagios website at nagios.org for bug fixes, new
releases, online documentation, FAQs, information on subscribing to
the mailing lists, and commercial and contract support for Nagios.


If i do withouth -c option i get this

[root@jhj /]# /usr/local/bin/nagios -v /usr/local/nagios/etc/nagios.cfg
Nagios 2.0
Copyright © 1999-2006 Ethan Galstad (nagios.org)
Last Modified: 02-07-2006
License: GPL

Reading configuration data…

Error: Command ‘check-host-alive’ has already been defined
Error: Could not register command (config file ‘/usr/local/nagios/etc/minimal.cfg’, starting on line 76)

***> One or more problems was encountered while processing the config files…

 Check your configuration file(s) to ensure that they contain valid
 directives and data defintions.  If you are upgrading from a previous
 version of Nagios, you should be aware that some variables/definitions
 may have been removed or modified in this version.  Make sure to read
 the HTML documentation regarding the config files, as well as the
 'Whats New' section to find out what has changed.

#17

Please don’t mess up your source install by moving your files around. The person above your post, had a rpm install or something, that is why he had the odd /usr/local/bin/nagios binary location.
So ignore that please and clean up what you changed.

I’m not sure who or why the -c option ever got into this discussion. I’ve never seen or used that option. Anyway, your config check via the -v option has shown a problem with dual definitions, so please resolve that issue.

This is the error you got “Error: Command ‘check-host-alive’ has already been defined
Error: Could not register command (config file ‘/usr/local/nagios/etc/minimal.cfg’, starting on line 76)” So, on line 76 chechhostalive is defined, and it’s also defined someplace else.

You must be installing nagios from source and it’s Version 2.x, so do yourself a favore and read the entire thread below.
meulie.net/portal_plugins/fo … c.php?6194

The above points out several items of trouble you might have with 2.x

Don’t use the minimal.cfg or the bigger. Start from scratch by reading the -sample.cfg files that are installed in /usr/loca/nagios/etc

In your nagios.cfg you will see the below, and make sure you comment out the minimal.cfg line. These statements tell nagios what all the .cfg files are going to be named.
#cfg_file=/usr/local/nagios/etc/minimal.cfg

cfg_file=/usr/local/nagios/etc/contactgroups.cfg
cfg_file=/usr/local/nagios/etc/contacts.cfg
cfg_file=/usr/local/nagios/etc/dependencies.cfg
cfg_file=/usr/local/nagios/etc/escalations.cfg
cfg_file=/usr/local/nagios/etc/hostgroups.cfg
cfg_file=/usr/local/nagios/etc/servicegroups.cfg
cfg_file=/usr/local/nagios/etc/hosts.cfg
cfg_file=/usr/local/nagios/etc/services.cfg
cfg_file=/usr/local/nagios/etc/timeperiods.cfg

Lastly, follow the install docs from start to finish, and also pay attention to my thread about doc/problems with 2.x


#18

I have this error when I verifying cfg file.
I try to comment out the lines with problems but that didn’t help!

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

Nagios 2.0
Copyright © 1999-2006 Ethan Galstad (nagios.org)
Last Modified: 02-07-2006
License: GPL

Reading configuration data…

Error: Command ‘check-host-alive’ has already been defined
Error: Could not register command (config file ‘/usr/local/nagios/etc/minimal.cfg’, starting on line 76)

***> One or more problems was encountered while processing the config files…

 Check your configuration file(s) to ensure that they contain valid
 directives and data defintions.  If you are upgrading from a previous
 version of Nagios, you should be aware that some variables/definitions
 may have been removed or modified in this version.  Make sure to read
 the HTML documentation regarding the config files, as well as the
 'Whats New' section to find out what has changed.