From dd2fbe86b482a7522b9b16d336a499bbe709d846 Mon Sep 17 00:00:00 2001 From: Mr Chen Date: Mon, 10 Dec 2018 15:10:07 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E6=98=BE=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- plugins/openresty/index.py | 25 ++++++++++++++----------- plugins/openresty/js/openresty.js | 26 +++++++++++++++----------- 2 files changed, 29 insertions(+), 22 deletions(-) diff --git a/plugins/openresty/index.py b/plugins/openresty/index.py index a61a6cbdc..8d9881648 100755 --- a/plugins/openresty/index.py +++ b/plugins/openresty/index.py @@ -203,17 +203,20 @@ def initdUinstall(): def runInfo(): # 取Openresty负载状态 - result = public.httpGet('http://127.0.0.1:6666/nginx_status') - 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 public.getJson(data) + try: + result = public.httpGet('http://127.0.0.1:6666/nginx_status') + 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 public.getJson(data) + except Exception as e: + return 'oprenresty not started' def errorLogPath(): diff --git a/plugins/openresty/js/openresty.js b/plugins/openresty/js/openresty.js index f6faaab21..b444f9e57 100755 --- a/plugins/openresty/js/openresty.js +++ b/plugins/openresty/js/openresty.js @@ -254,17 +254,21 @@ function getOpenrestyStatus() { return; } - var rdata = $.parseJSON(data.data); - var con = "
\ - \ - \ - \ - \ - \ - \ - \ -
活动连接(Active connections)" + rdata.active + "
总连接次数(accepts)" + rdata.accepts + "
总握手次数(handled)" + rdata.handled + "
总请求数(requests)" + rdata.requests + "
请求数(Reading)" + rdata.Reading + "
响应数(Writing)" + rdata.Writing + "
驻留进程(Waiting)" + rdata.Waiting + "
"; - $(".soft-man-con").html(con); + try { + var rdata = $.parseJSON(data.data); + var con = "
\ + \ + \ + \ + \ + \ + \ + \ +
活动连接(Active connections)" + rdata.active + "
总连接次数(accepts)" + rdata.accepts + "
总握手次数(handled)" + rdata.handled + "
总请求数(requests)" + rdata.requests + "
请求数(Reading)" + rdata.Reading + "
响应数(Writing)" + rdata.Writing + "
驻留进程(Waiting)" + rdata.Waiting + "
"; + $(".soft-man-con").html(con); + }catch(err){ + showMsg(data.data, function(){}, null,3000); + } },'json'); }