Operating System - HP-UX
1752571 Members
5084 Online
108788 Solutions
New Discussion юеВ

Re: How to configure one script to send mail alerts if filesystem is reaching 90%

 
SOLVED
Go to solution
Rita C Workman
Honored Contributor

Re: How to configure one script to send mail alerts if filesystem is reaching 90%

..Didn't Measureware have something in a simple file that one could set these limits on../var/opt/perf/alarmdef

If memory serves me, you could set to notify for CPU,swap,disk I/O, and Filesystem utilization. Maybe, you could just add a line (under red alert) that sends an email when it hits red.

Just a thought,
Rita
Ishwar_1
Frequent Advisor

Re: How to configure one script to send mail alerts if filesystem is reaching 90%

This script will check for all the filesystem with Size more then 90% and mail to the Person.

#-----------Variables
RD1=/tmp/script/check.log

#-----------Truncate
cat /dev/null > $RD1

#------------Logic
df -h | grep dev | awk '{if($5 > 90)print $5, " ", $6}' > $RD1

exec < $RD1
i=0
while read line
do
x=`cat check.log | awk '{print $1}'`
if [ "$x" > 90 ]
then
mailx # Email ID of the Person and File name $RD1
fi
i=`expr $i + 1`
done

Regards
Ishwar
James R. Ferguson
Acclaimed Contributor

Re: How to configure one script to send mail alerts if filesystem is reaching 90%

Hi (again):

Bill Hassell offers a nice filesystem monitoring script with notifications here:

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

See his commentary and attachment in the thread above.

Regards!

...JRF...
Mohandass
New Member

Re: How to configure one script to send mail alerts if filesystem is reaching 90%


Hi Senthil,

Below is a part of my script that monitor filesystem. Hope it helps.

df -l |awk '{print $1}' > /tmp/mountlist

cat /tmp/mountlist | while read LINE
do
PERC=`df -k ${LINE} | grep allocation| awk '{print $1}'`


if [ $PERC -gt 95 ]; then

if [ $PERC -gt 98 ]; then
echo "CRITICAL ${PERC}%" | mailx -s "CRITICAL: ${LINE} on `hostname` is almost full ${PERC}%" ${SYSADM2}
else
echo "WARNING ${PERC}%" | mailx -s "WARNING: ${LINE} on `hostname` is almost full ${PERC}%" ${SYSADM2}
fi

fi

Regards
Mohan
senthil_kumar_2
Regular Advisor

Re: How to configure one script to send mail alerts if filesystem is reaching 90%

Hi All,

I have changed my script as follows.

#!/bin/sh
RESULTS=$(bdf | awk 'z[split($5,z,"%")-1]>90' | grep -v Filesystem)
[ -z "${RESULTS}" ] || echo "$RESULTS" | mailx -r abc@company.com -s "$HOST Filesystems > 90%" abc@company.com


Now it working fine.


Thanks a lot for all.
senthil_kumar_2
Regular Advisor

Re: How to configure one script to send mail alerts if filesystem is reaching 90%

Please see my reply in above