Web interface Error:Could not read object configuration data

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.
zander_2
Posts: 17
Joined: Mon Jul 29, 2013 3:55 pm

Re: Web interface Error:Could not read object configuration

Post by zander_2 »

I added the users to the Nagios group, and it didn't change anything. I did manage to work through the initial problem, so now I can see the services page. However, now I'm back to the same state I was on my first VM: the check_by_ssh service is getting the Error 127.
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

Re: Web interface Error:Could not read object configuration

Post by scottwilkerson »

lets post these permissions

Code: Select all

ls -ld /usr/local/nagios
ls -ld /usr/local/nagios/libexec
ls -l /usr/local/nagios/libexec/check_by_ssh
Former Nagios employee
Creator:
ahumandesign.com
enneagrams.com
zander_2
Posts: 17
Joined: Mon Jul 29, 2013 3:55 pm

Re: Web interface Error:Could not read object configuration

Post by zander_2 »

Well, sorry to take the whole discussion off track, but I messed something else up on the system and had to reinstall the OS. I got everything back to where it was, and this time even got the two machines to SSH without requiring a password. Running the check_by_ssh command manually works just fine, but when I try to run it automatically it says "(Return code of 255 is out of bounds)". Now, as for those permissions scottwilkerson was asking for:

Code: Select all

ls -ld /usr/local/nagios
ls -ld /usr/local/nagios/libexec
ls -l /usr/local/nagios/libexec/check_by_ssh
Outputs:

Code: Select all

drwxr-xr-x. 9 root root 4096 Aug  7 15:24 /usr/local/nagios
drwxrwxr-x. 3 nagios nagios 4096 Aug  7 16:30 /usr/local/nagios/libexec
-rwxr-xr-x. 1 nagios root 53328 Aug 17  2012 /usr/local/nagios/libexec/check_by_ssh
abrist
Red Shirt
Posts: 8334
Joined: Thu Nov 15, 2012 1:20 pm

Re: Web interface Error:Could not read object configuration

Post by abrist »

Can you post the working cli command and then the current command/check definitions?
Former Nagios employee
"It is turtles. All. The. Way. Down. . . .and maybe an elephant or two."
VI VI VI - The editor of the Beast!
Come to the Dark Side.
zander_2
Posts: 17
Joined: Mon Jul 29, 2013 3:55 pm

Re: Web interface Error:Could not read object configuration

Post by zander_2 »

abrist wrote:Can you post the working cli command and then the current command/check definitions?
What I'm trying to do is make nagios run the check_file_count service to see how many files are in a directory, and for now I'm just using "testfile" as the dir I'm searching. So, the working command would be this:

Code: Select all

/usr/local/nagios/libexec/check_by_ssh -H 192.168.10.92 -C "/usr/local/nagios/libexec/check_file_count  -t=file -s=no -wt=high -w 4 -c 5 -p=no /etc/testfile" -t 30 -E
The -t makes it timeout after 30 seconds (it tends to take a long time and it would time out before the command could execute, so I had to up it from the default) and the -E is supposed to be the "ignore STDERR" flag, but the command won't run without it and someone on Stackoverflow recommended to use it.

As for the command/check definitions, I did it in a bit of a funny way. I figured I would only be using this command once, so I just wrote the entire thing with all the arguments filled out into commands.cfg, then had just the make of the command in services.cfg. I'm not quite sure about the syntax of the $ARG's and such in the commands.cfg file, so I thought I would go deal with that once I got the damn thing working first. Here's the relevant portion of commands.cfg:

Code: Select all

# 'check_file_count' command definition
define command{
        command_name    check_file_count
        command_line    $USER1$/check_by_ssh -H 192.168.10.92 -C "/usr/local/nagios/libexec/check_file_count  -t=file -s=no -wt=high -w 4 -c 5 -p=no /etc/testfile" -t 30 -E
        }
And that of services.cfg:

Code: Select all

define service{

use                     generic-service

host_name               projectapps01

service_description     File count

check_command           check_file_count

}
Projectapps01 is the name of the machine I want the command to run on, of course, but the host_name variable in services.cfg doesn't seem to matter, because if I change it to nagiostest03 (the machine Nagios is running on) it still works just fine and checks the directory on projectapps01. The reason I didn't define the check_by_ssh command is because check_file_count already leads to the check_by_ssh file in the libexec dir. Again, weird way to do it, but I'm not entirely sure how to phrase the entry in commands.cfg

Any possibility that could be causing the problem? If so, how would I format the command in the config file?
abrist
Red Shirt
Posts: 8334
Joined: Thu Nov 15, 2012 1:20 pm

Re: Web interface Error:Could not read object configuration

Post by abrist »

What linux distro are you running?
Former Nagios employee
"It is turtles. All. The. Way. Down. . . .and maybe an elephant or two."
VI VI VI - The editor of the Beast!
Come to the Dark Side.
zander_2
Posts: 17
Joined: Mon Jul 29, 2013 3:55 pm

Re: Web interface Error:Could not read object configuration

Post by zander_2 »

abrist wrote:What linux distro are you running?
As I said earlier, CentOS 6.0.
abrist
Red Shirt
Posts: 8334
Joined: Thu Nov 15, 2012 1:20 pm

Re: Web interface Error:Could not read object configuration

Post by abrist »

zander_2 wrote:Any possibility that could be causing the problem?
I don't think so, your definitions look right.
zander_2 wrote:command_line $USER1$/check_by_ssh -H 192.168.10.92 -C "/usr/local/nagios/libexec/check_file_count -t=file -s=no -wt=high -w 4 -c 5 -p=no /etc/testfile" -t 30 -E
}
The above line is why the check always checks the same box: the hostname of the checked host is not passed to check_by_ssh. It is hardcoded to the IP.
Former Nagios employee
"It is turtles. All. The. Way. Down. . . .and maybe an elephant or two."
VI VI VI - The editor of the Beast!
Come to the Dark Side.
zander_2
Posts: 17
Joined: Mon Jul 29, 2013 3:55 pm

Re: Web interface Error:Could not read object configuration

Post by zander_2 »

Yeah, that makes sense. Still, nothing that could be causing the error. Anyone else have any input? I'd really like to get this fixed.
sreinhardt
-fno-stack-protector
Posts: 4366
Joined: Mon Nov 19, 2012 12:10 pm

Re: Web interface Error:Could not read object configuration

Post by sreinhardt »

When you are doing this via cli, are you running as root or the nagios user? You very possibly need to do this as the nagios user, or accept the ssh key as the nagios user via a manual ssh over first. Otherwise the plugin will just fail. However the 255 out of bounds is still a bit strange.
Nagios-Plugins maintainer exclusively, unless you have other C language bugs with open-source nagios projects, then I am happy to help! Please pm or use other communication to alert me to issues as I no longer track the forum.
Locked