[Pkg-nagios-devel] Bug#765879: Bug#765879: check_swap reports SWAP OK when queried via nrpe and swap is disabled

Christian Kujau lists at nerdbynature.de
Mon Oct 20 22:49:08 UTC 2014


On Mon, 20 Oct 2014 at 15:34, Jan Wagner wrote:
> >> execve("/bin/sh", ["sh", "-c",
> >> "/usr/lib/nagios/plugins/check_swap -w 20% -c 10%"], [/* 6 vars
> >> */]) = 0 open("/proc/meminfo", O_RDONLY|O_LARGEFILE) = 3 write(1,
> >> "SWAP OK - 100% free (0 MB out of 0 MB) |swap=0MB;0;0;0;0\n", 57)
> >> = 57
> > 
> > So, for some reason check_swap returns "SWAP OK" when it should
> > return "SWAP CRITICAL".
> 
> Which is unrelated to the plugin from my point of view.

I don't understand, why is this unrelated? I would expect the plugin to 
report "SWAP CRITICAL", even when queried via NRPE.

I've just installed nagios-nrpe-server & nagios-plugins-basic on a test VM 
with Debian/wheezy and tried to reproduce this issue (reports OK via nrpe, 
reports CRITICAL when queried directly) but here check_swap reports always 
"OK" when swap is disabled, no matter if queried directly or via nrpe. 
Again, not what one would expect.

$ /usr/lib/nagios/plugins/check_swap -w 20% -c 10%; echo $?
SWAP OK - 100% free (0 MB out of 0 MB) |swap=0MB;0;0;0;0
0

$ /usr/lib/nagios/plugins/check_nrpe -H localhost -p 5666 -c check_swap; echo $?
SWAP OK - 100% free (0 MB out of 0 MB) |swap=0MB;0;0;0;0
0

> This is not the upstream repository, but it`s
> https://github.com/monitoring-plugins/monitoring-plugins.

Ah, OK. nagios-plugins-basic lists http://nagiosplug.sourceforge.net as 
its homepage which now redirects to https://nagios-plugins.org/ and cites 
https://github.com/nagios-plugins/repositories as its Github repo.

> Anyhow, it`s very unlikely that we push such a minor change (just
> fixing the output message, not the state nor return code) into a
> stable release.

This makes it sound like a cosmetic issue, but it's not: check_swap is 
report "SWAP OK" (exitcode 0) when swap is disabled while it should report 
"CRITICAL" and a return code of 2.

But yeah, the backports version fixes this issue.

Christian.



More information about the Pkg-nagios-devel mailing list