Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

aix capacity report disk space ?

Status
Not open for further replies.

alexia32

Technical User
Jul 31, 2007
156
NZ
Hi guys,

could you tell me what you use when you do a capacity reporting on your aix system for disks ?
I have to do it on my aix servers 5.2..

Thanks for any help advice etc...

Cheers
Al
 
For filesystems df -g will give you a summary of available, used and free space (in Gb) and inodes.

I want to be good, is that not enough?
 
I use this script:

Code:
df -Pk | awk '$3 ~ /[0-9]/ { print $1,"\t",$3,"\t",substr($5,1,index($5,"%")-1)
}' > df.out

set -A new1 $( awk ' {print $1}' df.out )
set -A new2 $( awk ' {print $2}' df.out )
set -A new3 $( awk ' {print $3}' df.out )

if [[ ! -s out ]]
then
j=0;
cat /dev/null > out
while [[ $j -lt ${#new1[*]} ]]
do
print "${new1[$j]}\t${new2[$j]}" >> out
((j+=1))
done
fi

set -A old1 $( awk ' {print $1}' out )
set -A old2 $( awk ' {print $2}' out )

cat /dev/null > email.txt
i=0;
while [[ $i -lt ${#old1[*]} ]]
do
j=0;
while [[ $j -lt ${#new1[*]} ]]
do
if [[ ${old1[$i]} = ${new1[$j]} ]]
then
if [[ ${old2[$i]} -lt ${new2[$j]} ]]
then
(( temp = ${new2[$j]} - ${old2[$i]} ))
print "${old1[$i]} was increased in size by ${temp}KByte" >> email.txt
break
fi
fi
((j+=1))
done
((i+=1))
done


j=0;
cat /dev/null > out
while [[ $j -lt ${#new1[*]} ]]
do
# This if statement is for Handling exceptions
#(where not to check for higher than 95% filesystems)
if [[ ${new1[$j]} != "test:/orastg" ]]
then
if [[ ${new3[$j]} -ge 95 ]]
then
print "WARNING: ${new1[$j]} is ${new3[$j]}% utilized!!!" >> email.txt
fi
fi
print "${new1[$j]}\t${new2[$j]}" >> out
((j+=1))
done

#cat email.txt

if [[ -s email.txt ]]
then
mail -s "Daily Status Report" "khalid@company.com" < email.txt
fi

# History
echo "======================================================================" >>
 history.out
date >> history.out
echo "======================================================================" >>
 history.out
cat email.txt >> history.out
echo "======================================================================" >>
 history.out
df -Pg >> history.out

# Maintain the size of the history.out file to be 3000 lines only
tail -3000 history.out > temp.out
mv temp.out history.out

Regards,
Khalid
 
This is a handy one liner

print "$(lsvg -Lo |xargs lsvg -L|grep "TOTAL PPs"|awk -F"(" '{print$2}'|sed -e "s/)//g" -e "s/megabytes/+/g"|xargs|sed -e "s/^/(/g" -e "s/+$/)\/1000/g"|bc ) GB"

sub TOTAL for USED or FREE

Mike

"Whenever I dwell for any length of time on my own shortcomings, they gradually begin to seem mild, harmless, rather engaging little things, not at all like the staring defects in other people's characters."
 
Hi,
here is the script we use; it checks for all filesystems but the ones in the exclude list which are filled up >= the value given in the variable THRESHOLD. Filesystems which are usually filled above the threshold and don't tend to grow might be a good choice for the exclude list too.
The script is independent from where the column with the %Used is (we had problems having sometimes a different "number of field (NF)" and it does not use df's -P because we had buggy versions of df that didn't recognize -P and so did nothing at all when executing.
We call it about every half an hour via cron.

Here we go:
Code:
MAILTO="tom@lala.org"

THRESHOLD=95
TMP_FILE=/tmp/platz.bla.tmp

## Add additional EXCLUDES with '|'
EXCLUDES='proc|mnt'


df | \
grep -vE "\/$EXCLUDES" | \
awk -v threshold=$THRESHOLD '
        BEGIN {
                # Create the header
                printf("%-50s%6s\n","Filesystem:","Filled:")
        }
        # Check which NF has the "%Used"
        NR == 1 {
                for (z=1; z < NF; z++) {
                        if ( $z == "%Used" ) {field=z}
                }
        }
        NR > 1 {
                filled=substr($feld,0,length($feld)-1)
                if ( filled >= threshold ) {
                        printf("%-50s%6s\n",$NF,$field)
                }
        }' > $TMP_FILE

if [[ -e $TMP_FILE && `wc -l $TMP_FILE| awk '{print $1}'` -gt 1 ]]; then
        mail -s "Check filesystems - look at the mail body for details." $MAILTO < $TMP_FILE
else
        echo "Nothing happened."
fi

exit 0

laters
zaxxon
 
Thanks Guys
I appreciate your help.
Cheers
Al.
 
Oops, just saw I forgot to "translate" 2 variables. "feld" is german for "field", so the line

Code:
filled=substr($feld,0,length($feld)-1)
should be
Code:
filled=substr($field,0,length($field)-1)

It should work proper then ;)

laters
zaxxon
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top