Nagios Bug: ignoring waitpid() return value

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.
Locked
archie
Posts: 2
Joined: Thu Dec 13, 2012 4:17 pm

Nagios Bug: ignoring waitpid() return value

Post by archie »

I am seeing this occasional error:

Code: Select all

(Return code of 127 is out of bounds - plugin may be missing)
No, Nagios, the plugin is not missing!

But what is the problem? It's impossible to tell because Nagios is ignoring the return value from the waitpid() system call. Until the waitpid() return value has verified not to be equal to -1, it's not appropriate to even look at the process exit value.

If you look at the Nagios code (I downloaded version 3.4.3), in every occurrence where waitpid() is invoked, the return value is ignored.

Please fix this so we can better understand what is going on in these cases.

Thanks.
sreinhardt
-fno-stack-protector
Posts: 4366
Joined: Mon Nov 19, 2012 12:10 pm

Re: Nagios Bug: ignoring waitpid() return value

Post by sreinhardt »

Could you provide an example of a plugin that this seems to be an issue with please?
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.
archie
Posts: 2
Joined: Thu Dec 13, 2012 4:17 pm

Re: Nagios Bug: ignoring waitpid() return value

Post by archie »

This is happening with check_by_ssh.

I also just noticed this comment in the pclose() man page (Linux):
Failure to execute the shell is indistinguishable from the shell's failure to execute command, or an immediate exit of the command. The only hint is an exit status of 127.
It may very well be the case that the 127 error code is originating from pclose(), not waitpid(), in which case fixing my complaint is not going to do anything (but it's still good practice to always check error values of course!)
slansing
Posts: 7698
Joined: Mon Apr 23, 2012 4:28 pm
Location: Travelling through time and space...

Re: Nagios Bug: ignoring waitpid() return value

Post by slansing »

This may be very simple but it is something to cover, do you have execute privileges for the Nagios user on that check? Can you post the full command you are using to run this?
Locked