Multiple Servers behind one WAN/Public IP

Support forum for Nagios Core, Nagios Plugins, NCPA, NRPE, NSCA, NDOUtils and more. Engage with the community of users including those using the open source solutions.
szkoda
Posts: 42
Joined: Thu Dec 04, 2014 8:48 am

Multiple Servers behind one WAN/Public IP

Post by szkoda »

Hi All,

I'm trying to work out the best way to monitor several servers behind 1 external IP. I have forwarded a different external port for each command e.g check_nt using 4005, check_nt2 using 4006, check_nt3 using 4007 etc which will then be translated to 12489 on the internal network for each local IP. This has worked but my question is whats the best way to manage my hostgroups/config files so I can easily view the various services in logical groups?

We are an IT support company so have several clients all with around 2 - 8 servers and they all use 1 public IP for their servers.
tmcdonald
Posts: 9117
Joined: Mon Sep 23, 2013 8:40 am

Re: Multiple Servers behind one WAN/Public IP

Post by tmcdonald »

In regards to the WAN monitoring, you might look into NRPE:

http://assets.nagios.com/downloads/nagi ... ios-XI.pdf

That way you can have a single port open with NRPE listening on it, which will then handle all the checks from within the network. No need for multiple ports.

As for the organization, that's really more of an art than a science. I would group all services for a particular host into one file and name that file the same as the host config file. For hostgroups you can do a simple "client" and "company" distinction if you monitor both your customer and your own servers. For servicegroups you can do something similar. It really all depends on what logical groups would make sense in your environment. Some people split them into development and production, some into internal and external, etc.
Former Nagios employee
szkoda
Posts: 42
Joined: Thu Dec 04, 2014 8:48 am

Re: Multiple Servers behind one WAN/Public IP

Post by szkoda »

I am using NSclient, is that the same thing?

If not does it listen on the nagios server or the server I am monitoring? Also all our clients use windows servers, does NRPE monitor those?
tmcdonald
Posts: 9117
Joined: Mon Sep 23, 2013 8:40 am

Re: Multiple Servers behind one WAN/Public IP

Post by tmcdonald »

szkoda wrote:I am using NSclient, is that the same thing?
No. NSClient is an agent that runs on the Windows machine and is queried by Nagios to get internal metrics like CPU, Memory, Disk, etc. NRPE is the Nagios Remote Plugin Executor, and it is sort of like a relay or a proxy - Nagios can run checks via NRPE in cases like this where network access is restricted.
szkoda wrote:If not does it listen on the nagios server or the server I am monitoring?
NRPE would be installed on an intermediary server within the network you want to monitor. Nagios contacts NRPE and tells it to query NSClient, or whatever else you want to monitor with it.
szkoda wrote:Also all our clients use windows servers, does NRPE monitor those?
NRPE itself does not care what you monitor, and neither does Nagios. If you can script it, you can check it. NRPE can monitor Windows by way of NSClient.
Former Nagios employee
szkoda
Posts: 42
Joined: Thu Dec 04, 2014 8:48 am

Re: Multiple Servers behind one WAN/Public IP

Post by szkoda »

Sorry to resurrect an old thread but I think I'm finally going to make the move from check_nt to check_nrpe if I can get it working.

Can I have a remote windows host acting as a NRPE server? If so how do I configure it to collect the data from the other servers? Do I need to change anything on the Nagios end to make it work?
jolson
Attack Rabbit
Posts: 2560
Joined: Thu Feb 12, 2015 12:40 pm

Re: Multiple Servers behind one WAN/Public IP

Post by jolson »

Can I have a remote windows host acting as a NRPE server? If so how do I configure it to collect the data from the other servers? Do I need to change anything on the Nagios end to make it work?
While you can have a remote windows host act as a relay, but not as a server - so it won't necessarily be 'collecting' information.

NSClient as a relay host can be tricky, and because of that I recommend that you look into mod_gearman as a possibility. In your case, you would set up a gearman worker at the remote location - let's call it RemoteA.

You would also need to set up a gearman job server at your Nagios host. The Nagios job server would generate checks - pass them through mod_gearman to RemoteA - and then RemoteA would run the required checks and return them to Nagios.

I recommend mod_gearman if you can stand up a CentOS box at the remote site. If you would like to use NSClient instead - that is fine as well.

Let us know how you'd like to proceed. Thanks!
Twits Blog
Show me a man who lives alone and has a perpetually clean kitchen, and 8 times out of 9 I'll show you a man with detestable spiritual qualities.
szkoda
Posts: 42
Joined: Thu Dec 04, 2014 8:48 am

Re: Multiple Servers behind one WAN/Public IP

Post by szkoda »

We haven't got the resources to setup a linux box at each site so I think I'll just stick with my current setup and forward ports where necessary.

Thankyou for the advice anyway!
jolson
Attack Rabbit
Posts: 2560
Joined: Thu Feb 12, 2015 12:40 pm

Re: Multiple Servers behind one WAN/Public IP

Post by jolson »

No problem - I'll keep this thread open in case you have any questions. Thanks!
Twits Blog
Show me a man who lives alone and has a perpetually clean kitchen, and 8 times out of 9 I'll show you a man with detestable spiritual qualities.
yanviau
Posts: 2
Joined: Tue May 05, 2015 6:55 pm

Re: Multiple Servers behind one WAN/Public IP

Post by yanviau »

Sorry for taking your post but my question is nearly yours so i don't wan't to open a new post.

I just would like a confirmation if we have any way to connect the agent TO the server. I would like to point multiple WAN center with no static IP address to 1 server.

That kind of reverse connexion is possible with nagios or we really need to connect the server to the client infrastructure.
jdalrymple
Skynet Drone
Posts: 2620
Joined: Wed Feb 11, 2015 1:56 pm

Re: Multiple Servers behind one WAN/Public IP

Post by jdalrymple »

You can use dynamic DNS just like you would for any other service of this type with a rotating IP, or you could look into passive checks. Sounds like passive checks is what you're interested in and it's an inherent part of Nagios. Fairly trivial to setup.

http://nagios.sourceforge.net/docs/nagi ... hecks.html
Locked