最近有个需要,要通过zabbix 监控statuspage上没有resolved的 incident
statuspage提供了一个简单的api使用文档,真的是非常的节省页面
https://doers.statuspage.io/api/v1/
首先肯定是认证部分了,按照api的提示很容易就能找到pageid和apikey, 然后调用相应的url就能获得相应的结果
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
def query_banner_info(self): '''query status for unresovled banner''' url = "https://api.statuspage.io/v1/pages/" + self.pageid + "/incidents/unresolved.json" request = urllib2.Request(url) request.add_header("Authorization", "OAuth %s" % self.authid) try: result = urllib2.urlopen(request) result_d = result.read() data = json.loads(result_d) except: logger.error("something wrong when trying get the banner info") data = False return data |
Latest posts by Zhiming Zhang (see all)
- aws eks node 自动化扩展工具 Karpenter - 8月 10, 2022
- ReplicationController and ReplicaSet in Kubernetes - 12月 20, 2021
- public key fingerprint - 5月 27, 2021
广州网站建设 2018/08/28 10:39