1753930 Members
9514 Online
108810 Solutions
New Discussion

Cluster Status

 
spalkumar
Occasional Contributor

Cluster Status

Hello Expert,

I have 3 servers and want to create health check bash script in CSV format. I have tried as below but the hostname is not coming new line. Below script which I have created.

#!/bin/bash
EMAIL=''
function clusterlog {

export TIME=`date +%d-%m-%Y_%H.%M.%S`
for server in $(cat cm); do
#echo " ============================================="
#echo " $server"
#remsh $server hostname
#echo " ============================================="
echo " $server," && remsh $server /usr/sbin/cmviewcl|grep -i "down"|awk '{ if ( -n $1 ) { print $1; print ","; print 1 } else { print $1; print 0 } }'

done
}

FILENAME="/tmp/cluster/Cluster_log-`hostname`-`date +%y%m%d`.txt"

if [ -f $FILENAME ]; then
ls -l $FILENAME
echo "----The cluster_log file is already exist---"
> $FILENAME
echo "----The cluster_log file contents is purged successfully---"
else
echo "The file does not currently exist ...... You may proceed"
fi

clusterlog >> $FILENAME
echo "Reported file $FILENAME generated in current directory."

testserver >cat cm
192.168.1.5
192.168.1.6

log output:

p1bkp>cat Cluster_log-p1bkp-190604.txt
192.168.1.5,
test1
,
1
192.168.1.6,
test2
,
1
expected output as below:

IPaddress,Servername,

IPaddress,Servername,

 

 

1 REPLY 1
Srinath_Raju
HPE Pro

Re: Cluster Status

Hi SpalKumar,

Breakfix team does not support scripting. I understand that this is related to the cluster. Any assistance related to cluster, you will have to engage either Microsoft or your OS vendor.

Regards

Sr

 

I am a HPE Employee

Accept or Kudo