router-runtime.js
909 Bytes
"use strict";
const os = require('os');
const express = require('express');
const router = express.Router();
const numeral = require('numeral');
const matrix = require('komodo-sdk/matrix');
function pageRuntime(req, res, next) {
res.render(
'runtime.html',
{
uptime: numeral(process.uptime()).format(),
matrix: JSON.stringify(matrix, null, 4),
memory_usage: JSON.stringify(process.memoryUsage(), null, 4),
os_info: JSON.stringify({
uptime: os.uptime(),
loadavg: os.loadavg(),
hostname: os.hostname(),
type: os.type(),
platform: os.platform(),
arch: os.arch(),
release: os.release(),
totalmem: os.totalmem(),
}, null, 4),
}
)
}
router.get('/', pageRuntime);
module.exports = router;