Bug 219068 - net-mgmt/nagios-plugins: check_swap returns always CRITICAL
Summary: net-mgmt/nagios-plugins: check_swap returns always CRITICAL
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Many People
Assignee: Mathieu Arnold
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2017-05-04 13:39 UTC by Markus Wennrich
Modified: 2017-08-29 16:46 UTC (History)
0 users

See Also:
bugzilla: maintainer-feedback? (mat)


Attachments
patch for files/patch-configure (1004 bytes, patch)
2017-05-04 13:39 UTC, Markus Wennrich
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Markus Wennrich 2017-05-04 13:39:54 UTC
Created attachment 182299 [details]
patch for files/patch-configure

With nagios-plugins-2.2.1,1 check_swap returns always CRITICAL:

  /usr/local/libexec/nagios/check_swap -w 20 -c 10
  SWAP CRITICAL - 100% free (0 MB out of 0 MB) |swap=0MB;0;0;0;0

The cause is a wrong SWAP_FORMAT from configure:

  ac_cv_swap_format="%*s %f %*d %f"

These have to be doubles now:

  ac_cv_swap_format="%*s %lf %*d %lf"

(Upstream-commit https://github.com/nagios-plugins/nagios-plugins/commit/39c5e4ed595cfbda7cff566575fc5a53252f09b5 )

After the patch:

  /usr/local/libexec/nagios/check_swap -w 20 -c 10
  SWAP OK - 82% free (3346 MB out of 4096 MB) |swap=3346MB;0;0;0;4096
Comment 1 Mathieu Arnold freebsd_committer freebsd_triage 2017-05-04 14:16:38 UTC
Thanks.
Comment 2 commit-hook freebsd_committer freebsd_triage 2017-05-04 14:17:23 UTC
A commit references this bug:

Author: mat
Date: Thu May  4 14:16:31 UTC 2017
New revision: 440109
URL: https://svnweb.freebsd.org/changeset/ports/440109

Log:
  Fix check_swap.

  PR:		219068
  Submitted by:	Markus Wennrich
  Sponsored by:	Absolight

Changes:
  head/net-mgmt/nagios-plugins/Makefile
  head/net-mgmt/nagios-plugins/files/patch-configure
Comment 3 Markus Wennrich 2017-08-29 14:37:17 UTC
Bug was again re-introduced with nagios-plugins-2.2.1_2,1

Revision: 448907

--- head/net-mgmt/nagios-plugins/files/patch-configure  Tue Aug 29 11:26:40 2017        (r448906)
+++ head/net-mgmt/nagios-plugins/files/patch-configure  Tue Aug 29 11:46:03 2017        (r448907)

(...)

--              ac_cv_swap_format="%*s %f %*d %f"
-+              ac_cv_swap_format="%*s %lf %*d %lf"

(...)
Comment 4 commit-hook freebsd_committer freebsd_triage 2017-08-29 16:06:21 UTC
A commit references this bug:

Author: mat
Date: Tue Aug 29 16:06:05 UTC 2017
New revision: 448927
URL: https://svnweb.freebsd.org/changeset/ports/448927

Log:
  Fix the check_swap again.

  PR:		219068
  Sponsored by:	Absolight

Changes:
  head/net-mgmt/nagios-plugins/Makefile
  head/net-mgmt/nagios-plugins/files/patch-configure
Comment 5 Mathieu Arnold freebsd_committer freebsd_triage 2017-08-29 16:26:23 UTC
Note that

  /usr/local/libexec/nagios/check_swap -w 20 -c 10

Means, warning if there is 20 bytes of swap free and critical if there is 10 bytes of swap free, which is a bit strange.
Comment 6 Markus Wennrich 2017-08-29 16:46:54 UTC
(In reply to Mathieu Arnold from comment #5)

Ah, true. It needs additional %-symbols:

/usr/local/libexec/nagios/check_swap -w 78% -c 10%
SWAP WARNING - 76% free (3092 MB out of 4096 MB) |swap=3092MB;3194;409;0;4096

Thanks for the hint, I will udpate my icinga-configuration. And thanks for the quick fix.