System Administration
cancel
Showing results for 
Search instead for 
Did you mean: 

Need a automated script for the filesystem full alerts

SOLVED
Go to solution
Mohammed Haris Khan
Occasional Advisor

Need a automated script for the filesystem full alerts

Hi,

Im my company there is no script been automated for the alerts to be flooded to my mail the filesystem gets over the threshold value. Please provide me a script which works in the sense as " when the filesystems gets over the threshold value 85% , i need to receive a mail specifing the server name and the particular filesystem % has over loaded" with the output of bdf or df command "

your answers are appriciated, please help me in this senario

Thanks
Harish
5 REPLIES
R.K. #
Honored Contributor

Re: Need a automated script for the filesystem full alerts

Steven E. Protter
Exalted Contributor

Re: Need a automated script for the filesystem full alerts

Shalom,

There are literally dozens of good choices.

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

That is the place to find sysadmin scripts.

Check out Bill's profile for other threads.

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
avizen9
Esteemed Contributor
Solution

Re: Need a automated script for the filesystem full alerts

Hello harish,
its here below,
you need to change mail_list,
you can execute this through crontab
once file system will reach 85% will send you email alert

you can also configure pager if you want to get alert on pager for this, thanks,


#!/bin/ksh

# Shell script to check the space left on each file system

mail_list=" abcd_as@doamin.com"



file1="/tmp/blah$$"


> $file1

/usr/bin/bdf -l | awk -v file=$file1 '
{
if ( NR == 1 )
next

if ( $5 > "85" || $4 < 6000 )
{
print $6 " " $5 " " $4 " " > file
}
}'

if [ -s $file1 ]
then
hostname >> $file1
mailx -s `hostname`" diskspace full alert notification" $mail_list < $file1
fi
/bin/rm -f $file1
Viktor Balogh
Honored Contributor

Re: Need a automated script for the filesystem full alerts

Hi,

Attached is a script that will send you an email if a filesystem has reached a certain percentage of usage. It is best to send the email to an SMS gateway and get the notifications via SMS. Ask your mobile provider for such an email account.

(Before you run this take a look, there are some things you should modify. Oh, and it applies to all scripts especially if you run it as root!)
****
Unix operates with beer.
Viktor Balogh
Honored Contributor

Re: Need a automated script for the filesystem full alerts

Here is the conf file for the abovementioned script, here you can set the filesystems and the tresholds for it.

Modify it too...
****
Unix operates with beer.