It tries to parse line of the form Swap: <total> <used> <free> in /proc/meminfo which isn't present in 2.6.* I suggest to use SwapTotal: and SwapFree: instead which work both with 2.4 and 2.6 (a patch will follow in a minute). Reproducible: Always Steps to Reproduce: 1. /usr/nagios/libexec/check_swap -w 50% -c 85% Actual Results: CRITICAL - Swap used: -2147483648% (0 out of 0) Expected Results: Swap ok - Swap used: 18% (182808576 out of 1036361728)
Created attachment 38023 [details, diff] Patch to fix the bug + more In addition to fixing the bug as described in the report, this patch also: 1. Prevents crash when /proc/meminfo can't be opened 2. Fixes rounding error in percentage calculation 3. Avoids divide by zero when swap isn't enabled at all
It would be best if you would report it upstream to the nagiosplug-devel mailing list. (checkout http://www.nagios.org/mailinglist.php)
The bug had been reported to their bug tracking system earlier: https://sourceforge.net/tracker/index.php?func=detail&aid=905971&group_id=29880&atid=397597 and is supposed to be fixed in CVS.
Can you test HEAD? (1.31)
It works, but you can't just drop it into the old source tree. Also, the logic of command line options has reversed. So I suggest to use my patch for meantime ;-).
now in portage. thanks for the patch.