- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Re: while bdf ...........
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
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
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
тАО12-20-2004 10:44 AM
тАО12-20-2004 10:44 AM
I have a file system that shoots up when it is being written to.
I want to write a small program that I can run while on shift to monitor the file system:
can anyone help? I was going to use a while loop?
Ta
Solved! Go to Solution.
- Tags:
- bdf
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО12-20-2004 12:32 PM
тАО12-20-2004 12:32 PM
Re: while bdf ...........
#!/usr/bin/sh
while true
do
bdf /filesystem
sleep 30
done
Save that with some filename. Do a 'chmod 700 filename' on it and then invoke as:
# ./filename
That will run a bdf every 30 seconds. Just change the sleep command to run it more or less often. Just
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО12-20-2004 12:53 PM
тАО12-20-2004 12:53 PM
Re: while bdf ...........
almost what I'm looking for,
when the bdf reach's 70% i need it to mail me
# bdf |grep /data/oracle/exports| awk '{print $5;getline}'
this outputs filesystem %
when it is over 70% i want it to mail me
while true
read
bdf |grep /data/oracle/exports| awk '{print $5;getline}'
do
if ??
then
echo "alert" |mail user@address
fi
done.
Am I on the right lines?
cheers
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО12-20-2004 01:24 PM
тАО12-20-2004 01:24 PM
Solution> while true
> read
> bdf |grep /data/oracle/exports| awk '{print $5;getline}'
> do
> if ??
> then
> echo "alert" |mail user@address
> fi
> done
There are several problems. The first is that running this script with no delays will absolutely kill all performance on your system. And of course, you'll get THOUSANDS of email messages in just a few minutes because the script doesn't exit after the email, or change the limit.
bdf is a VERY invasive command that (as written) searches every mounted filesystem to analyze all the current space. This includes NFS mountpoints, CDROMs, everything. So start by eliminating your grep and use a seldom-used feature of bdf:
bdf /data/oracle/exports
Now you'll get just one line with a header (and a much lower load on the system). To see just the last line, add tail -1 as in:
bdf /data/oracle/exports | tail -1
Then you can drop awk and use shell builtins to parse the bdf line like this:
bdf /data/oracle/exports tail -1 | read SRC SIZ USED AVAIL PCT MNT
Now the variable PCT has the percentage string. Run it through tr to remove the % and now you can test the result:
echo $PCT | tr -d %
So your script is now:
LIMIT=70
while :
do
bdf /data/oracle/exports tail -1 | read SRC SIZ USED AVAIL PCT MNT
if [ $(echo $PCT | tr -d %) -gt $LIMIT ]
then
echo "alert" |mail user@address
exit
fi
sleep 600
done
So this script will check bdf every 300 seconds (10 minutes) and send you one email when it goes over $LIMIT (70%). This is a very common sysadmin task and should be run on all the filesystems on a production server, not just the Oracle data. If /var fills up, a *LOT* of things will instantly break.
Bill Hassell, sysadmin
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО12-20-2004 01:26 PM
тАО12-20-2004 01:26 PM
Re: while bdf ...........
Bill Hassell, sysadmin
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО12-20-2004 01:38 PM
тАО12-20-2004 01:38 PM
Re: while bdf ...........
lawzo