[Bug 264252] net-mgmt/nagios-plugins: check_swap reports double swap size if swap file is added

From: <bugzilla-noreply_at_freebsd.org>
Date: Thu, 26 May 2022 09:15:17 UTC
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=264252

            Bug ID: 264252
           Summary: net-mgmt/nagios-plugins: check_swap reports double
                    swap size if swap file is added
           Product: Ports & Packages
           Version: Latest
          Hardware: Any
                OS: Any
            Status: New
          Severity: Affects Some People
          Priority: ---
         Component: Individual Port(s)
          Assignee: mat@FreeBSD.org
          Reporter: edgar.wiesmann@rif-ev.de
             Flags: maintainer-feedback?(mat@FreeBSD.org)
          Assignee: mat@FreeBSD.org

Created attachment 234225
  --> https://bugs.freebsd.org/bugzilla/attachment.cgi?id=234225&action=edit
output of "sysctl -a | egrep -i ^hw."

with nagios-plugins-2.4.0,1 check_swap returns always DOUBLE the size of swap,
if an additional swap file ist added

create a swap file as shown at
https://www.freebsdnews.com/2015/07/03/add-swap-file-freebsd-10-1/

  cat /etc/fstab
    # Device        Mountpoint              FStype          Options        
Dump    Pass#
    /dev/da0p2      /                       ufs             rw              1  
    1
    /dev/da0p3      none                    swap            sw              0  
    0
    /dev/da1p1      /usr/local/poudriere    ufs             rw              0  
    0
    /dev/cd0        /media/cdrom            cd9660          ro,noauto       0  
    0
    linproc         /compat/linux/proc      linprocfs       rw,late         0  
    0
    md43    none    swap    sw,file=/usr/local/poudriere/swapfile_1G        0  
    0

  swapctl -l
    Device:       1024-blocks     Used:
    /dev/da0p3       838656         0
    /dev/md43       1048576         0

  /usr/local/libexec/nagios/check_swap -w 30% -c 10%
    SWAP OK - 100% free (3686 MB out of 3686 MB) |swap=3686MB;1105;368;0;3686

  swapoff /dev/md43

  swapctl -l
    Device:       1024-blocks     Used:
    /dev/da0p3       838656         0

  /usr/local/libexec/nagios/check_swap -w 30% -c 10%
    SWAP OK - 100% free (819 MB out of 819 MB) |swap=819MB;245;81;0;819

  swapon /dev/md43

  /usr/local/libexec/nagios/check_swap -w 30% -c 10%
    SWAP OK - 100% free (3686 MB out of 3686 MB) |swap=3686MB;1105;368;0;3686

top (top: version FreeBSD) and htop (3.2.0) allways show the correct size

uname -a
FreeBSD xxx 13.0-RELEASE-p11 FreeBSD 13.0-RELEASE-p11 #0: Tue Apr  5 18:54:35
UTC 2022    
root@amd64-builder.daemonology.net:/usr/obj/usr/src/amd64.amd64/sys/GENERIC 
amd64

-- 
You are receiving this mail because:
You are the assignee for the bug.