-
Notifications
You must be signed in to change notification settings - Fork 8
Expand file tree
/
Copy pathtest.js
More file actions
40 lines (33 loc) · 980 Bytes
/
test.js
File metadata and controls
40 lines (33 loc) · 980 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
'use strict';
var microstats = require('.');
microstats.on('memory', function(value) {
console.log('MEMORY:', value);
});
microstats.on('cpu', function(value) {
console.log('CPU:', value)
});
microstats.on('disk', function(value) {
console.log('DISK:', value)
});
var options1 = { frequency: 'once' }
var options2 = { frequency: '5s' }
var options3 = { frequency: 'onalert' }
var options4 = {
frequency: 'onalert',
memoryalert: { used: '>15%' },
cpualert: { load: '>30%' },
diskalert: { //filesystem: 'C:', //filesystems: ['/dev/disk1', '/dev/disk0s4'],
//mount: '/', //mounts: ['/'],
used: '>10%'
}
};
var optionsArray = [ options1, options2, options3, options4 ];
optionsArray.forEach(function(options) {
console.log('---Testing options:', options,'---')
microstats.start(options, function(err) {
if(err) console.log(err);
});
setTimeout(function(){
microstats.stop();
}, 7000);
});