- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Re: help regarding bdf output shell script !!!!
Operating System - HP-UX
1752643
Members
5737
Online
108788
Solutions
Forums
Categories
Company
Local Language
юдл
back
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Discussions
Discussions
Forums
Forums
Discussions
юдл
back
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
Blogs
Information
Community
Resources
Community Language
Language
Forums
Blogs
Go to solution
Topic Options
- 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
тАО11-16-2007 04:30 AM
тАО11-16-2007 04:30 AM
Re: help regarding bdf output shell script !!!!
Sorry, attachments are not working in the forums today, get your copy from:
http://forums1.itrc.hp.com/service/forums/questionanswer.do?threadId=1124262
Bill Hassell, sysadmin
http://forums1.itrc.hp.com/service/forums/questionanswer.do?threadId=1124262
Bill Hassell, sysadmin
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО11-16-2007 05:24 AM
тАО11-16-2007 05:24 AM
Re: help regarding bdf output shell script !!!!
I hve used Bill'd bdfmegs quite successfully.
Here is one we have in production on all machines. It runs on Monday and Friday and looks for 80+% full as well as chack one particular vg.
Regards,
-dl
#!/usr/bin/ksh
#############################################################################
# 12/24/01 dlamar Scan % full for lvols #
# If over the threshold email sysadm #
# 08/21/02 dlamar Changed MAIL_LIST #
# 12/18/02 dlamar Added status of job home to daily report. #
# 12/26/02 dlamar Cleaned up the rm of .txt and .rpt. #
# 06/04/2003 dlamar Added logic to ignore cdrom. #
# 10/08/2003 rmark Corrected logic to check jobprod #
# #
#############################################################################
SCRIPT_HOME="/usr/local/bin/systems"
MAIL_LIST="your_email_address@somewhere.com"
if [ -f $SCRIPT_HOME/percent_full.txt ]
then
rm $SCRIPT_HOME/percent_full.txt
fi
if [ -f $SCRIPT_HOME/percent_full.rpt ]
then
rm $SCRIPT_HOME/percent_full.rpt
fi
echo "\t\t$(hostname)\tSYSTEM/JOB\tDISK\tSTATUS\tREPORT\t`date +%m/%d/%y`\n" > $SCRIPT_HOME/percent_full.rpt
bdf |while read diski
do
dper=`echo $diski | awk -F" " '{printf "%d\n", $5}'`
if [ $dper -gt 80 ]
then
dmount="`echo $diski |awk '{printf "%s\n", $6}'`"
if ( test "$dmount" != "/cdrom" )
then
echo "\t\t\t\t$dmount\t\t$dper% \n" >> /$SCRIPT_HOME/percent_full.txt
fi
fi
done
bdf | grep 0_40 | cut -c48-49 | sed '1d' | read job_percent
if [ $job_percent -gt 80 ]
then
bdf | grep 0_40 | cut -c48-66 | sed '1d' | read jobdir
echo "\t\t\t\t/jobprod\t\t$jobdir \n" >> /$SCRIPT_HOME/percent_full.txt
fi
if [ -f $SCRIPT_HOME/percent_full.txt ]
then
cat /$SCRIPT_HOME/percent_full.txt >> /$SCRIPT_HOME/percent_full.rpt
ux2dos $SCRIPT_HOME/percent_full.rpt | uuencode Lvols_Nearing_full.txt | mailx -m -s "JOBPROD Home & Lvols Over 80% Full on $(hostname)" $MAIL_LIST
fi
Here is one we have in production on all machines. It runs on Monday and Friday and looks for 80+% full as well as chack one particular vg.
Regards,
-dl
#!/usr/bin/ksh
#############################################################################
# 12/24/01 dlamar Scan % full for lvols #
# If over the threshold email sysadm #
# 08/21/02 dlamar Changed MAIL_LIST #
# 12/18/02 dlamar Added status of job home to daily report. #
# 12/26/02 dlamar Cleaned up the rm of .txt and .rpt. #
# 06/04/2003 dlamar Added logic to ignore cdrom. #
# 10/08/2003 rmark Corrected logic to check jobprod #
# #
#############################################################################
SCRIPT_HOME="/usr/local/bin/systems"
MAIL_LIST="your_email_address@somewhere.com"
if [ -f $SCRIPT_HOME/percent_full.txt ]
then
rm $SCRIPT_HOME/percent_full.txt
fi
if [ -f $SCRIPT_HOME/percent_full.rpt ]
then
rm $SCRIPT_HOME/percent_full.rpt
fi
echo "\t\t$(hostname)\tSYSTEM/JOB\tDISK\tSTATUS\tREPORT\t`date +%m/%d/%y`\n" > $SCRIPT_HOME/percent_full.rpt
bdf |while read diski
do
dper=`echo $diski | awk -F" " '{printf "%d\n", $5}'`
if [ $dper -gt 80 ]
then
dmount="`echo $diski |awk '{printf "%s\n", $6}'`"
if ( test "$dmount" != "/cdrom" )
then
echo "\t\t\t\t$dmount\t\t$dper% \n" >> /$SCRIPT_HOME/percent_full.txt
fi
fi
done
bdf | grep 0_40 | cut -c48-49 | sed '1d' | read job_percent
if [ $job_percent -gt 80 ]
then
bdf | grep 0_40 | cut -c48-66 | sed '1d' | read jobdir
echo "\t\t\t\t/jobprod\t\t$jobdir \n" >> /$SCRIPT_HOME/percent_full.txt
fi
if [ -f $SCRIPT_HOME/percent_full.txt ]
then
cat /$SCRIPT_HOME/percent_full.txt >> /$SCRIPT_HOME/percent_full.rpt
ux2dos $SCRIPT_HOME/percent_full.rpt | uuencode Lvols_Nearing_full.txt | mailx -m -s "JOBPROD Home & Lvols Over 80% Full on $(hostname)" $MAIL_LIST
fi
"I'm not dumb. I just have a command of thoroughly useless information."
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО11-16-2007 05:41 AM
тАО11-16-2007 05:41 AM
Re: help regarding bdf output shell script !!!!
Here's a wrapper script I've written around Bill's bdfmegs.sh:
#!/usr/bin/sh
typeset -i MAXPCT=95
typeset -i TIMEOUT=1 # number of days to retain LOCKFILE
BDFMEGS=/root/scripts/util/bdfmegs.sh
TEMPFILE=/tmp/check_filesystem_usage.${$}.tmp
LOCKFILE=/tmp/check_filesystem_usage.lck
# rm LOCKFILE if mtime > ${TIMEOUT}, so that duplicate reports will be generated, on occasion
find ${LOCKFILE} -type f -mtime +${TIMEOUT} -print | xargs rm -f 2> /dev/null
[ ! -f ${LOCKFILE} ] && touch ${LOCKFILE}
trap "[ -f ${TEMPFILE} ] && rm -f ${TEMPFILE}" 0 1 2 3 15
${BDFMEGS} -qglP ${MAXPCT} | grep -v '^$' > ${TEMPFILE}
if [ -s ${TEMPFILE} ]
then
$(grep -q -v -f ${LOCKFILE} ${TEMPFILE}) && \
{ grep -v -f ${LOCKFILE} ${TEMPFILE} >> ${LOCKFILE}
mailx -m -s "WARNING! FILESYSTEM(S) OVER ${MAXPCT}% FULL!" root << EOF
File-System Gbytes Used Avail %Used Mounted on
$(cat ${TEMPFILE})
Remember to delete ${LOCKFILE} after freeing up space!
EOF
}
# exit with rc of 1 if any filesystems with utilization > ${MAXPCT} were returned
exit 1
fi
# otherwise, exit with rc of 0
exit 0
#!/usr/bin/sh
typeset -i MAXPCT=95
typeset -i TIMEOUT=1 # number of days to retain LOCKFILE
BDFMEGS=/root/scripts/util/bdfmegs.sh
TEMPFILE=/tmp/check_filesystem_usage.${$}.tmp
LOCKFILE=/tmp/check_filesystem_usage.lck
# rm LOCKFILE if mtime > ${TIMEOUT}, so that duplicate reports will be generated, on occasion
find ${LOCKFILE} -type f -mtime +${TIMEOUT} -print | xargs rm -f 2> /dev/null
[ ! -f ${LOCKFILE} ] && touch ${LOCKFILE}
trap "[ -f ${TEMPFILE} ] && rm -f ${TEMPFILE}" 0 1 2 3 15
${BDFMEGS} -qglP ${MAXPCT} | grep -v '^$' > ${TEMPFILE}
if [ -s ${TEMPFILE} ]
then
$(grep -q -v -f ${LOCKFILE} ${TEMPFILE}) && \
{ grep -v -f ${LOCKFILE} ${TEMPFILE} >> ${LOCKFILE}
mailx -m -s "WARNING! FILESYSTEM(S) OVER ${MAXPCT}% FULL!" root << EOF
File-System Gbytes Used Avail %Used Mounted on
$(cat ${TEMPFILE})
Remember to delete ${LOCKFILE} after freeing up space!
EOF
}
# exit with rc of 1 if any filesystems with utilization > ${MAXPCT} were returned
exit 1
fi
# otherwise, exit with rc of 0
exit 0
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО02-18-2010 02:11 AM
тАО02-18-2010 02:11 AM
Re: help regarding bdf output shell script !!!!
thanks
- « Previous
-
- 1
- 2
- Next »
The opinions expressed above are the personal opinions of the authors, not of Hewlett Packard Enterprise. By using this site, you accept the Terms of Use and Rules of Participation.
News and Events
Support
© Copyright 2024 Hewlett Packard Enterprise Development LP