Operating System - HP-UX
1833006 Members
3202 Online
110048 Solutions
New Discussion

Single command to retrieve bdf

 
Kenn Chen
Advisor

Single command to retrieve bdf

Anyone can tell me how to retrieve bdf which having more than 90% usage. One single command to get the above wanted file system. bdf only list all the file system, but i only need to show 90% or above file system.
Cyber Zen
5 REPLIES 5
Carlos Fernandez Riera
Honored Contributor

Re: Single command to retrieve bdf

bdf | egrep "9[0-9]%|100%"
unsupported
Michael Tully
Honored Contributor

Re: Single command to retrieve bdf

Hi,

I would be inclinded to write a script
to do this. The attached should do the
job. It will e-mail the results.

df -kP | grep "%" | grep -v cdrom | grep 100% | cut -c49-80 > /tmp/chkfsu.txt
grep 100% /tmp/chkfsu.txt
if [ $? = 0 ]; then
mailx -s "`cat /tmp/chkfsu.txt` in `hostname`" sysadmin,dbadmin < /dev/null
else
echo Nothing is 100%
fi

df -kP | grep "%" | grep -v cdrom | grep 99% | cut -c49-80 > /tmp/chkfsu.txt
grep 99% /tmp/chkfsu.txt
if [ $? = 0 ]; then
mailx -s "`cat /tmp/chkfsu.txt` in `hostname`" sysadmin,dbadmin < /dev/null
else
echo Nothing is 99%
fi

This should help.
Anyone for a Mutiny ?
Robin Wakefield
Honored Contributor

Re: Single command to retrieve bdf

Hi Idris,

The following caters for those filesystems that span two lines, if necessary:

bdf | sed 's/^ */ /' | awk 'NF==1{f=$0;getline;$0=f$0}{print}' | grep -e "9[0-9]%" -e "100%"

Rgds, Robin.
Joseph Chakkery
Valued Contributor

Re: Single command to retrieve bdf

Hello,

try this one
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}'`"
echo $dmount
fi
done

Regards
Joe.
Knowledge is wealth
Randy Tarrier
Advisor

Re: Single command to retrieve bdf

Hi,
I wrote this to monitor a specific mount point for >= 93% full condition, but you can adapt it to examine the results of a bdf, and even assign different values for each mount point in the control file:
#!/bin/csh
# Test /ora4 for % full of archlog files
# archlog_pct.dat contains % range considered to be full
# If current % falls in range, launch ARCHLOG_TAR, unless it
# is already running
# Run frequency: daily, hourly

cd /oracle/ora_scripts/7.3.4
df -k /ora4 >archlog_curr_df.dat
grep '% ' archlog_curr_df.dat >archlog_curr_pct.dat
ps -ef >archlog_curr_ps

foreach k ("`fgrep -farchlog_pct.dat archlog_curr_pct.dat`")
if (`grep -c 'ARCHLOG_MOVE' archlog_curr_ps`) = 0 then
/oracle/ora_scripts/7.3.4/ARCHLOG_MOVE
endif
end
#

Regards,
Randy
Do it as long as you love it!