diff --git a/plugins/openresty/index.py b/plugins/openresty/index.py index 8875bb4e7..3fd4fc2af 100755 --- a/plugins/openresty/index.py +++ b/plugins/openresty/index.py @@ -265,9 +265,12 @@ def initdUinstall(): def runInfo(): + # 取Openresty负载状态 + try: - result = mw.httpGet('http://127.0.0.1/nginx_status') + url = 'http://' + mw.GetLocalIp() + '/nginx_status' + result = mw.httpGet(url) tmp = result.split() data = {} data['active'] = tmp[2] @@ -279,6 +282,19 @@ def runInfo(): data['Waiting'] = tmp[15] return mw.getJson(data) 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' diff --git a/plugins/php/index.py b/plugins/php/index.py index d23cfdff6..9bc5f19b2 100755 --- a/plugins/php/index.py +++ b/plugins/php/index.py @@ -534,8 +534,18 @@ def checkFpmStatusFile(version): def getFpmStatus(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) fTime = time.localtime(int(tmp['start time'])) tmp['start time'] = time.strftime('%Y-%m-%d %H:%M:%S', fTime)