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

Christian Kujau lists at nerdbynature.de
Sat Oct 18 21:32:28 UTC 2014

Package: nagios-plugins-basic
Version: 1.4.16-1
Severity: normal
File: /usr/lib/nagios/plugins/check_swap

Somehow swap was disabled on that machine, but no Nagios alarm was triggered:

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

When I executed check_swap locally, it returned CRITICAL, as expected:

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

When attaching strace(1) to the nrpe process, the following can be seen:

> 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". I've seen this commit in the upstream repo:

> https://github.com/nagios-plugins/nagios-plugins/commit/bf5bb6b59f820daf08bd2e0c1187628d11de9097
> Added check for total_swap_mb == 0, and if present, sets used to 100% and
> changes status output in this case for readability

....which made it into the 2.0 release as well:

> https://nagios-plugins.org/nagios-plugins-2-0-released/
> check_swap – Now fails with 100% usage and a new status output
> when swap is disabled or missing (abrist)

So, while nagios-plugins-basic 2.1-1 is in unstable, can this be fixed in
stable as well?


-- System Information:
Debian Release: 7.6
  APT prefers stable
  APT policy: (990, 'stable'), (500, 'stable-updates')
Architecture: powerpc (ppc)

Kernel: Linux 3.17.0
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash

Versions of packages nagios-plugins-basic depends on:
ii  iputils-ping           3:20101006-1+b1
ii  libc6                  2.13-38+deb7u4
ii  libssl1.0.0            1.0.1e-2+deb7u12
ii  nagios-plugins-common  1.4.16-1
ii  procps                 1:3.3.3-3
ii  ucf                    3.0025+nmu3

nagios-plugins-basic recommends no packages.

Versions of packages nagios-plugins-basic suggests:
pn  nagios3 | icinga  <none>

-- no debconf information

More information about the Pkg-nagios-devel mailing list