Operating System - HP-UX
1751695 Members
4654 Online
108781 Solutions
New Discussion юеВ

Re: 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 11
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