Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 61386 - nagios-plugins::check_swap doesn't work with kernel 2.6
Summary: nagios-plugins::check_swap doesn't work with kernel 2.6
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: High normal (vote)
Assignee: Gentoo Netmon project
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2004-08-23 08:12 UTC by Evgeny Stambulchik
Modified: 2004-11-21 03:31 UTC (History)
1 user (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
Patch to fix the bug + more (check_swap.c.diff,2.14 KB, patch)
2004-08-23 08:16 UTC, Evgeny Stambulchik
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Evgeny Stambulchik 2004-08-23 08:12:28 UTC
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)
Comment 1 Evgeny Stambulchik 2004-08-23 08:16:08 UTC
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
Comment 2 Eldad Zack (RETIRED) gentoo-dev 2004-08-24 03:21:41 UTC
It would be best if you would report it upstream to the nagiosplug-devel mailing list. (checkout http://www.nagios.org/mailinglist.php)
Comment 3 Evgeny Stambulchik 2004-08-24 03:43:00 UTC
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.
Comment 4 Eldad Zack (RETIRED) gentoo-dev 2004-08-24 08:28:25 UTC
Can you test HEAD? (1.31) 
Comment 5 Evgeny Stambulchik 2004-08-26 07:52:16 UTC
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 ;-).
Comment 6 Eldad Zack (RETIRED) gentoo-dev 2004-11-21 03:31:24 UTC
now in portage.
thanks for the patch.