Page 1 of 1

Nagios Core (FAN) - monitoring clients behind NAT

Posted: Fri May 03, 2013 2:51 pm
by STELLANOVA
Hello everyone,

I am new in Nagios and I have one tricky situation where I need to monitor 10 client machines which are connected on one router with one static IP address. How to target Nagios server to that machines as they have all same IP on router? In windows.cfg file I can target hosts only with IP. Nagios server is in office outside data center where are clients...

Thanks in advance!

Re: Nagios Core (FAN) - monitoring clients behind NAT

Posted: Fri May 03, 2013 3:34 pm
by STELLANOVA
I know that I have to forward ports on router but how to configure nagios?

All clients are Windows 8 machines.

Re: Nagios Core (FAN) - monitoring clients behind NAT

Posted: Fri May 03, 2013 3:41 pm
by scottwilkerson
Most people create the command for this check so that can pass the port the want to make the connection to as an $ARGn$

Code: Select all

define command {
       command_name                  		check_service_nsclient
       command_line                  		$USER1$/check_nt -H $HOSTADDRESS$ -s "$ARG1$" -p $ARG2$ -v $ARG3$ $ARG4$
}

Re: Nagios Core (FAN) - monitoring clients behind NAT

Posted: Fri May 03, 2013 3:48 pm
by STELLANOVA
Thanks for reply. I am really new in Nagios and Linux world so it's little bit tricky for me to understand everything that quick. Can you explain me where I have to change port? How to make it work? :(

This is host definition:

Code: Select all

define host{
	use		windows-server	; Inherit default values from a template
	host_name	PC3	; The name we're giving to this host
	alias		PC3 - Office	; A longer name associated with the host
	address		xx.xx.xx.xx ; IP address of the host
        
	}
How to define host and target Nagios to specific machine as they all have same IP?

Re: Nagios Core (FAN) - monitoring clients behind NAT

Posted: Fri May 03, 2013 4:07 pm
by scottwilkerson
Maybe I'm mistaken on what type of monitoring you want to do... Are you just pinging the hosts? If so disregard my previous post. Th was assuming you were going to be using the NSClient++ Agent on the Windows machine.

You really need to decide what you are going to monitor, then what ports will need to be mapped to what server on your firewall, etc.

Re: Nagios Core (FAN) - monitoring clients behind NAT

Posted: Fri May 03, 2013 4:10 pm
by STELLANOVA
I installed NSClient++ on all clients (hosts) and target them on Nagios server IP. I already monitor one host, for others I suppose I need to forward ports on router as they have same IP as host that I already manage to monitor...

I want to monitor host, CPU load, Memory, Hard drive and Uptime.

Can I simple add more ports in nrpe.cfg?

Now is by default like this:

Code: Select all

# PORT NUMBER
# Port number we should wait for connections on.
# NOTE: This must be a non-priviledged port (i.e. > 1024).
# NOTE: This option is ignored if NRPE is running under either inetd or xinetd

server_port=5666
Can I simpli add more ports like 5666,5665,5664....?

Re: Nagios Core (FAN) - monitoring clients behind NAT

Posted: Fri May 03, 2013 4:34 pm
by scottwilkerson
STELLANOVA wrote:I installed NSClient++ on all clients (hosts) and target them on Nagios server IP. I already monitor one host, for others I suppose I need to forward ports on router as they have same IP as host that I already manage to monitor...

I want to monitor host, CPU load, Memory, Hard drive and Uptime.
Ok, so lets say for example you setup the firewall to pass port 15003 to port 12489 on host 192.168.5.3 you can use the command I gave above (or something similar) and then setup your services something like

Code: Select all

define service {
	host_name				192.168.5.3
	service_description	CPU Usage
	use						generic-service
	check_command			check_service_nsclient!welcome!15003|CPULOAD -l 5,80,90!!!!!
	max_check_attempts		5
	check_interval			5
	retry_interval			1
	check_period			24x7
	notification_interval	60
	notification_period	24x7
	register			1
	}

Re: Nagios Core (FAN) - monitoring clients behind NAT

Posted: Fri May 03, 2013 5:44 pm
by STELLANOVA
I got this error:

Code: Select all

(Return code of 127 is out of bounds - plugin may be missing)

Re: Nagios Core (FAN) - monitoring clients behind NAT

Posted: Sat May 04, 2013 10:43 pm
by scottwilkerson
Have you installed Nagios Plugins on the machine?
http://nagiosplugins.org/