falcon插件python脚本

#!/usr/bin/python
#coding=utf-8
import requests,simplejson
import time,datetime
import socket
hostname = socket.gethostname()
#print hostname
timestamp = int(time.time())
try:
req = requests.get(‘http://127.0.0.1:80/api/check/checktime’)
res_dict = simplejson.loads(req.text)
status = res_dict[‘code’]
except Exception as e:
if e:
status = 1
payload = [
{
“endpoint”:hostname,
“metric”:“php-status”,
“timestamp”:timestamp,
“step”:60,
“value”: status,
“counterType”:“GAUGE”,
“tags”:""
}
]
uri = “http://127.0.0.1:1988/v1/push”
requests.post(uri,json=payload)

相关文章:

  • 2022-12-23
  • 2022-01-24
  • 2021-11-14
  • 2021-12-18
  • 2021-10-04
  • 2021-09-18
猜你喜欢
  • 2021-12-17
  • 2021-12-29
  • 2021-10-16
  • 2021-12-23
  • 2021-10-25
  • 2022-12-23
相关资源
相似解决方案