Sunteți pe pagina 1din 2

#!

/usr/bin/ksh
################################################################################
# Space.sh(ver1.0)
#
# Check the space,clearcase & buildforge agent at the host
#
# Debi
#
# 17-Jan-2011
#
################################################################################
#Export the hostname,filesystem,mount option,space used & space free at /appl/re
tek
#Variable used for these are:
#S=SERVER/HOST NAME
#V2=FILE SYSTEM
#V3=MOUNTED info.
#V4=SPACE USED in percentage
#V5=SPACE FREE in percentage
#V6=clearcase albd_server from the standard AIX ps command
#V7=buildforge status from the current network status
#V8=LISTEN connection at the host
#b=bold character
#of=off the character set
#FG=Foreground green for each succesful status
#FR=Foreground red for each unsuccessful status

export S=`hostname` #export the host name


port=9910 #set the buildforge port id
TH=95 #set the space thershold limit to 9
0%
v2=`df -k "/appl/retek" |awk 'NR==2{print}'| awk -F " " '{print$1}'`
v3=`df -k "/appl/retek" |awk 'NR==2{print}'| awk -F " " '{print$7}'`
v4=`df -g "/appl/retek" |awk 'NR==2{print}'| awk -F " " '{print$4}'|sed 's/%//g'
`
v5=`df -g "/appl/retek" |awk 'NR==2{print}'| awk -F " " '{print$3}'`
b=`tput bold`
of=`tput rmso`
FG=`echo "\033[36m"`
FR=`echo "\033[31m"`
#Set the check limit of the space to 95%
if [ $v4 -gt $TH ]
then
echo "SERVER:${b}${FG}$S${of}\nFILE SYSTEM:${b}${FG}${v2}${of}\nMOUNTED ON:${b}$
{FG}$v3${of}\nSPACE USED:${b}${FR}$v4%${of}\nSPACE FREE:${b}${FG}$v5%${of}"
else
echo "SERVER:${b}${FG}$S${of}\nFILE SYSTEM:${b}${FG}${v2}${of}\nMOUNTED ON:${b}$
{FG}$v3${of}\nSPACE USED:${b}${FG}$v4%${of}\nSPACE FREE:${b}${FG}$v5%${of}"
fi
#checking the clearcase status at the server
v6=`ps -ef|grep albd |awk 'NR==1{print}'|awk -F " " '{print$9}'`
if [ `basename $v6` == "albd_server" ]
then
echo "CLEARCASE STATUS:${b}${FG}Clearcase is running at $S......${of}"
else
echo "CLEARCASE STATUS:${b}${FR}Clearcase is not running at $S ,start clearcase
services......${of}"
fi
#checking the Buildforge agent at the server
v7=`netstat -an|grep LISTEN|grep $port|awk 'NR==1{print}'|awk -F " " '{print$4}'
|awk -F "." '{print$2}'`
v8=`netstat -an|grep LISTEN|grep $port|awk 'NR==1{print}'|awk -F " " '{print$6}'
`
if [ $v7 -eq $port && $v8 == "LISTEN" ]]
then
echo "BUILDFORGE STATUS:${b}${FG}Buildforge is running at $S......${of}"
else
echo "BUILDFORGE STATUS:${b}${FR}Buildforge is not running at $S......${of}"
fi

S-ar putea să vă placă și