Operating System - HP-UX
1748204 Members
3254 Online
108759 Solutions
New Discussion юеВ

Re: monitoring filesystem growth

 
SOLVED
Go to solution
Abe Li Kito
Occasional Contributor

monitoring filesystem growth

Hi,
Being a new HP-UX sysadmin, I wonder if anyone has a script to monitor filesystem growth on daily basis.

I have experienced an unfortunate incident whereby one of our critical filesytem grow so rapidly, causing application failure.

I've created a small script to capture the filesystem utilization. But at this moment the comparison is done manually.

Appreciate all your input. Thanks.
5 REPLIES 5
Steven E. Protter
Exalted Contributor
Solution

Re: monitoring filesystem growth

Shalom,

Several ways to do it in this thread.

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

Scripts with email alarms, all kinds of good stuff.

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
spex
Honored Contributor

Re: monitoring filesystem growth

Hello,

Here's one I use:

#!/usr/bin/sh

typeset -i MAXPCT=90
BDFMEGS=/path/to/bdfmegs.sh

if [ $(${BDFMEGS} -qlP ${MAXPCT} | wc -l) -gt 1 ]
then
mailx -m -s "WARNING! FILESYSTEM(S) OVER ${MAXPCT}% FULL!" your@email.addr << EOF
File-System Gbytes Used Avail %Used Mounted on
$(${BDFMEGS} -qglP ${MAXPCT})
EOF

fi

exit 0

It relies on Bill Hassell's bdfmegs.sh shell script (attached). Schedule it to run every 10 minutes or so via cron.

PCS
spex
Honored Contributor

Re: monitoring filesystem growth

Hello (again),

For execution every 10 minutes, your crontab entry should be similar to the following:

5,15,25,35,45,55 * * * * /path/to/check_fs_usage.sh

Note that a potential problem ("feature"?) with the script I supplied is there is no mechanism to stop emails from being sent after the initial one. This could be resolved quite easily by modifying the script to make use of a lockfile.

PCS
boomer_2
Super Advisor

Re: monitoring filesystem growth

hi ALK,
We use the following script for filesystem monitoring...it sends 3 alrm beeps to all logged in guys and a message too..


# cat /tmp/check_bdf.sh
count=0

function check_bdf
{
> /tmp/bdflog.txt

bdf -l | awk '$0 !~ /^F/' |awk '{if (NF!=1){
if (NF==5){
print $4"\t" $5"\t"
}
else{
print $5"\t\t" $6"\t"
}
}}' | sed 's/'%'/''/' >> /tmp/bdflog.txt
}


function alert
{

while read percent dir
do

if [ $percent -ge 95 ]
then

for i in `who|awk '{printf ("/dev/"$2"\n")}'`
do

echo "----------------------------------------------------------" > $i
echo "WARNING :" $dir "-----------> " $percent"% full " > $i
echo " PLZ CONTACT SYSTEM ADMINISTRATOR AT 4238xxxx/4240xxxx (CDC TEAM)" > $i
echo "----------------------------------------------------------" > $i
echo "\a" > $i
sleep 1
done

fi

done
} < /tmp/bdflog.txt

alert
#check_bdf # create a bdf log file


while [ $count -lt 2 ]
do
check_bdf
alert

count=$(($count + 1))
done
Bill Hassell
Honored Contributor

Re: monitoring filesystem growth

Here is a script that will monitor all your filesystems and will provide notifications by several different methods without a storm of messages. You create a config file in /etc/diskspace.conf and run the script every 15 minutes (or more often if you need to faster response). You can send messages to pagers, cellphones, your operation center, and log the information in syslog.


Bill Hassell, sysadmin