lorenwest / monitor-dashboard

Dashboards for the Node.js monitor project
https://lorenwest.github.com/monitor-dashboard
MIT License
204 stars 28 forks source link

Connect monitor to dashboard #25

Closed geniant closed 9 years ago

geniant commented 9 years ago

Hi @lorenwest and everyone, first great work ! What in want to do is starting the dashboard on a computer, and start the monitor on another one. Until now, I was able to connect to a remote monitor and see the free memory etc.. But what I want to do is to see these values on the dashboard. I didn't know how to do this. I feel that I'm so close ! Any help ? Thanks

lorenwest commented 9 years ago

Start by changing the hostName in your probe parameter from "localhost" to "127.0.0.1". If that works then you're close. Then change the hostName to your remote host. If that doesn't work, then it's a network issue.

geniant commented 9 years ago

Sorry it's not clear, What I did is: I opened /monitor-dashboard/node_modules/monitor/dist/monitor.js , then in var Monitor = Backbone.Model.extend({ I put : hostName: '127.0.0.1', Then I started node-monitor, and node-monitor-dashboard, but when I open appViewer in http://localhost:4200 I find only one server ! I guess they should be two servers no ? since I started the node monitor at localhost too ! Thanks for your time

geniant commented 9 years ago

I used this code : var Monitor = require('monitor');

var processMonitor = new Monitor({ probeClass: 'Process', hostName: '52.18.252.34' }); processMonitor.connect(function(error) { if(error) console.log("Error " + error);

console.log("-----Connected...");

});

processMonitor.on('change', function(mess){ console.log('Changes:',mess ); //processMonitor.get('freemem') }); and It shows me changes on remote machine. But I want to connect all the dashboard not only the freemem for example. Thanks

lorenwest commented 9 years ago

It sounds like you may be configuring in the wrong place. The monitor-dashboard app has a /config directory for all configurations. If you're changing configurations down under monitor-dashboard/node_modules/monitor/dist/monitor.js then you're changing underlying defaults which may be forcing one machine vs. allowing many. Make changes under the /config directory and if you have questions on how the files under /config work, you can view the node-config package documentation.

You should be able to connect monitors in your dashboard from many machines.

geniant commented 9 years ago

Thank you very much for responding. I understood you but It didn't work. When I use this code :


var Monitor = require('monitor');

var processMonitor = new Monitor({ probeClass: 'Process', hostName: '52.18.252.34' }); processMonitor.connect(function(error) { if(error) console.log("Error " + error);

console.log("-----Connected...");

});

processMonitor.on('change', function(mess){ console.log('Changes:',mess ); //processMonitor.get('freemem') });


I connect to the wanted machine and I see the free memory every one second (as default). But when I go to /config/default.json and I put the following script, It doesn't connect, It doesn't even try to connect (because in the previous script, it takes about 3 seconds to connect and start printing free memory):


// Default configurations module.exports = {

// Overrides from the monitor package allowExternalConnections: true, appName: 'MonitorDashboard',

Monitor: { appName: 'MonitorgDashboard', hostName: '52.18.251.217', consoleLogListener: { pattern: "{trace,warn,error,fatal}.*" }

},

// Dashboard application configurations Dashboard: {

// The port to listen on for application traffic
port:4200,
hostName: '52.18.251.217',
// Only allow connections from this machine by default.  This reduces
// accidental security breaches by requiring you to consider your network
// security policies before allowing external connections.
// See the external.js file in this directory for more information.
allowExternalConnections: true,

// Path to the site database.  Paths that start with '.' are relative
// to process.cwd(), which is usually the application root directory.
siteDbPath: './site_db'

}

}


when I print Monitor.Config.Monitor.hostName and Monitor.Config.Dashboard.hostName I see the wanted IP address. Could you call me on skype or by video chat to make the task easier ? Thank you very much.

lorenwest commented 9 years ago

The open source community is about self-sufficiency. You have full access to the code, and everything you need to get this working. There is something that you are doing differently than others, and when you find out what it is, your gift back to the community could be to document it in a blog post or on this wiki. Asking for support is like giving kryptonite to superman.

geniant commented 9 years ago

Solved ! As you said on issue 16,


Most components have a server dropdown. If your server isn't listed in the dropdown, save the component with another server, then open the dialog again and press the view source button on the bottom of the component settings dialog. That should let you change the server to the one you want.


Thank you very much