Simple elastic search cluster monitoring

Hello guys,
a little contribution from myself, a simple/quick script to monitor your cluster, tested on centos 7 / ES 7.11.2 :relaxed:

You can easily cron it :
*/5 * * * * /root/ >> /root/ES_health.log

RESULT=`curl -s -XGET 'http://masterip:9200/_cluster/stats?pretty=true' -u elastic:pwd | grep -i "\"status\" : \"green\"" | wc -l`
DIAG=`curl -s -XGET 'http://masterip:9200/_cluster/stats?pretty=true' -u elastic:pwd`
CURDATE=`date "+%Y/%m/%d %H:%M:%S"`;
if [[ $RESULT != "1" ]]
# if status not green
echo "$CURDATE : $RESULT";

# notify ENABLED
echo $DIAG | mail -s "$HOST ES cluster KO"

# if status green
echo "$CURDATE : $RESULT";

# notify DISABLED
#echo $DIAG | mail -s "$HOST ES cluster OK"


This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.