Shell Scripts

[Shell Script] – Check Gossip status on Cassandra node

#! /bin/sh
# Check Gossip status on Cassandra Node
#-----------------------------------------------------------------------------------------
# Get the hostname and set all letters to uppercase
HOSTNAME=$(hostname | /usr/bin/tr '[a-z]' '[A-Z]')

MAILTO="Your_Email_Id@gmail.com"

ipadr=$(/sbin/ifconfig  | grep 'inet'| grep -v '127.0.0.1' | awk 'FNR==2{print $0} ' |awk '{ print $2}')
node_ip=$(hostname -i)

nodetool statusgossip >/logs/node_gossip_status.out

Count=`cat /logs/node_gossip_status.out | grep 'running' | wc -l`

if [ $Count -ne 1 ]; then

 echo "Cassandra Database [Critical] Alet : Gossip is not running on $node_ip at $(date)", Please check immediately |mail  -s "[Critical] Alert: Gossip is not running on $node_ip " $MAILTO
else
 echo "Gossip is running on $node_ip"
fi
Review
4
Comments Rating 0 (0 reviews)

About the author

BestTechReads

Add Comment

Click here to post a comment

Sending

Categories

Categories