mirror of
https://github.com/midoks/mdserver-web.git
synced 2026-10-18 23:45:52 +08:00
up
This commit is contained in:
@@ -37,7 +37,29 @@ function redisStatus() {
|
||||
<tr><th>connections</th><td>' + rdata.connections + '</td><td>当前链接数</td></tr>\
|
||||
<tr><th>collections</th><td>' + rdata.collections + '</td><td>文档数</td></tr>\
|
||||
<tbody>\
|
||||
</table></div>'
|
||||
</table></div><hr/>';
|
||||
|
||||
var t = '';
|
||||
for(var i=0; i<rdata.dbs.length;i++){
|
||||
t += '<tr>';
|
||||
t += '<th>'+rdata.dbs[i]["db"]+'</th>';
|
||||
t += '<th>'+toSize(rdata.dbs[i]["totalSize"])+'</th>';
|
||||
t += '<th>'+toSize(rdata.dbs[i]["storageSize"])+'</th>';
|
||||
t += '<th>'+toSize(rdata.dbs[i]["dataSize"])+'</th>';
|
||||
t += '<th>'+toSize(rdata.dbs[i]["indexSize"])+'</th>';
|
||||
t += '<th>'+rdata.dbs[i]["indexes"]+'</th>';
|
||||
t += '<th>'+rdata.dbs[i]["objects"]+'</th>';
|
||||
t += '</tr>';
|
||||
}
|
||||
// console.log(t);
|
||||
|
||||
Con += '<div class="divtable">\
|
||||
<table class="table table-hover table-bordered" style="width: 490px;">\
|
||||
<thead><th>库名</th><th>大小</th><th>存储大小</th><th>数据</th><th>索引</th><th>文档数据</th><th>对象</th></thead>\
|
||||
<tbody>'+t+'<tbody>\
|
||||
</table></div>';
|
||||
// console.log(rdata.dbs);
|
||||
|
||||
$(".soft-man-con").html(Con);
|
||||
},'json');
|
||||
}
|
||||
|
||||
@@ -148,9 +148,18 @@ def runInfo():
|
||||
client = pymongo.MongoClient(host='127.0.0.1', port=27017)
|
||||
db = client.admin
|
||||
serverStatus = db.command('serverStatus')
|
||||
|
||||
listDbs = client.list_database_names()
|
||||
|
||||
showDbList = []
|
||||
for x in range(len(listDbs)):
|
||||
mongd = client[listDbs[x]]
|
||||
stats = mongd.command({"dbstats": 1})
|
||||
showDbList.append(stats)
|
||||
# print(showDbList)
|
||||
# print(serverStatus)
|
||||
# for key, value in serverStatus.items():
|
||||
# print(key, value)
|
||||
# print(key, value)
|
||||
result = {}
|
||||
result["version"] = serverStatus['version']
|
||||
result["uptime"] = serverStatus['uptime']
|
||||
@@ -162,6 +171,7 @@ def runInfo():
|
||||
result["connections"] = serverStatus['connections']['current']
|
||||
result["collections"] = serverStatus['catalogStats']['collections']
|
||||
|
||||
result["dbs"] = showDbList
|
||||
return mw.getJson(result)
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user