Languages and Scripting
cancel
Showing results for 
Search instead for 
Did you mean: 

Filesystem monitoring with different threshold

 
Highlighted
RamkumarA
Respected Contributor

Filesystem monitoring with different threshold

Hi Experts,

I have the below filesystem monitoring script(df_mon.sh) which monitors the filesystems specified in /tmp/df_mon.cfg. But this script will monitor all filesystems for same threshold (95%). But now i need to setup monitoring for different filesystems with different thresholds.

The input file will be having the filesystems with the desired thresholds in the below format pasted below. Can you advise on how to modify the below script so that it can monitor the specified filesystems with corresponding thresholds?


/tmp/df_mon.cfg:-


/var 90
/tmp 80
/opt 95


df_mon.sh:-

####Monitoring all FS except NFS mounted FS##########
OPCMSG=/usr/lpp/OV/OpC/opcmsg
OPCMON=/usr/lpp/OV/OpC/opcmon
for FILE_SYS in `cat /tmp/df_mon.cfg`
do
PERCENT=`df -k $FILE_SYS | awk '{print $4}' | grep -v Used | sed -e 's/%//g'`
echo $PERCENT
if [ "$PERCENT" -ge "95" ]
then
echo "Current utilization of $FILE_SYS is ($PERCENT%) which is >=95% threshold" | mailx -s "FS ALERT" abc@domain.com
fi
done
exit 0

Thanks,
Ramkumar A.
2 REPLIES 2
Highlighted
James R. Ferguson
Acclaimed Contributor

Re: Filesystem monitoring with different threshold

Hi:

Bill Hassell offers a well-documented, highly-optioned script called 'diskspace.sh' in this thread:

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

His script will do what you want and more.

Regards!

...JRF...
Highlighted
Steven E. Protter
Exalted Contributor

Re: Filesystem monitoring with different threshold

Shalom,

There are at least a half dozen variants in this thread:

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

Note also ITO/Openview have good monitors, as does hobbit.

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