1752785 Members
6293 Online
108789 Solutions
New Discussion юеВ

monitor file system size

 
keith demingware
Occasional Advisor

monitor file system size

I run the following command out of cron, but what i get is the last file system that is listed when a bdf command is ran. What i need is to be notified of the actual filesystem that is over the percentage of usage. Thanks for your help.

P.S. If some one could explain to me the details on how this command works i would really appreciate it. I have researched it but have not come up with anything in my script book.

bdf | awk 'z[split($5,z,"%")-1]>85' | elm -s "Filesystem > 85%"
just when you thought you had the answer
3 REPLIES 3
Yang Qin_1
Honored Contributor

Re: monitor file system size

You will need to add an email address at the end of that command:

bdf | awk 'z[split($5,z,"%")-1]>85' | elm -s "Filesystem > 85%" keith@company.com

It will split "%" from 5th column of the bdf output (so only number leaft)and put the numbers in array "z". If numbers in "z" bigger than "85" then pass the bdf output of those related lines to "elm" -- an email tool and send the results to keith@company.com with subject "Filesystem > 85%".

BTW, you want to monitor the file system on MPE or Unix machine?

Yang
keith demingware
Occasional Advisor

Re: monitor file system size

Thanks for your help. What i did was i added an 85 inside of the ($5,z,"85%") and it worked the way it was suppose to. In other words i have one filesystem on my unix box that is actually over 85% and that line showed up in my e-mail not the last file sytem with only 9%.
just when you thought you had the answer
Yang Qin_1
Honored Contributor

Re: monitor file system size

If you run bdf | awk 'z[split($5,z,"85%")-1]>85' | elm -s "Filesystem > 85%" xxx@xxx.xxx
then you won't get what you want to get.

There is bdf output:
Filesystem kbytes used avail %used Mounted on
/dev/vg00/lvol3 204800 124192 80184 61% /
/dev/vg00/lvol1 295024 37600 227920 14% /stand
/dev/vg00/lvol7 8704000 4289040 4380512 49% /var

5th column is the one with 61%, 14%, 49%. The reason we want to split "%" from this column is that we want to check if 61 > 85 or not. Because if we compare 61% with 85% directly, it will not work.

If you do split($5,z,"85%") means you want to split "85%" from 61%, it will not work.

If you want to change the threshold from 85% to 70% you should run

bdf | awk 'z[split($5,z,"%")-1]>70' | elm -s "Filesystem > 70%" xxx@xxx.xxx

Yang