- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Re: script required to monitor disk space usage
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Forums
Discussions
Discussions
Discussions
Forums
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО05-16-2005 10:19 PM
тАО05-16-2005 10:19 PM
/dev/hd3 1048576 637700 40% 579 1% /tmp
/dev/REMlv01 7340032 2017712 73% 22145 5% /u01
/dev/REMlv02 18874368 7538816 61% 31 1% /u02
/dev/REMlv03 6291456 3622456 43% 27 1% /u03
/dev/REMlv04 12582912 5962408 53% 82 1% /u04
/dev/REMlv00 2097152 1536616 27% 3348 1% /app/remedy
I need a single script which can monitor the following filesystems. If the filesystem usage crosses 65% then it shoud through a mail alert to me. How can i go about in doing the same. I have a script to monitor a single filesystem
while true
do
u04=`df -k|grep REMlv04|awk '{print $4}' | cut -c -2`
if [ $u04 -gt 60 ]
then
echo "/u04 File System is getting full " > /home/in263054/mail
mail -s "Filesystem Warnings" test@test.com < /home/in263054/mail
fi
break
done
Thanks in advance
S.Jagadesh
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО05-16-2005 10:38 PM
тАО05-16-2005 10:38 PM
SolutionPls find attached the perl script taken from :
http://forums1.itrc.hp.com/service/forums/questionanswer.do?threadId=178514
You will find a lot more in Bill's thread.
Regards,
Naveej
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО05-16-2005 11:32 PM
тАО05-16-2005 11:32 PM
Re: script required to monitor disk space usage
With this script, you can use a standard limit or you can define a limit for each tablespace:
Script---:
EMAILS="YourEmail@domain.com"
TABSPACO=/usr/local/etc/TabSpaco
TABMSG=/tmp/msg.$$
>${TABMSG}
BDF=/tmp/bdf.$$
>${BDF}
bdf | grep -v Mounted >${BDF}
while read a b c d e f
do
spc=`echo $e|sed 's/%//'`
set `grep $f $TABSPACO` >/dev/null 2>/dev/null
SPC=$1
if [[ $SPC -eq "" ]]
then
SPC=65
fi
if [[ $spc -gt $SPC ]]
then
echo "$f => % occupied = $e" >>${TABMSG}
fi
done <${BDF}
test -s ${TABMSG}
if [[ $? -eq 0 ]]
then
elm -s "FILESYSTEM SPACE" $EMAILS <${TABMSG}
fi
rm ${BDF}
rm ${TABMSG}
-->TabSpaco - modify as required:
80 /
80 /stand
80 /var
95 /usr
80 /usr/local/samba
80 /tmp
80 /sys
99 /opt
80 /home
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО05-16-2005 11:36 PM
тАО05-16-2005 11:36 PM
Re: script required to monitor disk space usage
You already got some good answers
look at
www.shelldorado.com
for more good scripting info
Steve Steel
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО05-17-2005 12:31 AM
тАО05-17-2005 12:31 AM
Re: script required to monitor disk space usage
#!/bin/ksh
FSFILE=/tmp/fs.log
# Remove first line
# You can also use bdf.
df -k | grep -v 'Mounted' > /tmp/fs.log
while read fs use avail per;
do
if [[ $(echo $per|cut -d% -f 1) -gt 65 ]]
then
mail -s "$fs in $(hostname) is over 65%" test@test.com
fi
done < /tmp/fs.log
# end
exit 0
It is good to put this script in cron schedular to execute per minute.
hth.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО05-18-2005 10:47 PM
тАО05-18-2005 10:47 PM
Re: script required to monitor disk space usage
For each filesystem, you can set the minimum amount of free space (I don't think you can give a percentage, unfortunately), and it can be configured to send you email when it crosses the limit.
See http://www.docs.hp.com/en/B7612-90015/index.html for more details.
Andrew