mirror of
https://github.com/midoks/mdserver-web.git
synced 2026-10-18 23:45:52 +08:00
update
This commit is contained in:
File diff suppressed because it is too large
Load Diff
@@ -6,6 +6,7 @@
|
||||
<p onclick="pluginConfig('sphinx');">配置修改</p>
|
||||
<p onclick="pluginLogs('sphinx','','run_log');">运行日志</p>
|
||||
<p onclick="pluginLogs('sphinx','','query_log', 30);">查询日志</p>
|
||||
<p onclick="runStatus();">运行状态</p>
|
||||
<p onclick="rebuild();">重建索引</p>
|
||||
</div>
|
||||
<div class="bt-w-con pd15">
|
||||
|
||||
@@ -197,6 +197,14 @@ def runLog():
|
||||
return tmp.groups()[0]
|
||||
|
||||
|
||||
def getPort():
|
||||
path = getConf()
|
||||
content = public.readFile(path)
|
||||
rep = 'listen\s*=\s*(.*)'
|
||||
tmp = re.search(rep, content)
|
||||
return tmp.groups()[0]
|
||||
|
||||
|
||||
def queryLog():
|
||||
path = getConf()
|
||||
content = public.readFile(path)
|
||||
@@ -204,6 +212,26 @@ def queryLog():
|
||||
tmp = re.search(rep, content)
|
||||
return tmp.groups()[0]
|
||||
|
||||
|
||||
def runStatus():
|
||||
s = status()
|
||||
if s != 'start':
|
||||
return public.returnJson(False, '没有启动程序')
|
||||
|
||||
sys.path.append(getPluginDir() + "/class")
|
||||
import sphinxapi
|
||||
|
||||
sh = sphinxapi.SphinxClient()
|
||||
port = getPort()
|
||||
sh.SetServer('127.0.0.1', port)
|
||||
info_status = sh.Status()
|
||||
|
||||
rData = {}
|
||||
for x in range(len(info_status)):
|
||||
rData[info_status[x][0]] = info_status[x][1]
|
||||
|
||||
return public.returnJson(True, 'ok', rData)
|
||||
|
||||
if __name__ == "__main__":
|
||||
func = sys.argv[1]
|
||||
if func == 'status':
|
||||
@@ -230,5 +258,7 @@ if __name__ == "__main__":
|
||||
print runLog()
|
||||
elif func == 'query_log':
|
||||
print queryLog()
|
||||
elif func == 'run_status':
|
||||
print runStatus()
|
||||
else:
|
||||
print 'error'
|
||||
|
||||
@@ -40,8 +40,44 @@ function rebuildIndex(){
|
||||
if (data.data == 'ok'){
|
||||
layer.msg('在重建中..',{icon:1,time:2000,shade: [0.3, '#000']});
|
||||
} else {
|
||||
layer.msg(data.data,{icon:1,time:2000,shade: [0.3, '#000']});
|
||||
layer.msg(data.data,{icon:2,time:2000,shade: [0.3, '#000']});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
function runStatus(){
|
||||
spPost('run_status', '', function(data){
|
||||
var rdata = $.parseJSON(data.data);
|
||||
if (!rdata['status']){
|
||||
layer.msg(rdata['msg'],{icon:2,time:2000,shade: [0.3, '#000']});
|
||||
return;
|
||||
}
|
||||
var idata = rdata.data;
|
||||
console.log(idata);
|
||||
var Con = '<div class="divtable"><table class="table table-hover table-bordered" style="margin-bottom:10px;background-color:#fafafa">\
|
||||
<tbody>\
|
||||
<tr><th>运行时间</th><td>' + idata.uptime + 's</td><th>每秒查询</th><td>' + parseInt(parseInt(idata.queries) / parseInt(idata.uptime)) + '</td></tr>\
|
||||
<tr><th>总连接次数</th><td>' + idata.connections + '</td><th>work_queue_length</th><td>' +idata.work_queue_length + '</td></tr>\
|
||||
<tr><th>agent_connect</th><td>' + idata.agent_connect+ '</td><th>workers_active</th><td>' + idata.workers_active + '</td></tr>\
|
||||
<tr><th>agent_retry</th><td>' + idata.agent_retry + '</td><th>workers_total</th><td>' + idata.workers_total + '</td></tr>\
|
||||
</tbody>\
|
||||
</table>\
|
||||
<table class="table table-hover table-bordered">\
|
||||
<thead style="display:none;"><th></th><th></th><th></th><th></th></thead>\
|
||||
<tbody>\
|
||||
<tr><th>command_delete</th><td>' + idata.command_delete + '</td><td colspan="2">command_delete</td></tr>\
|
||||
<tr><th>command_excerpt</th><td>' + idata.command_excerpt + '</td><td colspan="2">command_excerpt</td></tr>\
|
||||
<tr><th>command_flushattrs</th><td>' + idata.command_flushattrs + '</td><td colspan="2">command_flushattrs</td></tr>\
|
||||
<tr><th>command_keywords</th><td>' + idata.command_keywords + '</td><td colspan="2">command_keywords</td></tr>\
|
||||
<tr><th>command_persist</th><td>' + idata.command_persist + '</td><td colspan="2">command_persist</td></tr>\
|
||||
<tr><th>command_search</th><td>' + idata.command_search + '</td><td colspan="2">command_search</td></tr>\
|
||||
<tr><th>command_status</th><td>' + idata.command_status + '</td><td colspan="2">command_status</td></tr>\
|
||||
<tr><th>command_update</th><td>' + idata.command_update + '</td><td colspan="2">command_update</td></tr>\
|
||||
<tbody>\
|
||||
</table></div>';
|
||||
|
||||
$(".soft-man-con").html(Con);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user