Page 2 of 4
Re: Web interface Error:Could not read object configuration
Posted: Wed Aug 07, 2013 7:49 am
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.
Re: Web interface Error:Could not read object configuration
Posted: Wed Aug 07, 2013 9:12 am
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
Re: Web interface Error:Could not read object configuration
Posted: Mon Aug 12, 2013 9:51 am
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
Re: Web interface Error:Could not read object configuration
Posted: Mon Aug 12, 2013 10:15 am
by abrist
Can you post the working cli command and then the current command/check definitions?
Re: Web interface Error:Could not read object configuration
Posted: Mon Aug 12, 2013 10:46 am
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?
Re: Web interface Error:Could not read object configuration
Posted: Mon Aug 12, 2013 4:50 pm
by abrist
What linux distro are you running?
Re: Web interface Error:Could not read object configuration
Posted: Tue Aug 13, 2013 8:08 am
by zander_2
abrist wrote:What linux distro are you running?
As I said earlier, CentOS 6.0.
Re: Web interface Error:Could not read object configuration
Posted: Tue Aug 13, 2013 1:07 pm
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.
Re: Web interface Error:Could not read object configuration
Posted: Tue Aug 13, 2013 3:47 pm
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.
Re: Web interface Error:Could not read object configuration
Posted: Tue Aug 13, 2013 4:24 pm
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.