#!/bin/bash
#####SHELL SCRIPT#######
##########VERITAS CLUSTER INFO##############
#####VERSION=1.0############################
##DESIGN&IMPLEMENTED:CHITTIBABU MIRIYALA#
#########################################
#echo "From:chitti.babu@gmail.com" >"/tmp/output1"
#echo "To:chitti.babu@yahoo.com" >"/tmp/output1"
HostNamee=`/opt/VRTSvcs/bin/hasys -list`
echo "Subject:VERITAS CLUSTER CONFIGURATION INFO: '`echo $HostNamee`'">>"/tmp/output1"
echo "Content-type: text/html">>/tmp/output1
echo "<html>">>"/tmp/output1"
echo "<body>">>"/tmp/output1"
echo "<table width=100%>">>"/tmp/output1"
echo "<tr bgcolor="#DAF7A6"><pre>" >>/tmp/output1
echo "<center><H3> CLUSTER INFORMATION </H3></center>" >>"/tmp/output1"
echo "</pre></tr>" >>/tmp/output1
echo "<tr bgcolor="#DAF7A6"><pre>" >>/tmp/output1
/opt/VRTSvcs/bin/hastatus -sum >>"/tmp/output1"
echo "</pre></tr>" >>/tmp/output1
echo "<tr bgcolor="#DAF7A6"><pre>" >>/tmp/output1
echo "<center><H3> SERVICE GROUP INFORMATION </H3></center>" >>"/tmp/output1"
echo "</pre></tr>" >>/tmp/output1
SGName=`/opt/VRTSvcs/bin/hagrp -list|grep -v "#Group"|awk '{ print $1}'|uniq`
i=0
y=0
for i in $SGName
do
STATUS=`/opt/VRTSvcs/bin/hagrp -state $i |grep -v "#Group"|uniq|awk '{ print $4}'|tr -d "\|"`
Color=0
for y in $STATUS
do
if [[ $y == "ONLINE" || $y == "OFFLINE" ]]
then
Color=0
else
Color=1
break
fi
done
if [[ $Color = 0 ]]
then
echo "<tr bgcolor="#DAF7A6"><pre>" >>/tmp/output1
/opt/VRTSvcs/bin/hagrp -state $i >>"/tmp/output1"
echo "</pre></tr>" >>/tmp/output1
else
echo "<tr bgcolor="#FF0000"><pre>" >>/tmp/output1
/opt/VRTSvcs/bin/hagrp -state $i >>"/tmp/output1"
echo "</pre></tr>" >>/tmp/output1
fi
done
echo "<tr bgcolor="#DAF7A6"><pre>" >>/tmp/output1
echo "<center><H3> RESOURCE INFORMATION </H3></center>" >>"/tmp/output1"
echo "</pre></tr>" >>/tmp/output1
echo "<tr bgcolor="#DAF7A6"><pre>" >>/tmp/output1
/opt/VRTSvcs/bin/hares -state >>"/tmp/output1"
echo "</pre></tr>" >>/tmp/output1
echo "<tr bgcolor="#DAF7A6"><pre>" >>/tmp/output1
echo "<center><H3> CLUSTER MOUNT POINT INFORMATION </H3></center>" >>"/tmp/output1"
echo "</pre></tr>" >>/tmp/output1
echo "<tr bgcolor="#DAF7A6"><pre>" >>/tmp/output1
cat /etc/VRTSvcs/conf/config/main.cf|egrep 'BlockDevice|MountPoint' >>"/tmp/output1"
echo "</pre></tr>" >>/tmp/output1
echo "<tr bgcolor="#DAF7A6"><pre>" >>/tmp/output1
echo "<center><H3> SERVER FILE SYSTEM UTILIZATION </H3></center>" >>"/tmp/output1"
echo "</pre></tr>" >>/tmp/output1
echo "<tr bgcolor="#DAF7A6"><pre>" >>/tmp/output1
#Mountp=`cat /etc/VRTSvcs/conf/config/main.cf|egrep 'MountPoint'|awk '{ print $3}'|tr -d \"`
#for i in $Mountp ; do /bin/df -k "$i"|grep -v Filesystem >> "/tmp/output1"; done
df -k >> "/tmp/output1"
echo "</pre></tr>" >>/tmp/output1
echo "</table>" >>"/tmp/output1"
echo "</body>">>"/tmp/output1"
echo "</html>">>"/tmp/output1"
cat "/tmp/output1"|/usr/sbin/sendmail -t
>"/tmp/output1"
#####SHELL SCRIPT#######
##########VERITAS CLUSTER INFO##############
#####VERSION=1.0############################
##DESIGN&IMPLEMENTED:CHITTIBABU MIRIYALA#
#########################################
#echo "From:chitti.babu@gmail.com" >"/tmp/output1"
#echo "To:chitti.babu@yahoo.com" >"/tmp/output1"
HostNamee=`/opt/VRTSvcs/bin/hasys -list`
echo "Subject:VERITAS CLUSTER CONFIGURATION INFO: '`echo $HostNamee`'">>"/tmp/output1"
echo "Content-type: text/html">>/tmp/output1
echo "<html>">>"/tmp/output1"
echo "<body>">>"/tmp/output1"
echo "<table width=100%>">>"/tmp/output1"
echo "<tr bgcolor="#DAF7A6"><pre>" >>/tmp/output1
echo "<center><H3> CLUSTER INFORMATION </H3></center>" >>"/tmp/output1"
echo "</pre></tr>" >>/tmp/output1
echo "<tr bgcolor="#DAF7A6"><pre>" >>/tmp/output1
/opt/VRTSvcs/bin/hastatus -sum >>"/tmp/output1"
echo "</pre></tr>" >>/tmp/output1
echo "<tr bgcolor="#DAF7A6"><pre>" >>/tmp/output1
echo "<center><H3> SERVICE GROUP INFORMATION </H3></center>" >>"/tmp/output1"
echo "</pre></tr>" >>/tmp/output1
SGName=`/opt/VRTSvcs/bin/hagrp -list|grep -v "#Group"|awk '{ print $1}'|uniq`
i=0
y=0
for i in $SGName
do
STATUS=`/opt/VRTSvcs/bin/hagrp -state $i |grep -v "#Group"|uniq|awk '{ print $4}'|tr -d "\|"`
Color=0
for y in $STATUS
do
if [[ $y == "ONLINE" || $y == "OFFLINE" ]]
then
Color=0
else
Color=1
break
fi
done
if [[ $Color = 0 ]]
then
echo "<tr bgcolor="#DAF7A6"><pre>" >>/tmp/output1
/opt/VRTSvcs/bin/hagrp -state $i >>"/tmp/output1"
echo "</pre></tr>" >>/tmp/output1
else
echo "<tr bgcolor="#FF0000"><pre>" >>/tmp/output1
/opt/VRTSvcs/bin/hagrp -state $i >>"/tmp/output1"
echo "</pre></tr>" >>/tmp/output1
fi
done
echo "<tr bgcolor="#DAF7A6"><pre>" >>/tmp/output1
echo "<center><H3> RESOURCE INFORMATION </H3></center>" >>"/tmp/output1"
echo "</pre></tr>" >>/tmp/output1
echo "<tr bgcolor="#DAF7A6"><pre>" >>/tmp/output1
/opt/VRTSvcs/bin/hares -state >>"/tmp/output1"
echo "</pre></tr>" >>/tmp/output1
echo "<tr bgcolor="#DAF7A6"><pre>" >>/tmp/output1
echo "<center><H3> CLUSTER MOUNT POINT INFORMATION </H3></center>" >>"/tmp/output1"
echo "</pre></tr>" >>/tmp/output1
echo "<tr bgcolor="#DAF7A6"><pre>" >>/tmp/output1
cat /etc/VRTSvcs/conf/config/main.cf|egrep 'BlockDevice|MountPoint' >>"/tmp/output1"
echo "</pre></tr>" >>/tmp/output1
echo "<tr bgcolor="#DAF7A6"><pre>" >>/tmp/output1
echo "<center><H3> SERVER FILE SYSTEM UTILIZATION </H3></center>" >>"/tmp/output1"
echo "</pre></tr>" >>/tmp/output1
echo "<tr bgcolor="#DAF7A6"><pre>" >>/tmp/output1
#Mountp=`cat /etc/VRTSvcs/conf/config/main.cf|egrep 'MountPoint'|awk '{ print $3}'|tr -d \"`
#for i in $Mountp ; do /bin/df -k "$i"|grep -v Filesystem >> "/tmp/output1"; done
df -k >> "/tmp/output1"
echo "</pre></tr>" >>/tmp/output1
echo "</table>" >>"/tmp/output1"
echo "</body>">>"/tmp/output1"
echo "</html>">>"/tmp/output1"
cat "/tmp/output1"|/usr/sbin/sendmail -t
>"/tmp/output1"
No comments:
Post a Comment