兼容debian无127.0.0.1

pull/109/head
midoks 3 years ago
parent 43fafcdc00
commit 56d042431b
  1. 18
      plugins/openresty/index.py
  2. 14
      plugins/php/index.py

@ -265,9 +265,12 @@ def initdUinstall():
def runInfo(): def runInfo():
# 取Openresty负载状态 # 取Openresty负载状态
try: try:
result = mw.httpGet('http://127.0.0.1/nginx_status') url = 'http://' + mw.GetLocalIp() + '/nginx_status'
result = mw.httpGet(url)
tmp = result.split() tmp = result.split()
data = {} data = {}
data['active'] = tmp[2] data['active'] = tmp[2]
@ -279,6 +282,19 @@ def runInfo():
data['Waiting'] = tmp[15] data['Waiting'] = tmp[15]
return mw.getJson(data) return mw.getJson(data)
except Exception as e: except Exception as e:
url = 'http://127.0.0.1/nginx_status'
result = mw.httpGet(url)
tmp = result.split()
data = {}
data['active'] = tmp[2]
data['accepts'] = tmp[9]
data['handled'] = tmp[7]
data['requests'] = tmp[8]
data['Reading'] = tmp[11]
data['Writing'] = tmp[13]
data['Waiting'] = tmp[15]
return mw.getJson(data)
else
return 'oprenresty not started' return 'oprenresty not started'

@ -534,8 +534,18 @@ def checkFpmStatusFile(version):
def getFpmStatus(version): def getFpmStatus(version):
checkFpmStatusFile(version) checkFpmStatusFile(version)
result = mw.httpGet(
'http://127.0.0.1/phpfpm_status_' + version + '?json') try:
url = 'http://' + mw.getLocalIp() + '/phpfpm_status_' + version + '?json'
result = mw.httpGet(url)
except Exception as e:
url = 'http://127.0.0.1/phpfpm_status_' + version + '?json'
result = mw.httpGet(url)
else:
tmp = {}
tmp['start time'] = time.strftime('%Y-%m-%d %H:%M:%S', fTime)
return mw.getJson(tmp)
tmp = json.loads(result) tmp = json.loads(result)
fTime = time.localtime(int(tmp['start time'])) fTime = time.localtime(int(tmp['start time']))
tmp['start time'] = time.strftime('%Y-%m-%d %H:%M:%S', fTime) tmp['start time'] = time.strftime('%Y-%m-%d %H:%M:%S', fTime)

Loading…
Cancel
Save