Operating System - Linux
1753707 Members
5145 Online
108799 Solutions
New Discussion юеВ

Re: File System Alert Script

 
SOLVED
Go to solution
Kyle D. Harris
Regular Advisor

Re: File System Alert Script

Ok, thanks alot guys. That should do it for my question. Thanks for all the help from both of you.
Huc_1
Honored Contributor

Re: File System Alert Script

Hello

I am using this attached perl script to do the job

Some one in this forums did post a script very much like this one but for HP-UX os I did modify it to run on my linux.
I did quite a bite of modification, but I am afraid I do not remember who the original writer
is ...

I am just posting this modified version because it did teach me a fews tricks in perl, and I thing it could be usefull to you

modify reportfull and email_users in the script to your needs,

Jean-Pierre

Smile I will feel the difference
John Meissner
Esteemed Contributor

Re: File System Alert Script

Kyle... in my script above i use SED to cut off the % symbol... so it's looking at the number.
All paths lead to destiny
Kyle D. Harris
Regular Advisor

Re: File System Alert Script

John, i copy pasted your script. I changed the percent to 85 and of course my email address in the sendx .... I have one file system at 88 percent, thus i made the percent 85 just to see if it works. I also included: "#!/usr/bin/perl" at the top of the script. I'm still having trouble getting it to work correctly. Any other ideas i may not be doing correctly? Thanks.

Kyle
Balaji N
Honored Contributor

Re: File System Alert Script

hi
john's script is a simple shell script.

so u need to add the line #!/usr/bin/sh on top.

cheerio
-balaji
Its Always Important To Know, What People Think Of You. Then, Of Course, You Surprise Them By Giving More.
John Meissner
Esteemed Contributor

Re: File System Alert Script

i actually prefer using the top line of

#! /usr/bin/ksh

I just like the korn shell...
All paths lead to destiny
John Meissner
Esteemed Contributor

Re: File System Alert Script

OK - sorry... i had a problem in my script..... i fixed it... here it is...:


#!/usr/bin/ksh
mark=1
while [ $mark = 1 ]
do
df | grep -v Filesystem |
while read line
do
MTP=$(echo "$line" | awk '{print $6}')
USE=$(echo "$line" | awk '{print $5}' | sed 's/.$//g')
if [ "$USE" > "60" ]
then
echo "$MTP $USE " | mailx -s "FS alert" sendto@work.com
sleep 100 #or whatever time
else
sleep 100 #or whatever time
fi
done
done
All paths lead to destiny