I have a working (mostly) shell script to email me if any drive in my system is over a threshold mark. For the main processing part of my code, I am using something like the following:
df -ht nodevfs, nfs | awk ' $5 > 80'
However, for purposes of testing and seeing script results under different scenarios, I set 80 to 75. Everything works well except that when it is set to 75 (for 75% full) it picks up one of my other drives that reads 8% capacity.
I believe I somewhat understand why it is doing this, and at the risk of humiliation if I am wrong (please be kind in rebuking me) I think it is either tacking on an imaginary 0 to the 8 making it 80 or comparing the first digits alone.
Here is a mock df output to help illustrate my working data: (notice, if my threshold was 60%, with my above example, I would probably pick the 6% entry) I would like to find a way to achieve my goal without using awk or sed to remove the 8% and 6% drives from the output.
Filesystem Size Used Avail Capacity Mounted on
/dev/[drive0] 991M 421M 490M 46% /
/dev/[drive0pX] 19G 1.5G 16G 8% /usr
/dev/[drive0pX] 178G 9.3G 154G 6% /home
/dev/[drive1pX] 1.8T 1.4T 267G 84% /mnt/[drive1pX]
/dev/[drive2pX] 1.8T 630G 1.0T 38% /mnt/[drive2pX]
/dev/[drive3pX] 3.5T 2.6T 642G 81% /mnt/[drive3pX]
/dev/[drive4pX] 3.5T 2.6T 717G 78% /mnt/[drive4pX]
I am wondering if someone can point me in the right direction or similar forum to solve this problem.
Thanks for your help,