lorenwest / node-monitor Goto Github PK
View Code? Open in Web Editor NEWNode.js application monitoring
Home Page: http://lorenwest.github.io/node-monitor
License: MIT License
Node.js application monitoring
Home Page: http://lorenwest.github.io/node-monitor
License: MIT License
This may be a replay issue from when I was exploring the dashboard here (I appoligize in advance if this is a repeat!):
lorenwest/monitor-dashboard#4
Running Mac OS X 10.9.1, I cd to my clean project directory and install node-monitor:
sudo npm install monitor
A new 'node_modules' folder appears with a 'monitor' folder and files there, cool!
keeping Terminal open, I attempt this:
$ node
> var Monitor = require('monitor');
undefined
It returns 'undefined'. Now, if I run this instead:
var Monitor = require('./node_modules/monitor/monitor.js');
I get this:
> Monitor service started on host: localhost
External connections disabled.
See /Users/owntheweb/Documents/personal/statMonitor/server/gatherer/config/external.js for more information.
Cool! So moving on to the example low memory alert in low-memory-warn.js, if I run the example as-is, it runs without error and exits immediately, not printing anything in Terminal. If I alter it to match the above require line, errors occur.
Here's the altered low-memory-warn.js script:
// Low memory warning monitor
//var Monitor = require('monitor'); //THIS PRODUCES NOTHING, APP RUNS WITHOUT ERROR, EXITS IMMEDIATELY
var Monitor = require('./node_modules/monitor/monitor.js'); //THIS RESULTS IN ERRORS
var LOW_MEMORY_THRESHOLD = 100000000;
// Set the probe to push changes every 10 seconds
var options = {
hostName: 'localhost',
probeClass: 'Process',
initParams: {
pollInterval: 10000
}
}
var processMonitor = new Monitor(options);
// Attach the change listener
processMonitor.on('change', function() {
var freemem = processMonitor.get('freemem');
if (freemem < LOW_MEMORY_THRESHOLD) {
console.log('Low memory warning: ' + freemem);
}
});
// Now connect the monitor
processMonitor.connect(function(error) {
if (error) {
console.error('Error connecting with the process probe: ', error);
process.exit(1);
}
});
Here's the result:
__________
_______ ___________________(_)_ /______________
__ __ `__ \ __ \_ __ \_ /_ __/ __ \_ ___/
_ / / / / / /_/ / / / / / / /_ / /_/ / /
/_/ /_/ /_/\____//_/ /_//_/ \__/ \____//_/
[2014-02-20T16:36:17.473Z] [FATAL] monitor.moniotor.uncaught - Uncaught Exception: object is not a function
[2014-02-20T16:36:17.475Z] [FATAL] monitor.moniotor.uncaught - TypeError: object is not a function
at Object.<anonymous> (/Users/owntheweb/Documents/personal/statMonitor/server/gatherer/low-memory-warn.js:14:22)
at Module._compile (module.js:456:26)
at Object.Module._extensions..js (module.js:474:10)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:312:12)
at Function.Module.runMain (module.js:497:10)
at startup (node.js:119:16)
at node.js:901:3
Here's line 14:
var processMonitor = new Monitor(options);
Any thoughts on what I might be doing wrong? I understand that MacOS may be a bit touchy. If I need to move all this to a Linux machine (my final project will be on Linux), let me know.
Thanks for the feedback in advance!
Hey guys,
Just installed the package and I got some weird error when I start my application.
I've isolated the faulty line to this (I don't even do anything with it):
var Monitor = require('monitor');
The error being :
Error watching for file: /home/fcharette/Documents/workspace/gap-telemetry/config/runtime.json { [Error: watch ENOSPC] code: 'ENOSPC', errno: 'ENOSPC', syscall: 'watch' }
monitor version from npm, v0.6.10
I run iojs v1.8.2, npm 2.9.0
I'm on Ubuntu 15
I have plenty of space on my disk (and on /tmp)
Any ideas ?
Thank you!
I have run your module inside docker container, the collected information, such as CPU, Memory, is measurement data of real computer which the docker container is running on.
How can I get real CPU usage, Memory state as mentioned at the following link?
trying to run monitor on my machine before install this project via npm gave me a complaint about java. Then I did
git:(master) which monitor
/Users/harrymoreno/programming/android/adt-bundle/sdk/tools/monitor
so another application named monitor exists. What's the best way to try out node-monitor
?
process.EventEmitter is deprecated in Node.js v6..
It is causing a deprecated warning when loading node-monitor,
DeprecationWarning: process.EventEmitter is deprecated. Use require('events') instead.
Tested on Node.js v6.1.0, on Windows.
I cannot remove components in the 'component settings' menu, and when editing components
Hello,
I apologize for asking this question here but I couldn't find another way to ask you this as this really isn't an "issue".
I'm curious, is there a way to do HTTP monitoring on here or would that require me to create my own my own data probe and monitor probe? For example, I would like to connect to a server via HTTP and do things like ping and request various logs (the app/server I would connect to is not a node.js app). From there, I would parse them, display them on screen, throw up warnings and errors, get those values from the logs to populate the gauges, etc.
BTW, love the work you have done. Looks fantastic!
Thanks!
It appears that node 0.4.0 and node 0.5.0-pre are more particular in the JSON they will allow. Attempting to npm install monitor with those versions yields this:
Ryans-17-MBP-2:node wrb$ npm install monitor
npm ERR! couldn't read package.json in /var/folders/zH/zHPL9C4QGLyyHkzBTjnp1k+++TI/-Tmp-/npm-1298045898236/1298045898236-0.22087552351877093/contents/package
npm ERR! Error installing [email protected]
npm ERR! Error: Failed to parse json
npm ERR! Unexpected token ILLEGAL
npm ERR! {
npm ERR! name: "monitor",
npm ERR! version: "0.2.9",
npm ERR! main: "./lib/node-monitor.js",
npm ERR! description: "Runtime monitoring for node.js applications",
npm ERR! author: "Loren [email protected]",
npm ERR! directories: {lib: "./lib", test: "./test"},
npm ERR! modules: {
npm ERR! "console-logger": "./logger/console-logger",
npm ERR! "file-logger": "./logger/file-logger",
npm ERR! "log4js-logger": "./logger/log4js-logger",
npm ERR! "os-cmd-logger": "./logger/os-cmd-logger",
npm ERR! "email-logger": "./logger/email-logger",
npm ERR! "couchdb-logger": "./logger/couchdb-logger"
npm ERR! },
npm ERR! dependencies: {
npm ERR! "config": ">=0.2.8",
npm ERR! "sprintf": ">=0.1.1",
npm ERR! "vows": ">=0.5.6",
npm ERR! "log4js": ">=0.2.3",
npm ERR! "couch-client": ">=0.0.3"
npm ERR! },
npm ERR! engines: {"node": ">=0.2.4"},
npm ERR! scripts: {
npm ERR! test: "vows test/.js --spec"
npm ERR! }
npm ERR! }
npm ERR!
npm ERR! at /usr/local/lib/node/.npm/npm/0.3.0-8/package/lib/utils/read-json.js:73:13
npm ERR! at P (/usr/local/lib/node/.npm/npm/0.3.0-8/package/lib/utils/read-json.js:62:40)
npm ERR! at cb (/usr/local/lib/node/.npm/npm/0.3.0-8/package/lib/utils/graceful-fs.js:31:9)
npm ERR! at [object Object]. (fs.js:86:5)
npm ERR! at [object Object].emit (events.js:39:17)
npm ERR! at afterRead (fs.js:840:12)
npm ERR! Report this entire* log at http://github.com/isaacs/npm/issues
npm ERR! or email it to [email protected]
npm ERR! Just tweeting a tiny part of the error will not be helpful.
npm not ok
If I quote each string in that file, JSON.parse works.
When the cursor goes into the component picker, the scrollbar appears and the three column format turnes to two columns.
In
7-log4js-logger-test.js
change
var log4js = deps.log4js;
to
var log4js = deps.log4js();
This matches the log4js docs.
I run the npm start monitor
but failed.
and do you have any sample/example to use the dashboard?
thank you.
I get this build error on npm install monitor
:
make: Entering directory '/home/user/test/app/node_modules/monitor/node_modules/ws/build'
CXX(target) Release/obj.target/bufferutil/src/bufferutil.o
bufferutil.target.mk:96: recipe for target 'Release/obj.target/bufferutil/src/bufferutil.o' failed
I want to monitor log, but I have no idea how to do after reading the docs.
Hi,
I would really like to use node-monitor module, however I can't get it to connect to my process.
I've included require("monitor-min").start() in my project, and I would like to start the node-monitor on the same server to add some charts and monitor it.
To be honest... I have got no clue on how to add a chart to monitor for example memory usage.
A single example would be awesome!
Thanks
When I add this line:
require('monitor').start();
It gives me this stack error
monitor/node_modules/config/lib/config.js:1410
global.NODE_CONFIG.watchForConfigFileChanges();
^
TypeError: Object [object Object] has no method 'watchForConfigFileChanges'
at Object.<anonymous> (/Users/andy/Development/javascript/rovio/node_modules/monitor/node_modules/config/lib/config.js:1410:20)
at Module._compile (module.js:456:26)
at Object.Module._extensions..js (module.js:474:10)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:312:12)
at Module.require (module.js:364:17)
at require (module.js:380:17)
at /Users/andy/Development/javascript/rovio/node_modules/monitor/lib/Monitor.js:743:22
at Object.<anonymous> (/Users/andy/Development/javascript/rovio/node_modules/monitor/lib/Monitor.js:778:2)
at Module._compile (module.js:456:26)
When I select "Add Component", the objects move around the canvas, instead of being able to view them with a scrollbar. Once the mouse is hovering, a scrollbar activates and the icons shift places.
Hi,
As I know, this module use socket to communicate between a remote server and a server to be measured, and I can get data from this command processMonitor.toJSON();
. How can I utilize the socket connection or the JSON file format to add my data? For example, I can add a list of files in a specified folder to the JASON file before sending to the remote server.
Thank you in advance.
Once the onInit is written, you can't erase it.
I tried to run the example from here. (http://lorenwest.github.io/node-monitor/doc/classes/Monitor.html)
Though I received data from Server periodically, the function processMonitor.getConnection() return null.
Also, the function processMonitor.control('ping', function(error, response), return null due to the error [ERROR] Monitor.control.Process.ping - Probe not connected
server.js
`var Monitor = require('monitor');
var options = {
probeClass: 'Process',
initParams: {
pollInterval: 10000
}
}
var Probe = new Monitor.Probe(options);
Probe.onControl('ping', function(error, response) {
response = 'asdasdasd';//console.log('Ping response: ', response);
});
var server = new Monitor.Server();
server.start();`
client.js
`var options = {
hostName: '192.168.2.3',
probeClass: 'Process',
initParams: {
pollInterval: 10000
}
}
var Monitor = require('monitor');
// Connecting a monitor to a probe
var processMonitor = new Monitor(options);
processMonitor.connect(function(err) {console.log('aa', err);});
//var Connection = Monitor.Connection(options);
// Monitoring the probe
processMonitor.on('change', function(){
console.log('Changes:', processMonitor.get('freemem'));
});
// Remote control
processMonitor.control('ping', function(error, response) {
console.log('Ping response: ', response);
});
console.log('getConnection()', processMonitor.getConnection());`
Hi lorenwest, I have N client applications that I need to monitor, all of them in different machines and one application as monitor server. When I try to monitor a client application from the browser using dist library I can't do a connection, I've inserted the script:
<script src="path/to/monitor/dist/monitor-all.js"></script>
var monitoProcess = new Monitor({
probeClass: 'Process',
hostName: ' IPClientApplication '
});
monitoProcess.connect(function(error) {
if (error) {
console.log('Error connecting with the process probe: ', error);
}
});
monitoProcess.on('connect', function(){
console.log("Connected!");
});
monitoProcess.on('change', function()
{
var freemem = monitoProcess.get('freemem');
console.log("Free memory: %d", freemem);
});
But I don't get the connection to ProbeClass:'Process', however, if I do the same connection but from server side, I get that connection. What can I be doing wrong? By the way, I have in my client applications the property "allowExternalConnections" to true. Do you have an example how to use dashboard components individually in a browser?
Thanks!
What is the correct "couchdb" module?
Hi, i'm new with this library, In the test folder and documentation I see how connect with a remote server so...
I have in my comp1 (as server to monitor)
(192.168.1.70)
var Monitor = require('monitor');
var serverMon = new Monitor.Server();
serverMon.start();
serverMon.on('start', function() {
console.log("Server Started...");
});
And my output is "Server Started..." Ok
In my comp2 (control computer) I have my monitorApp
(192.168.1.80)
var processMonitor = new Monitor({
probeClass: 'Process',
hostName: '192.168.1.70'
});
processMonitor.connect(function(error) {
if(error) console.log("Error " + error);
console.log("Connected...");
});
And I don't get a connection with my server... I'm doing something wrong? or I don't understand the function of the Classes? My test was even with hostName:'192.168.1.70:42000' with default port. If there is a complete example of monitoring a remote server will be very helpful.
Thanks so much...
Apps that use monitor fail to start in 0.4.2 due to stdout-logger.js attempting to reference deps._.out on line 14:
deps._.out("stdout") in stdout
node.js:116
throw e; // process.nextTick error, or 'error' event on first tick
^
TypeError: Object function (obj) { return new wrapper(obj); } has no method 'out'
at Object. (/usr/local/lib/node/.npm/monitor/0.2.11/package/logger/stdout-logger.js:14:8)
at Module._compile (module.js:383:26)
at Object..js (module.js:389:10)
at Module.load (module.js:315:31)
at Function._load (module.js:276:12)
at require (module.js:327:19)
at Object. (/usr/local/lib/node/.npm/monitor/0.2.11/package/deps.js:29:18)
at Module._compile (module.js:383:26)
at Object..js (module.js:389:10)
at Module.load (module.js:315:31)
after run npm start monitor-dashboard
the console and telnet port 42000 run fine
but when goto url http://localhost:4200/
the browser tell "Waiting for response"
You want me to start working on this?
This is a heads up that the node-monitor library has undergone a major upgrade, and will be arriving within the upcoming weeks.
The compatibility version has been changed to 0.4.x, so if your application uses the current node-monitor package, you will need to change your package.json to disallow automatic upgrades into 0.4.x and above. I recommend changing your dependencies to this:
"monitor": "<0.4.0"
This will allow updates to the existing monitor package up to, but not including the incompatible version.
And keep your eyes open for the announcement of the new node-monitor. Real time application monitoring dashboard for node.js.
Hi,
Thank for providing an interesting measurement tool in NodeJS.
I had a problem when running your tool. Your example worked great in the Ubuntu terminal but when It came to a script file. It did not print out an output as it did in the terminal (the same error with nodejs app.js and node app.js) (As shown in the attached).
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.