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.:
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): nagios- focal-miriam: ~# /usr/lib/ nagios/ plugins/ check_disk -w 10% -c 5% -vvv -p /reproduce (pct) for /reproduce warn: 10.000000 crit 5.000000 blocksize= 4096 mult=1048576 units result=0 units result=0 percent result=0 _percent result=0 _percent result=0 0MB;1843; 1945;0; 2048
root@
calling stat on /reproduce
Thresholds
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_
Freespace_
Freespace% result=0
Usedspace_
Usedspace_
Usedinodes
Freeinodes
DISK OK - free space: /reproduce 2048 MB (100% inode=99%);| /reproduce=
* with the fix:
root@nagios- focal:~ # /usr/lib/ nagios/ plugins/ check_disk -w 10% -c 5% -vvvv -p /reproduce
Thresholds( pct) for /reproduce warn: 10.000000 crit 5.000000
- Bad case:
calling stat on /reproduce
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
Thresholds( pct) for /reproduce warn: 10.000000 crit 5.000000
total_ units=2048 fsu_blocksize= 1048576 mult=93861737284654 524288 mult=4096 blocksize= 4096 mult=1048576
Freespace_ units result=0
Usedspace_ units result=0
Usedspace_ percent result=0
Usedinodes_ percent result=0
Freeinodes_ percent result=0 1843;1945; 0;2048
calling stat on /reproduce
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
Group repro now has: used_units=0 free_units=2048 total_units=2048 fsu_blocksize=
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_
Freespace% result=0
DISK OK - free space: repro 2048 MB (100% inode=99%);| repro=0MB;
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 lib/nagios/ plugins/ check_disk -w 10% -c 10% lib/nagios/ plugins/ check_disk -w 10% -c 10 lib/nagios/ plugins/ check_disk -w 10 -c 10% lib/nagios/ plugins/ check_disk -w 10 lib/nagios/ plugins/ check_disk -w 10% lib/nagios/ plugins/ check_disk -c 10 lib/nagios/ plugins/ check_disk -c 10%
/usr/
/usr/
/usr/
/usr/
/usr/
/usr/
/usr/