import requests
url = "http://{ip}:{port}/api/v1/influxdb_query/"
data = {"sql":"infudb sql"}
res = requests.post(url, data)
print res.content
4.1.3.3 数据返回
4.2 接收数据
4.2.1 请求接口
请求方式:POST请求
URL地址:http://{ip}:{port}/api/v1/insert/third
ip:封神ecs_ip
port:9170
PARAM:
4.2.2 DEMO
import sys
import requests
url = "http://172.0.0.1:9170/api/v1/insert/third/"
data = {"title":"ecs性能监控", "level":"预警", "source":"云监控", "product":"ecs", "msg":"ip:10.0.0.1 cpu:98% ip:127.0.0.1 mem:99%", "robot":"姜子牙", "submitor":"高德臣", "monitor_time":"2021-03-10 16:00:00", "details":"兄弟 关注下"}
res = requests.post(url=url, json=data)
print res.text
4.2.3 告警展示
图8:告警展示图
参考文章
[1] 封神榜部署前置检查:https://yuque.antfin-inc.com/docs/share/d3a743db-af85-47d2-89c5-4f22eb1693c5?
[2] 获取封神数据-三方API:https://yuque.antfin-inc.com/docs/share/2037fbb2-35fa-42ad-8476-ec7502e9ed33?#
本文为阿里云原创内容,未经允许不得转载。