problem with nconf generated files

Everything else...
problem with nconf generated files

Post by zkn » Sun Apr 05, 2009 20:46


I've installed nagios for the first time today and I tried using NConf to edit the nagios configuration. My problem is that with the default configuration everything works fine for localhost in Nagios but

when I switch to using the NConf generated configuration I start getting errors like this for all commands:

[1238955615] Warning: Return code of 127 for check of service 'check_http' on host 'localhost' was out of bounds. Make sure the plugin you're trying to run actually exists.

Perhaps I'm doing something wrong but I don't know where to look at.


User avatar
NConf developer
NConf developer
Joined:Fri Mar 06, 2009 17:50
Location:Zurich, Switzerland

Re: problem with nconf generated files

Post by agargiulo » Mon Apr 06, 2009 09:43


Have a look at the generated checkcommands.cfg file. Make sure the paths are correct.
The data that comes with NConf is made to match the rpmforge distribution of Nagios. There might be differences to the Nagios package you have installed.

Let us know.



Re: problem with nconf generated files

Post by new_nconf_user » Wed Apr 08, 2009 18:14

I have the same identical problem, even with a fresh installation of nagios...

[nagios@XXXXXX etc]$ cat objects/commands.cfg |grep -A 2 check_http
# 'check_http' command definition
define command{
command_name check_http
command_line $USER1$/check_http -I $HOSTADDRESS$ $ARG1$

[nagios@XXXXXXX etc]$ cat global/checkcommands.cfg |grep -A 2 check_http
command_name check_http
command_line $USER1$/check_http -I $HOSTADDRESS$ $ARG1$

I don't see any difference..... I have downloaded and compiled nagios by myself, because there isn't any rpm for nagvis.
When I switch to nconf configuration files, with the two dir in the nagios main configuration file, Nagios seems not to find plugins anymore.
I looked for an error, but didn't find any more info..... :(
Will appreciate any help... thanks :)


Re: problem with nconf generated files (SOLVED)

Post by new_nconf_user » Fri Apr 10, 2009 10:44

Ok, it works.
It was wrong path of stale service command.
I solved it (quick and dirty, may be there is a nicer solution):

Code: Select all

[nagios@servertwo etc]$ mkdir /usr/local/nagios/libexec/eventhandlers
[nagios@servertwo etc]$ touch /usr/local/nagios/libexec/eventhandlers/

EDIT  /usr/local/nagios/libexec/eventhandlers/
I put in only the line:

[nagios@servertwo etc]$ chmod +x /usr/local/nagios/libexec/eventhandlers/
Then in misccommands->service_is_stale of nconf changed from:

Hope this helps someone.


Re: problem with nconf generated files

Post by Oleksandr » Wed May 13, 2009 18:40

Although my problem wasn't exactly the same, the behavior was. I put a copy of the nagios bin at the nconf/bin folder and it showed no errors after doing the check, yet when I copied the generated configuration to nagios' etc folder, there were a lot of errors.

This is my first time installing both nagios and nconf, and I went so much "by the book" that I ended up duplicating configuration without even knowing it. Nagios own doc walked me through setting up a first windows server and the localhost checks in its own config file structure ($nagios/etc/objects/*.cfg). What I still don't get is why would nconf run its own nagios bin and report no errors (which made me trust it and thus confused), and yet impersonating nagios user and running -v $nagios/etc/nagios.cfg behaved differently and did reveal the truth (luckily, or else I'd never noticed).

Reading nconf's doc I added the newly produced config folders $nagios/etc/Default_collector and $nagios/etc/global at the main nagios.cfg file..........although it never mentioned "...AND, comment out any other "cfg_dir" lines you find there so you can delegate the whole stuff to nconf alone... OR be prepared to manually trim the duplicates yourself".

Anyway, whenever you specify nconf's produced config files at nagios.cfg, be sure to leave out any other default config files you might have (their lines start with cfg_dir), which most likely are those installed by nagios the first time, and they have the very basic stuff, which nconf has as well, so you want to leave it all in nconf's hands from now on (or strip the basics out of nconf and leave them in nagios' own, but I personally went stonith for simplicity's sake).



Re: problem with nconf generated files

Post by alexmueller » Sat Jun 06, 2009 13:09

I have exactly the same problem.
Based upon a fresh installation with CentOS 5.3 and Nagios 3.0.6 from rpmforge repositories.

As soon as i switch to my own (simple) generated configuration all service checks show "(Return code of 127 is out of bounds - plugin may be missing)".

I checked $USER1$ path and all permissions down the path, tried running the plugins from cli as nagios user. No success.

Creating an empty /usr/lib/nagios/plugins/eventhandlers/ only helps so for, as the check as the status in the nagios gui shows green instead of red, but the check is not performed (no output in "Status Information" column).

Maybe this is solved in version 1.2.5.


Re: problem with nconf generated files

Post by alexmueller » Sat Jun 06, 2009 13:23

After further research i found the solution. It is a bug in version 1.2.4.

See viewtopic.php?f=3&t=13&st=0&sk=t&sd=a&s ... 9&start=10

The solution was to replace line 717 in bin/ with the following:

if($attr->[0] eq "check_command" && $path =~ /$monitor_path/ && $monitor_path){$attr->[1] = "service_is_stale"}