#!/usr/bin/python#! --*-- coding:utf-8 --*--import requestsimport timeimport jsonimport sysimport commandsts = int(time.time())#print tscmd = 'curl 172.31.0.92:9200/_cat/health'(a, b) = commands.getstatusoutput(cmd)#print bstatus= b.split(' ')[157]if status=='green':    healthy=3elif status=='yellow':    healthy=2elif status=='red':    healthy=1else:     healthy=0#print healthypayload = [    {        "endpoint": "TBK01",        "metric": "elasticsearch_status",        "timestamp": ts,        "step": 60,        "value": 1,        "counterType": "GAUGE",        "tags": "status=green",    }]r = requests.post("http://127.0.0.1:1988/v1/push", data=json.dumps(payload))#print r.text