diff --git a/meshuser.js b/meshuser.js index 9f2f106b..d080c47c 100644 --- a/meshuser.js +++ b/meshuser.js @@ -689,7 +689,7 @@ module.exports.CreateMeshUser = function (parent, db, ws, req, args, domain, use switch (cmd) { case 'help': { - var fin = '', f = '', availcommands = 'help,info,versions,args,resetserver,showconfig,usersessions,closeusersessions,tasklimiter,setmaxtasks,cores,migrationagents,agentstats,webstats,mpsstats,swarmstats,acceleratorsstats,updatecheck,serverupdate,nodeconfig,heapdump,relays,autobackup,backupconfig,dupagents,dispatchtable,badlogins,showpaths,le,lecheck,leevents'; + var fin = '', f = '', availcommands = 'help,info,versions,args,resetserver,showconfig,usersessions,closeusersessions,tasklimiter,setmaxtasks,cores,migrationagents,agentstats,webstats,mpsstats,swarmstats,acceleratorsstats,updatecheck,serverupdate,nodeconfig,heapdump,relays,autobackup,backupconfig,dupagents,dispatchtable,badlogins,showpaths,le,lecheck,leevents,dbstats'; availcommands = availcommands.split(',').sort(); while (availcommands.length > 0) { if (f.length > 80) { fin += (f + ',\r\n'); f = ''; } @@ -792,6 +792,14 @@ module.exports.CreateMeshUser = function (parent, db, ws, req, args, domain, use } break; } + case 'dbstats': { + parent.parent.db.getStats(function (stats) { + var r2 = ''; + for (var i in stats) { r2 += (i + ': ' + stats[i] + '\r\n'); } + try { ws.send(JSON.stringify({ action: 'serverconsole', value: r2, tag: command.tag })); } catch (ex) { } + }) + break; + } case 'serverupdate': { r = 'Performing server update...'; if (parent.parent.performServerUpdate() == false) { r = 'Server self-update not possible.'; }