Display proper info for redis in info command, show graph of pageviews

from last 24 hours
v1.18.x
Julian Lam
parent 7e24d2ec70
commit 9eff1519d3

@ -26,6 +26,7 @@
"body-parser": "^1.18.2",
"bootstrap": "^3.3.7",
"chart.js": "^2.7.1",
"cli-graph": "^3.2.2",
"clipboard": "^2.0.1",
"colors": "^1.1.2",
"compression": "^1.7.1",

@ -4,11 +4,13 @@ var async = require('async');
var winston = require('winston');
var childProcess = require('child_process');
var _ = require('lodash');
var CliGraph = require('cli-graph');
var build = require('../meta/build');
var db = require('../database');
var plugins = require('../plugins');
var events = require('../events');
var analytics = require('../analytics');
var reset = require('./reset');
function buildTargets() {
@ -124,8 +126,42 @@ function info() {
db.info(db.client, next);
},
function (info, next) {
console.log(' version: ' + info.version);
console.log(' engine: ' + info.storageEngine);
var config = require('../../config.json');
switch (config.database) {
case 'redis':
console.log(' version: ' + info.redis_version);
console.log(' disk sync: ' + info.rdb_last_bgsave_status);
break;
case 'mongo':
console.log(' version: ' + info.version);
console.log(' engine: ' + info.storageEngine);
break;
}
next();
},
async.apply(analytics.getHourlyStatsForSet, 'analytics:pageviews', Date.now(), 24),
function (data, next) {
var graph = new CliGraph({
height: 12,
width: 25,
center: {
x: 0,
y: 11,
},
});
var min = Math.min(...data);
var max = Math.max(...data);
data.forEach(function (point, idx) {
graph.addPoint(idx + 1, Math.round(point / max * 10));
});
console.log('');
console.log(graph.toString());
console.log('Pageviews, last 24h (min: ' + min + ' max: ' + max + ')');
next();
},
], function (err) {

Loading…
Cancel
Save