Comment 6 for bug 1940916

Revision history for this message
Miriam EspaƱa Acebal (mirespace) wrote :

Debugging a little between behaviour ok/non-ok: it seems it goes through "calling stat" (stat_path function in check_disk.c) at least twice when the result (STATE) is OK:

  * without the fix for bug 1827159 (good case):
     root@nagios-focal-miriam:~# /usr/lib/nagios/plugins/check_disk -w 10% -c 5% -vvv -p /reproduce
     calling stat on /reproduce
     Thresholds(pct) for /reproduce warn: 10.000000 crit 5.000000
     calling stat on /reproduce
     For /reproduce, used_pct=0 free_pct=100 used_units=0 free_units=2048 total_units=2048 used_inodes_pct=1 free_inodes_pct=99 fsp.fsu_blocksize=4096 mult=1048576
     Freespace_units result=0
     Freespace% result=0
     Usedspace_units result=0
     Usedspace_percent result=0
     Usedinodes_percent result=0
     Freeinodes_percent result=0
     DISK OK - free space: /reproduce 2048 MB (100% inode=99%);| /reproduce=0MB;1843;1945;0;2048

  * with the fix:
    - Bad case:
        root@nagios-focal:~# /usr/lib/nagios/plugins/check_disk -w 10% -c 5% -vvvv -p /reproduce
        calling stat on /reproduce
        Thresholds(pct) for /reproduce warn: 10.000000 crit 5.000000
        DISK UNKNOWN - free space:|

    - Good case (using group option workaround):
        root@nagios-focal:~# /usr/lib/nagios/plugins/check_disk -w 10% -c 5% -vvvv -g repro -p /reproduce
        calling stat on /reproduce
        Thresholds(pct) for /reproduce warn: 10.000000 crit 5.000000
        Group of /reproduce: repro
        calling stat on /reproduce
        calling stat on /reproduce
        Group repro: adding 524288 blocks sized 4096, (/reproduce) used_units=0 free_units=2048
        total_units=2048 fsu_blocksize=1048576 mult=93861737284654
        Group repro now has: used_units=0 free_units=2048 total_units=2048 fsu_blocksize=524288 mult=4096
        For repro, used_pct=0 free_pct=100 used_units=0 free_units=2048 total_units=2048 used_inodes_pct=1 free_inodes_pct=99 fsp.fsu_blocksize=4096 mult=1048576
        Freespace_units result=0
        Freespace% result=0
        Usedspace_units result=0
        Usedspace_percent result=0
        Usedinodes_percent result=0
        Freeinodes_percent result=0
        DISK OK - free space: repro 2048 MB (100% inode=99%);| repro=0MB;1843;1945;0;2048

Also, with the fix, the whole disk check operations are consistent (if you check on units or average the result is OK) and without the fix, it varies from warning, critical, ok ... depending on the combination, i.e.:

   /usr/lib/nagios/plugins/check_disk -w 10 -c 10
   /usr/lib/nagios/plugins/check_disk -w 10% -c 10%
   /usr/lib/nagios/plugins/check_disk -w 10% -c 10
   /usr/lib/nagios/plugins/check_disk -w 10 -c 10%
   /usr/lib/nagios/plugins/check_disk -w 10
   /usr/lib/nagios/plugins/check_disk -w 10%
   /usr/lib/nagios/plugins/check_disk -c 10
   /usr/lib/nagios/plugins/check_disk -c 10%