- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Re: BDF notification script
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
тАО01-15-2004 11:24 PM
тАО01-15-2004 11:24 PM
BDF notification script
scripting is not my strongest point and i am trying to get this script to work, i do believe in trying to keep things simple.
i have written a script to check the bdf output and email if the output exceeds 95%.
the problem is that although the script works and emails, it still emails if the check has produced no output due to there being no filesystems in excess of 95%.
what do i need to do to get the test to work correctly or have i made a mistake in how i am testing it.
attached is the script
regards
andrew
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО01-15-2004 11:42 PM
тАО01-15-2004 11:42 PM
Re: BDF notification script
So you should do:
bdf | awk ' $5 >= 95 {print $5,$6 }' > /tmp/filesystem_check_file
while read ARG1 ARG2
do
echo "the following Filesystem has exceeded 90 percent and is currently at : "$ARG1", filesystem: "$ARG2" " | mailx -s "Filesystem Problem" email addressxxxxxxxxxxxxx
done< "$parameter_file"
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО01-15-2004 11:58 PM
тАО01-15-2004 11:58 PM
Re: BDF notification script
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО01-16-2004 12:05 AM
тАО01-16-2004 12:05 AM
Re: BDF notification script
#######Begin
{
bdf | grep -v Filesystem | awk '{ print $1 " " $5-1 }' | while read fsys per
do
if [ $per -gt 95 ]
then
echo $fsys $per
fi
done
} | mailx -s "filesystem more then 95% used" email@yourdomain.com
######End
Regards,
Peter Geluk
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО01-16-2004 12:09 AM
тАО01-16-2004 12:09 AM
Re: BDF notification script
I don't know why it doesn't work but in attachment you will see BDF notification script that I am using...
I hope this helps you.
Best regards,
Ettore
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО01-16-2004 12:12 AM
тАО01-16-2004 12:12 AM
Re: BDF notification script
I think why its not working is that $5 contains for exmpl: "96%" and not "96"
Regards,
Peter
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО01-16-2004 01:04 AM
тАО01-16-2004 01:04 AM
Re: BDF notification script
regards
andrew
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО01-16-2004 01:09 AM
тАО01-16-2004 01:09 AM
Re: BDF notification script
the % make it doesn't work.
Sometimes the line is cut too.
bdf | tr "%" " "| ' ((NR>1)&&(NF>2)&& ($(NF-1) >= 50 )){print $(NF-1),$NF }'|
while read ARG1 ARG2
do
echo "the following Filesystem has exceeded 90 percent and is currently at : "$ARG1", filesystem: "$ARG2" " | mailx -s "Filesystem Problem" email addressxxxxxxxxxxxxx
done
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО01-16-2004 01:18 AM
тАО01-16-2004 01:18 AM
Re: BDF notification script
I think your problem might be related with something else. Please check your bdf output if all filesystems are on 1 line of output. Sometimes (especially with NFS mounts) the output can be spread over multiple lines.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО01-16-2004 01:24 AM
тАО01-16-2004 01:24 AM
Re: BDF notification script
just test
echo "100% 1\n95% 2" |awk ' $1>95 { print $0 }'
It will print
95% 2
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО01-16-2004 02:47 AM
тАО01-16-2004 02:47 AM
Re: BDF notification script
Adrew, I did not test your script, but when I was testing my script, I only did a print of $5 and saw that it include the % sign so I thougth the test on the greater or equal then 95 went wrong.
One remark on my script is that it always will send an email, also when none of the filesystems are above 95% used.
You can simply replace the mailx by a redirect in a file and test the linecount of the file before sending the mail.
Hopes this helps, regards,
Peter
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО01-16-2004 03:46 AM
тАО01-16-2004 03:46 AM
Re: BDF notification script
Didn't have time to read the thread posting. Apologies if its redundant.
SEP
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО01-16-2004 04:07 AM
тАО01-16-2004 04:07 AM
Re: BDF notification script
Using 'awk' on bdf may not give 100% results particularly if you have the longer logical volumes.
I would use df like below.
THRESHOLD=90
PERCENT=$(df -k /filesystem|awk '/allocation used/ {print $1}')
if [ $PERCENT -ge 90 ]
then
do_your_action
fi
-Sri
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО01-16-2004 04:48 AM
тАО01-16-2004 04:48 AM
Re: BDF notification script
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО01-16-2004 06:32 AM
тАО01-16-2004 06:32 AM
Re: BDF notification script
Here is a portion of a script I use for disk space notifications:
# Check disk space
echo "\nChecking directory capacities:" >> $BASE/checklist.log
bdf | grep "^/dev" | while read line
do
set $line
PCT=0
PCT=$(echo $3 $2 | awk '{printf "%10.0f",$1/$2*100}')
if [ $PCT -ge 80 ] ; then
echo "$line" >> $BASE/checklist.log
echo "$line" >> $BASE/dskchecklist
fi
done
echo "\nAll directories have been checked." >> $BASE/checklist.log
echo "If necessary, the Admins have been notified." >> $BASE/checklist.log
"checklist.log" is mailed to me (it has other stuff logged into it as well.
"dskchecklist" is mailed to the "resource hogs." :)
You'll also notice my threshold is 80%.
D
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО01-16-2004 06:39 AM
тАО01-16-2004 06:39 AM
Re: BDF notification script
If you really want notification though, and can't afford HP OpenView, why not get Big Brother:
http://bb4.com/
Easy to setup, gives you notification and a web page view of current devices.
BTW - it uses df for disk threshholds.
Rgds...Geoff