1.

Solve : FileSystem Monitor Script Issue..Pls Help??

Answer»

I have a Script that monitors a FileSystem named /Monthly; works
great but I need to monitor
/Daily/All ....

Can you help me tweak something here that I dont see

MSG=`df - Ik|awk '$6~/Monthly$/{gsub("%"," ");
if ($5>20){print "FS:Monthly filesystem is "$5"%"}}'`
if [ "$MSG" != "" ]
then echo $MSG | mail [emailprotected]
fi
-------------------------------------------------------------
I need to check another filesystem called /Daily/All


Thanks for your help
so change Monthly, to Daily in the awk script. Quote from: OpenwareTech on April 29, 2008, 08:14:13 AM

MSG=`df - Ik|awk '$6~/Monthly$/{gsub("%"," ");
if ($5>20){print "FS:Monthly filesystem is "$5"%"}}'`
if [ "$MSG" != "" ]
then echo $MSG | mail [emailprotected]
fi
I'm only casually acquainted with awk, but I can certainly see what's going on here.

At the highest level, you are storing the OUTPUT of a command into an environment variable named MSG. The back quotes (`` ) run the command and return the text.

But I suspect you have not quite correctly copied the command that pipes into awk, that is, "df - Ik". The closest sensible command would be "df -ik", which shows how many inodes, or directory entries, are used up. The $5 part of the awk print command would grab the fifth output COLUMN from df, which is the percentage.

As for the change, I think the previous answer was CORRECT, just change the directory.

BTW, did you really intend to give your cell phone number to the world?


Discussion

No Comment Found