Random Project

More changes

– use $DATA instead of do the command again in every status
– add Shutoff status “because when the virtual host if off it’ll appear nothing”

DATA=`xm list $NAME | tail -1`
R=`echo “$DATA” | cut -c 64`
B=`echo “$DATA” | cut -c 65`
P=`echo “$DATA” | cut -c 66`
S=`echo “$DATA” | cut -c 67`
C=`echo “$DATA” | cut -c 68`
D=`echo “$DATA” | cut -c 69`

if [ -z $R ] || [ -z $B ] || [ -z $B ] || [ -z $P ] || [ -z $C ] || [ -z $D ]; then
echo “Critical – Virtual System is Shutoff”
exit 2
fi

if [ $R = “r” ] || [ $B = “b” ]; then
echo “OK – Virtual System is Up”
exit 0
fi

if [ $P = “p” ]; then
echo “Warning – Virtual System is Paused”
exit 1
fi

if [ $S = “s” ] || [ $C = “c” ] || [ $D = “d” ]; then
echo “Critical – Virtual System is Down”
exit 2

fi