Welcome guest. Before posting on our computer help forum, you must register. Click here it's easy and free.

Author Topic: FileSystem Monitor Script Issue..Pls Help?  (Read 3519 times)

0 Members and 1 Guest are viewing this topic.

OpenwareTech

  • Guest
FileSystem Monitor Script Issue..Pls Help?
« on: April 29, 2008, 08:14:13 AM »
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 [email protected]
fi
-------------------------------------------------------------
I need to check another filesystem called /Daily/All
 
   
  Thanks for your help

ghostdog74



    Specialist

    Thanked: 27
    Re: FileSystem Monitor Script Issue..Pls Help?
    « Reply #1 on: April 29, 2008, 08:44:48 PM »
    so change Monthly, to Daily in the awk script.

    KenJackson



      Beginner
    • Thanked: 1
      • Yes
      • Jackson I/O
    • Experience: Experienced
    • OS: Linux variant
    Re: FileSystem Monitor Script Issue..Pls Help?
    « Reply #2 on: May 05, 2008, 05:45:27 AM »
    MSG=`df - Ik|awk '$6~/Monthly$/{gsub("%"," ");
    if ($5>20){print "FS:Monthly filesystem is "$5"%"}}'`
    if [ "$MSG" != "" ]
     then  echo $MSG | mail [email protected]
    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?