zabbix监控es集群健康状态(python2.7)

import commands,re
command = 'curl xxx.xxx.xxx.xxx:9200/_cat/health'
a,b=commands.getstatusoutput(command)
if re.search('green',b):
    x=1
elif re.search('red',b):
    x=2
else: 
    x=3
print x

返回1:为健康

返回2:有节点损坏,

返回3:数据丢失

posted @ 2018-10-12 10:16  呦吼吼吼~  阅读(536)  评论(0编辑  收藏  举报