赞
踩
#!/data/anaconda3/bin/python
# coding=utf-8
# author :dyqin
# 通过范文yarn_rest_api 接口获取json报文 ,解析报文获取yarn相关指标
import os
import json
import urllib.request
import urllib.parse
import time
import datetime
#from datetime import datetime
import cx_Oracle
#定义函数用于获取active状态的 resource manager
def getActiveRN(master1, master2):
activemaster = ""
response = urllib.request.urlopen("http://" + master1 + "/ws/v1/cluster/info")
jsonstring = response.read()
#print(jsonstring)
#通过jason 加载
j1 = json.loads(jsonstring)
#print(master1 + " resourcemanager state is :" + j1['clusterInfo']['haState'])
response = urllib.request.urlopen("http://" + master2 + "/ws/v1/cluster/info"
赞
踩
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。