[Nagiosplug-devel] [PATCH 1/1] Prevent check_swap from returning OK, if no swap activated

Thomas Guyot-Sionnest dermoth at aei.ca
Mon Apr 4 07:53:27 CEST 2011


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 11-04-03 03:17 AM, Peter Lemenkov wrote:
> From: Jan ONDREJ <ondrejj at salstar.sk>
> 
> My swap was not activated on boot for unknown reason and nagios does not
> report this as a problem. Here is an example:
> 
> [root at kecom ~]# rpm -q nagios-plugins
> nagios-plugins-1.4.13-11.fc10.i386
> [root at kecom ~]# /usr/lib/nagios/plugins/check_swap -w 80% -c 40% -c 1 -w 2
> SWAP CRITICAL - 100% free (0 MB out of 0 MB) |swap=0MB;0;0;0;0
> 
> If there is no swap and users is trying to test percentage of free swap,
> consider 0 MB free swap space as problem, or of free/total raises division
> by zero, then set percentage to 0%, not to 100%.
> 
> Steps to Reproduce:
> 1. make sure, your swap is empty or it's usage is not large
> 2. swapoff -a
> 3. /usr/lib/nagios/plugins/check_swap -w 80% -c 40%
> 
> Actual results:
> SWAP OK - 100% free (0 MB out of 0 MB) |swap=0MB;0;0;0;0
> 
> Expected results:
> SWAP CRITICAL - 0% free (0 MB out of 0 MB) |swap=0MB;0;0;0;0

You can specify an absolute value instead of percentage if you want to
check the presence of swap; I personally wouldn't see this as a bug, and
changing the default could break existing setups.

Why not adding an option instead to let the user control that? It would
also allow passing any state this way, for instance one could want to
return an UNKNOWN in that case (see check_cluster; probably has some
handy code for that).

I'm curious what the rest of the team thinks about it though...

Thanks,

- -- 
Thomas
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAk2ZXM8ACgkQ6dZ+Kt5BchZp/wCeJNfchA2V7CkMvMg/CS89DS36
WQgAniMXAAYISLm9qrX3/KmrWNQ50iNy
=96Jq
-----END PGP SIGNATURE-----




More information about the Devel mailing list