Skip to content
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

Test with a remote Server #21

Closed
adrixpho opened this issue Jan 8, 2014 · 3 comments
Closed

Test with a remote Server #21

adrixpho opened this issue Jan 8, 2014 · 3 comments

Comments

@adrixpho
Copy link

adrixpho commented Jan 8, 2014

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...

@lorenwest
Copy link
Owner

Does your test work with a local server? If so, this is a configuration issue, and you're right - it could use some better documentation and configuration examples. One way to change configurations is to start your app server with the following on the command line:

node myapp.js '--NODE_CONFIG={"Monitor":{"allowExternalConnections":true}}'

That should allow your app to be monitored remotely. Make sure you understand the security concerns.

From http://lorenwest.github.io/node-monitor/index.html

Security Concerns

Exposing the internals of your app server is a high security risk. By default, the server listens on port 42000 and will connect with localhost clients only.

In order to monitor across machines, the default configuration must be changed to listen beyond localhost. Before doing this, it is recommended to understand the risks and have external measures in place to prevent unauthorized access.

See notes in the config/external.js file for more information.

@lorenwest
Copy link
Owner

To add some context, node-monitor uses node-config for configuration management. This allows multiple npm modules to mixin configurations, offers multi-deployment configurations, and file based, environment variable based, or command line based configurations.

The above example used the command line based configuration, but as you deploy your app to different environments (development, qa, staging, production), you may need different configurations. The best way is to create a /config directory at the top of your app, put default configurations into the default file, and environment-specific configurations into their own file. Hopefully the node-config documentation will be enough to get you going.

@adrixpho
Copy link
Author

adrixpho commented Jan 9, 2014

It works!, I forget create that /config folder with my configuration. Thanks so much.. And congrat for this library (^_^)

@adrixpho adrixpho closed this as completed Jan 9, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants