Bug 264252 - net-mgmt/nagios-plugins: check_swap reports double swap size if swap file is added
Summary: net-mgmt/nagios-plugins: check_swap reports double swap size if swap file is ...
Status: New
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Some People
Assignee: freebsd-ports-bugs (Nobody)
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2022-05-26 09:15 UTC by Edgar Wiesmann
Modified: 2023-01-30 07:58 UTC (History)
0 users

See Also:


Attachments
output of "sysctl -a | egrep -i ^hw." (8.92 KB, text/plain)
2022-05-26 09:15 UTC, Edgar Wiesmann
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Edgar Wiesmann 2022-05-26 09:15:17 UTC
Created attachment 234225 [details]
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
Comment 1 Edgar Wiesmann 2022-05-30 11:00:08 UTC
this bug seems not to be related to "swap files" but to the number of swap devices:

If I turn off swap partition /dev/da0p3, check_swap calculates the right size of swap mem.

If there are more than one swap device, check_swap seems to sum up each single divice plus the sum of all devices...