python tengine upstream_check_status

import json
import urllib.request
check_url = r'http://101.226.171.158/upstream_check_status?format=json'
check_req = urllib.request.Request(check_url)
check_res = urllib.request.urlopen(check_req).read()
check_data = json.loads(check_res)
server_data = check_data['servers']['server']
for upserver in server_data:
if upserver['status'] == 'down' and upserver['fall'] > 500:
#print(upserver['upstream'],upserver['name'],upserver['status'],upserver['fall']);
print(upserver['fall'])
点赞

发表评论

电子邮件地址不会被公开。 必填项已用*标注