mirror of
https://github.com/midoks/mdserver-web.git
synced 2026-10-10 01:29:26 +08:00
查看日志优化
This commit is contained in:
@@ -8,7 +8,8 @@
|
||||
<p onclick="pluginConfig('supervisor');">主配置</p>
|
||||
<p onclick="pluginLogs('supervisor','','run_log', 10);">主日志</p>
|
||||
<p onclick="supConfigTpl('supervisor');">子配置</p>
|
||||
<p onclick="supLogs('supervisor','config_tpl','read_config_log_tpl');">子日志</p>
|
||||
<!-- <p onclick="supLogs('supervisor','config_tpl','read_config_log_tpl');">子日志</p> -->
|
||||
<p onclick="confdList('supervisor');">子日志</p>
|
||||
</div>
|
||||
<div class="bt-w-con pd15">
|
||||
<div class="soft-man-con"></div>
|
||||
|
||||
@@ -235,6 +235,44 @@ def getSupList():
|
||||
data['data'] = array_list
|
||||
return mw.getJson(data)
|
||||
|
||||
def confDList():
|
||||
confd_dir = getServerDir() + '/conf.d'
|
||||
clist = os.listdir(confd_dir)
|
||||
array_list = []
|
||||
for x in range(len(clist)):
|
||||
t = {}
|
||||
t['name'] = clist[x]
|
||||
array_list.append(t)
|
||||
|
||||
data = {}
|
||||
data['data'] = array_list
|
||||
return mw.getJson(data)
|
||||
|
||||
|
||||
def confDlistTraceLog():
|
||||
args = getArgs()
|
||||
data = checkArgs(args, ['name'])
|
||||
if not data[0]:
|
||||
return data[1]
|
||||
|
||||
confd_dir = getServerDir() + '/conf.d/' + args['name']
|
||||
content = mw.readFile(confd_dir)
|
||||
rep = 'stdout_logfile\s*=\s*(.*)'
|
||||
tmp = re.search(rep, content)
|
||||
return tmp.groups()[0].strip()
|
||||
|
||||
|
||||
def confDlistErrorLog():
|
||||
args = getArgs()
|
||||
data = checkArgs(args, ['name'])
|
||||
if not data[0]:
|
||||
return data[1]
|
||||
|
||||
confd_dir = getServerDir() + '/conf.d/' + args['name']
|
||||
content = mw.readFile(confd_dir)
|
||||
rep = 'stderr_logfile\s*=\s*(.*)'
|
||||
tmp = re.search(rep, content)
|
||||
return tmp.groups()[0].strip()
|
||||
|
||||
def getUserListData():
|
||||
user = getServerDir() + "/user.txt"
|
||||
@@ -586,6 +624,12 @@ if __name__ == "__main__":
|
||||
print(getUserList())
|
||||
elif func == 'get_sup_list':
|
||||
print(getSupList())
|
||||
elif func == 'confd_list':
|
||||
print(confDList())
|
||||
elif func == 'confd_list_trace_log':
|
||||
print(confDlistTraceLog())
|
||||
elif func == 'confd_list_error_log':
|
||||
print(confDlistErrorLog())
|
||||
elif func == 'add_job':
|
||||
print(addJob())
|
||||
elif func == 'start_job':
|
||||
|
||||
@@ -22,7 +22,7 @@ fi
|
||||
|
||||
Install_app()
|
||||
{
|
||||
echo '正在安装脚本文件...' > $install_tmp
|
||||
echo '正在安装[supervisor]...'
|
||||
mkdir -p $serverPath/source
|
||||
mkdir -p $serverPath/supervisor
|
||||
mkdir -p $serverPath/supervisor/log
|
||||
@@ -39,10 +39,11 @@ Install_app()
|
||||
fi
|
||||
|
||||
echo "${VERSION}" > $serverPath/supervisor/version.pl
|
||||
echo '安装完成[supervisor]' > $install_tmp
|
||||
|
||||
cd ${rootPath} && python3 ${rootPath}/plugins/supervisor/index.py start
|
||||
cd ${rootPath} && python3 ${rootPath}/plugins/supervisor/index.py initd_install
|
||||
|
||||
echo '安装完成[supervisor]'
|
||||
}
|
||||
|
||||
Uninstall_app()
|
||||
@@ -60,7 +61,7 @@ Uninstall_app()
|
||||
|
||||
rm -rf $serverPath/supervisor
|
||||
|
||||
echo "卸载完成[supervisor]" > $install_tmp
|
||||
echo "卸载完成[supervisor]"
|
||||
}
|
||||
|
||||
action=$1
|
||||
|
||||
@@ -556,3 +556,70 @@ function supLogs(_name, config_tpl_func, read_config_tpl_func,line){
|
||||
}
|
||||
|
||||
|
||||
function confdListTraceLog(name){
|
||||
var args = {};
|
||||
args["name"] = name;
|
||||
pluginRollingLogs("supervisor", '', "confd_list_trace_log", JSON.stringify(args), 21);
|
||||
}
|
||||
|
||||
function confdListErrLog(name){
|
||||
var args = {};
|
||||
args["name"] = name;
|
||||
pluginRollingLogs("supervisor", '', "confd_list_error_log", JSON.stringify(args), 21);
|
||||
}
|
||||
|
||||
function confdList(page, search){
|
||||
var _data = {};
|
||||
if (typeof(page) =='undefined'){
|
||||
var page = 1;
|
||||
}
|
||||
|
||||
_data['page'] = page;
|
||||
_data['page_size'] = 10;
|
||||
if(typeof(search) != 'undefined'){
|
||||
_data['search'] = search;
|
||||
}
|
||||
|
||||
myPost('confd_list', _data, function(data){
|
||||
var rdata = $.parseJSON(data.data);
|
||||
// console.log(rdata.data);
|
||||
var list = '';
|
||||
for(i in rdata.data){
|
||||
list += '<tr>';
|
||||
list += '<td>' + rdata.data[i]['name'] +'</td>';
|
||||
|
||||
list += '<td style="text-align:right">\
|
||||
<a class="btlink" onclick="confdListTraceLog(\''+rdata.data[i]['name']+'\')">日志跟踪</a> | ' +
|
||||
'<a class="btlink" onclick="confdListErrLog(\''+rdata.data[i]['name']+'\')">查看错误日志</a>' +
|
||||
'</td>';
|
||||
|
||||
list += '</tr>';
|
||||
}
|
||||
|
||||
if( rdata.data.length == 0 ){
|
||||
list = "<tr><td colspan='9'>当前没有数据</td></tr>";
|
||||
}
|
||||
|
||||
var con = '<div class="safe bgw">\
|
||||
<button onclick="confdList()" title="刷新" class="btn btn-success btn-sm" type="button" style="margin-right: 5px;">刷新</button>\
|
||||
<div class="divtable mtb10">\
|
||||
<div class="tablescroll">\
|
||||
<table id="DataBody" class="table table-hover" width="100%" cellspacing="0" cellpadding="0" border="0" style="border: 0 none;">\
|
||||
<thead>\
|
||||
<th>名称</th>\
|
||||
<th style="text-align:right;">操作</th></tr></thead>\
|
||||
<tbody>'+ list +'</tbody></table>\
|
||||
</div>\
|
||||
<div id="databasePage" class="dataTables_paginate paging_bootstrap page"></div>\
|
||||
</div>\
|
||||
</div>';
|
||||
|
||||
con += '<div class="code">\
|
||||
<span>方便查看日志</span>\
|
||||
</div>'
|
||||
|
||||
$(".soft-man-con").html(con);
|
||||
$('#databasePage').html(rdata.page);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user