-
Notifications
You must be signed in to change notification settings - Fork 28
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Help with node-monitor and monitor-dashboard #15
Comments
Hello Ignacio, If you've used Java, you can think of node-monitor as JMX beans. You install node-monitor on the system you want to monitor, and the remote system can view and interact with node-monitor. It's best to start simple - with node-monitor (less the dashboard). Have you gone through the README and seen the process stats (freemem, cpu stats) using node-monitor only? -Loren |
Thanks for your response Loren. Yes, I've already read the example, that works very good, but now I need to know how can count the http requests that my node app receives, but I don't know how do this. Thanks for your time. |
For http requests, the question is - how do you want your data aggregated. The stats probe is good for viewing all stats as they're fired, but it doesn't yet do aggregation. The quickest (and dirtiest) way to get this done is to create a handful of variables off the global namespace to contain the aggregations you care about (5 minute, 1 hour, by http method, by endpoint, etc.). Add to these variables in your http request pipeline, and clear them on a timer if they're periodic aggregations. Then use the InspectProbe to inspect these variables. Let me know if that makes any sense :) |
Great. I have the following: var inspectOptions = { I want to get the value of http_requests variable, defined in my app, but I can't. Can you help me? |
So your app (running in a different process, maybe a different server) has a global variable called global.http_requests, and it also has node-monitor linked in and started. From the other app (running on the same machine or on another machine), you have to connect to the correct node process. Everything looks good except your key variable is global.http_requests, which, if evaluated locally is likely to return |
You're right Loren, when I put the quotes around the key, I get undefined. |
It's because both processes are on localhost, and it connected with the closest inspector probe, which happened to be running in your client. To verify, set If that's the case, you have to differentiate the two processes - either by running them on different machines, or by naming the processes. To configure your app with a name, add the following to your
Then when you connect from your client, do this:
|
Now I'm trying to run your Monitoring example from another machine into the LAN, but Isn't work. var options = { |
The The other thing about connecting one machine to another is security. By default, node-monitor only accepts incoming connections on localhost. In order to allow it to connect from another machine, you have to configure this in your config/default.json file:
The reason it's disabled by default is to have you think about your network security before allowing external connections. Generally your network isn't exposing ports in the 42,000 range to the outside world, but it's good to think about security before opening up your servers for external monitoring & control. |
Great! I have seen the freemem from another machine using your example. --config/default.json --monitorScript.js var Monitor = require('monitor'); var inspectMonitor = new Monitor(inspectOptions); // Attach the change listener // Now connect the monitor Thank you very much Loren. |
Everything looks right. You're monitoring the variable every 10 seconds, and triggering |
Yes, the value changes. console.log(inspectMonitor.get('isModel')); Should I get true? |
Unless What do you see when you do |
{ hostName: '10.10.10.212', |
The fact that |
If you are putting quotes around |
Can you show me a little example how I should define my variable to see its value using Inspect? Thank you in advance :) |
Yes:
Notice the quotes around |
Hi Loren, I have the following code: var inspectMonitor = new Monitor({
..and output: Inspect probe connected. It seems that "value" is undefined as shown, can you please advise? |
Hi Loren, I'd like to know if you can help me with node-monitor and monitor-dashboard. I need to monitoring a node app, specifically http requests and the node server cluster status (freemem, cpu status) and be able to see this information in monitor-dashboard.
I tried to do this by reading your code, but I can't.
Hope you help me. Thanks!
Ignacio.
The text was updated successfully, but these errors were encountered: