HPE Community read-only access December 15, 2018
This is a maintenance upgrade. You will be able to read articles and posts, but not post or reply.
Hours:
Dec 15, 4:00 am to 10:00 am UTC
Dec 14, 10:00 pm CST to Dec 15, 4:00 am CST
Dec 14, 8:00 pm PST to Dec 15, 2:00 am PST
System Administration
cancel
Showing results for 
Search instead for 
Did you mean: 

Need help on file system monitoring script

 
gab_in
Regular Advisor

Need help on file system monitoring script

Hi,

I have a script and conf file attached here in zip format (fs1.zip).
1: main.txt (scipt)
2: conf.txt (conf file)

When I run the main script, it checks and sends me a mail. But it checks and tells only that 'file system full' it doesn't tell which file system is full/reached. Can you please add some lines in that script which can send me the infomation about which file system reached the limit, set in the conf file.

Thanks in advance
Gab
11 REPLIES
Mark McDonald_2
Trusted Contributor

Re: Need help on file system monitoring script

add lines to what?

for FS in / /opt /var /tmp
do
AMOUNT=$(bdf $FS | grep "%" | awk '{ print $5 }')

then add an if statement - to test if $AMOUNT is above 95%?

email out and include $FS

done
gab_in
Regular Advisor

Re: Need help on file system monitoring script

Hi Mark,

Thanks for the help.
Can you please add it to the script and send me the final script.

I tried it but now working.

Thanks in advance
Gab
Mark McDonald_2
Trusted Contributor

Re: Need help on file system monitoring script

sorry - dont grep for "%" that will bring out both lines. you need to "grep -v used"
Steven E. Protter
Exalted Contributor

Re: Need help on file system monitoring script

Shalom,

Its been done here before:

http://forums11.itrc.hp.com/service/forums/questionanswer.do?threadId=1100009

ITRC is where I got mine.

http://forums11.itrc.hp.com/service/forums/questionanswer.do?threadId=800551

http://forums11.itrc.hp.com/service/forums/questionanswer.do?threadId=78542

Several good choices there.

SEP
Steven E Protter
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
Mark McDonald_2
Trusted Contributor

Re: Need help on file system monitoring script

>>Can you please add it to the script and send me the final script.

I cannot see your "attached" script file. Its missing.

I am a contractor and charge quite a good rate for editing scripts, where should I send the bill?

I am happy to make suggestions but I would prefer if you have a go at editing the script yourself. You will learn more that way.

Thanks
Mark
gab_in
Regular Advisor

Re: Need help on file system monitoring script

Hi,

Thanks for the reply.

Can anyone please send me the complete script which I can test on my machine?

Thanks
Gab
Mark McDonald_2
Trusted Contributor

Re: Need help on file system monitoring script

Gab, please attach your current script so we can see what you have so far. Its not attached in your first post.
gab_in
Regular Advisor

Re: Need help on file system monitoring script

Hi Mark,

Sorry , I forgot to attach the script.

Please find the attached files in zip format (fs1.zip)
Mark McDonald_2
Trusted Contributor

Re: Need help on file system monitoring script

OK - you seem to be quite close.

why not simply include ${FS[$i]} in the mail subject string?

eg:mailx -s "file system ${FS[$i]} full " gabbi@yahoo.com < /dev/null


Mark McDonald_2
Trusted Contributor

Re: Need help on file system monitoring script

Also....just an idea:

why not check all file systems, but instead of echoing to stdout, send this to a result file, then do 1 email at the end:

if [[ -f result ]]
then
mailx -s "file system full" gabbi@yahoo.com << EOF
'cat result'
EOF

fi
Mark McDonald_2
Trusted Contributor

Re: Need help on file system monitoring script

Hi Gab, did you get this working?

How about some points for the suggestions so far?