Closed vova3379 closed 1 year ago
This disk plugin is a difficult one to test without extracting its entire Sensu-powered asset pack.
I ran into this issue as well and realized you need to use lowercase -i
to bypass mounts (e.g. -i /mnt
).
As I see from docs here https://bonsai.sensu.io/assets/sensu-plugins/sensu-plugins-disk-checks/versions/5.1.4 -i MNT[,MNT] Ignore mount point(s) so when I changed -I MNT[,MNT] Include only mount point(s) to -i I got the expected error below
CheckDisk CRITICAL: /snap/amazon-ssm-agent/5656 100.0% inode usage, /snap/amazon-ssm-agent/5656 100.0% bytes usage (25.12 MiB/25.12 MiB), /snap/amazon-ssm-agent/6312 100.0% inode usage, /snap/amazon-ssm-agent/6312 100.0% bytes usage (24.50 MiB/24.50 MiB), /snap/core/14447 100.0% inode usage, /snap/core/14447 100.0% bytes usage (116.75 MiB/116.75 MiB), /snap/core18/2679 100.0% inode usage, /snap/core18/2679 100.0% bytes usage (55.62 MiB/55.62 MiB), /snap/core/14784 100.0% inode usage, /snap/core/14784 100.0% bytes usage (116.88 MiB/116.88 MiB), /snap/core18/2697 100.0% inode usage, /snap/core18/2697 100.0% bytes usage (55.62 MiB/55.62 MiB)
our check example below
check-disk-usage.rb -c 95 -w 90 -n 10 -m 0.8 -l 10 -i $(grep -v '^#' /etc/fstab | awk '{ print $2 }' | xargs | sed 's/\ /,/g')
as You can see we form list of mount points to check and definitely need use I vs i Also, just and case I've checked in a way like below
check-disk-usage.rb -c 95 -w 90 -n 10 -m 0.8 -l 10 -i /mnt
and got the same output
CheckDisk CRITICAL: /snap/amazon-ssm-agent/5656 100.0% inode usage, /snap/amazon-ssm-agent/5656 100.0% bytes usage (25.12 MiB/25.12 MiB), /snap/amazon-ssm-agent/6312 100.0% inode usage, /snap/amazon-ssm-agent/6312 100.0% bytes usage (24.50 MiB/24.50 MiB), /snap/core/14447 100.0% inode usage, /snap/core/14447 100.0% bytes usage (116.75 MiB/116.75 MiB), /snap/core18/2679 100.0% inode usage, /snap/core18/2679 100.0% bytes usage (55.62 MiB/55.62 MiB), /snap/core/14784 100.0% inode usage, /snap/core/14784 100.0% bytes usage (116.88 MiB/116.88 MiB), /snap/core18/2697 100.0% inode usage, /snap/core18/2697 100.0% bytes usage (55.62 MiB/55.62 MiB)
also just in case again test
check-disk-usage.rb -c 95 -w 90 -n 10 -m 0.8 -l 10 -I /mnt
and check output
CheckDisk OK: All disk usage under 90% and inode usage under 85%
at same time disk has low free space
/dev/md0 435G 410G 2.3G 100% /mnt
As discovered two my colleges this check adaptive - see the example below
# this check is adaptive in that it will raise the thresholds automatically for larger volumes.
# (https://github.com/sensu-plugins/sensu-plugins-disk-checks/blob/master/bin/check-disk-usage.rb)
# Crit Warn FS_Size Free_on_Crit
# 85.00% 80.00% <=30GB
# 86.46% 81.94% 50GB 6.77GB
# 88.21% 84.28% 100GB 11.79GB
# 91.45% 88.61% 500GB 42.75GB
# 92.56% 90.08% 1000GB (~1TB) 74.4GB
# 94.61% 92.81% 5000GB (~5TB) 269.5GB
also, you need to use (https://bonsai.sensu.io/assets/sensu-plugins/sensu-plugins-disk-checks/versions/5.1.4)
-r Ignore bytes reserved for privileged processes only
because ext4 reserves 5% of its space and we need to exclude this space from the check.
So after the -r key was added check started showing /mnt volume as problem one
/dev/md0 435G 410G 2.3G 100% /mnt
CheckDisk CRITICAL: /mnt 99.49% bytes usage (409.96 GiB/434.31 GiB)
plugin version:
os: cat /etc/os-release NAME="Ubuntu" VERSION="18.04.2 LTS (Bionic Beaver)"
problem disk: /dev/md0 3.6T 3.4T 28G 100% /mnt cat /proc/mdstat Personalities : [raid0] [linear] [multipath] [raid1] [raid6] [raid5] [raid4] [raid10] md0 : active raid0 xvdc[1] xvdb[0] 3906742272 blocks super 1.2 256k chunks
unused devices:
check command line: check-disk-usage.rb -c 95 -w 90 -n 10 -m 0.8 -l 10 -I /mnt
result: CheckDisk OK: All disk usage under 90% and inode usage under 85%
expected result: critical, tests for root volume / works as expected also was tested -I /,/mnt - root volume / works as expected and /mnt ignored /dev/xvda1 7.7G 7.6G 174M 98% / CheckDisk CRITICAL: / 97.6% bytes usage (7.51 GiB/7.69 GiB)