extend layout
block content
script.
var monitor = require("os-monitor");
monitor.start();
monitor.start({
delay: 3000
, freeman: 1000000000
, uptime: 1000000
, critical1: 0.7
, critical5: 0.7
, critical15: 0.7
, silent: false
, stream: false
, immediate: false
});
monitor.on('monitor',function(event) {
console.log(event.type, 'This event always happens on each monitor cycle!');
});
monitor.on('loadavg1',function(event) {
console.log(event.type, 'Load average is exceptionally high!');
});
monitor.on('freemem',function(event) {
console.log(event.type, 'Free memory is very low!');
});
monitor.throttle('loadavg5',function(event) {
},monitor,minutes(5));
monitor.config({
freemem: 0.3
});
monitor.stop();
monitor.isRunning();
monitor.start({stream:true}).pipe(process.stdout);
block side bar
.widget
h1 Widget
p
| Sed ccccc rhoncus ut
| eleifvvvv in nulla enim.
p
| Vivambbbbbbbbbbbbt molestie
| vebula.
var express = require('express');
var stylus = require('stylus');
var nib = require('nib');
var app = express();
function compile(str, path) {
return stylus(str)
.set('filename', path)
.use(nib())
}
app.set('views', __dirname + '/views');
app.set('view engine', 'jade');
app.use(express.logger('dev'));
app.use(stylus.middleware({
src: __dirname + '/public',
compile: compile
}));
app.use(express.static(__dirname + '/public'));
app.get('/', function(req, res) {
res.render('index', {
title: 'Home'
})
});
app.listen(3000, function() {
console.log('Server start http://localhost:3000');
});
答案 0 :(得分:0)
你可能最好只使用像socket.io
之类的东西来将数据从服务器传送到浏览器。在服务器上使用os-monitor
或其他任何模块(在app.js
中),然后广播或单独将数据发送到浏览器客户端。