Monitor services on remote linux host

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.
Ravikimt
Posts: 77
Joined: Tue Apr 03, 2018 12:02 pm

Monitor services on remote linux host

Post by Ravikimt »

I am using nagios core 4.3.4 on my ubuntu machine (16.04 LTS). I have to monitor a host which is in remote location that is also linux machine (Ubuntu). I have installed nrpe on my remote host and I am able to monitoring some services of the host like root partition, swap memory, ping.

But my requirement is that I have to monitor other process also on the host machine like python, mysql , node.js also.

Can somebody help me here how I can monitor these process also.? and Is it mandatory to install nrpe plugin on my nagios server also.?
Because I didn't install nrpe plugin on my nagios server I have already install nagios-plugins-2.2.1 pulgin on my nagios server.
Last edited by Ravikimt on Thu May 17, 2018 9:34 am, edited 1 time in total.
Ravikimt
Posts: 77
Joined: Tue Apr 03, 2018 12:02 pm

Re: Monitor services on remote linux host

Post by Ravikimt »

To monitor mysql service I am using below mentioned command can you please verify whether is it correct or not.?

define service {
use local-service
host_name Sales-Demo
service_description MYSQL
check_command check_tcp!3306
contact_groups IBM-Nagios
notification_options w,u,c,r
notification_interval 10
notification_period 24x7
}

define command{
command_name check_tcp
command_line $USER1$/check_tcp -H $HOSTADDRESS$ -p $ARG1$ $ARG2$
}
Ravikimt
Posts: 77
Joined: Tue Apr 03, 2018 12:02 pm

Re: Monitor services on remote linux host

Post by Ravikimt »

Any suggestion on that waiting for your response. Please help me
kyang

Re: Monitor services on remote linux host

Post by kyang »

But my requirement is that I have to monitor other process also on the host machine like python, mysql , node.js also.

Can somebody help me here how I can monitor these process also.? and Is it mandatory to install nrpe plugin on my nagios server also.?
Because I didn't install nrpe plugin on my nagios server I have already install nagios-plugins-2.2.1 pulgin on my nagios server.
Let's back up a moment, what version of NRPE did you install and what documentation did you follow?

So you don't have nagios plugins installed on the nagios server?

Are you able to successfully contact the remote ubuntu service that has NRPE installed?

From Nagios terminal: (Make sure to replace remotehostIP with your actual remote host IP)

Code: Select all

/usr/local/nagios/libexec/check_nrpe -H remotehostIP
Ravikimt
Posts: 77
Joined: Tue Apr 03, 2018 12:02 pm

Re: Monitor services on remote linux host

Post by Ravikimt »

Yes, Now I have installed Ngaios plugin NRPE v3.2.1 on my remote machine as well as my Nagios server also.

After running this command /usr/local/nagios/libexec/check_nrpe -H remotehostIP.

I am getting this error when I am trying from my Remote host to Nagios server.

CHECK_NRPE: Error - Could not connect to 10.10.XX.XX: Connection reset by peer.

Nagios Server to Remote Host.

connect to host 10.10.xx.xx port 5666: Connection refused
kyang

Re: Monitor services on remote linux host

Post by kyang »

Hello,

What do you have in the allowed_hosts in the nrpe.cfg files.

Did you add the remotehostIP to the Nagios nrpe.cfg file? under allowed_hosts

Is port 5666 opened on the Nagios Server and the remote host server?

Please run these commands from the Nagios Server.

Code: Select all

sudo nmap nagiosIP -p 5666
sudo nmap remotehostIP -p 5666
You may have to install nmap on the Nagios server.
sudo apt-get install nmap
Ravikimt
Posts: 77
Joined: Tue Apr 03, 2018 12:02 pm

Re: Monitor services on remote linux host

Post by Ravikimt »

I have installed nrpe on Nagios server as well as Nagios host. I have mentioned Nagios server IP under nrpe.cfg file which is installed on host.
Same I did for Nagios server also I have mentioned host IP under nrpe.cfg file which is installed on server.

I can see that host is listening the nrpe service on port 5666 but Nagios server is not. what I can do in this case or how I can check nrpe status on Nagios server whether the nrpe servoce is running or not.?
Last edited by Ravikimt on Tue May 22, 2018 11:24 am, edited 1 time in total.
Ravikimt
Posts: 77
Joined: Tue Apr 03, 2018 12:02 pm

Re: Monitor services on remote linux host

Post by Ravikimt »

My Nagios Host listening on port 5666.

nrpe 66130 nagios 4u IPv4 2521402 0t0 TCP *:nrpe (LISTEN)
nrpe 66130 nagios 5u IPv6 2521403 0t0 TCP *:nrpe (LISTEN)

I have removed nrpe directory from my Nagios server and still I am able to monitor the local host services may be it is monitoring the services check_by_ssh or I have uncommented below mentioned command from my command.cfg file.

define command{
command_name check_nrpe
command_line $USER1$/check_nrpe -H $HOSTADDRESS$ -c $ARG1$
}

Is it mandatory to install nrpe agent on Nagios server.? I am able to monitor other services on my Nagios host But I am facing this problem only when I am trying to minotor mysql service on remote host.

getting this error "connect to address 10.10.xxx.xx and port 3306: Connection refused"
User avatar
mcapra
Posts: 3739
Joined: Thu May 05, 2016 3:54 pm

Re: Monitor services on remote linux host

Post by mcapra »

Ravikimt wrote:Is it mandatory to install nrpe agent on Nagios server.
Not necessarily. All that is mandatory is that the remote machine you are communicating with via NRPE (which is most typically done from the Nagios Core machine using check_nrpe to the remote NRPE server) has the NRPE server running on the specified port (5666 by default).

We'll need to see the output of the commands requested by @kyang before much more troubleshooting can be done.
kyang wrote: Please run these commands from the Nagios Server.

Code: Select all

sudo nmap nagiosIP -p 5666
sudo nmap remotehostIP -p 5666
You may have to install nmap on the Nagios server.
sudo apt-get install nmap
It is a good sign that the remote machine is listening on port 5666, but that doesn't necessarily mean the Nagios Core machine is able to reach that remote machine. nmap will help identify potential routing issues.

Can you also share the full contents of your remote machine's nrpe.cfg? This may be useful information if there are no routing issues identified by the above commands.
Former Nagios employee
https://www.mcapra.com/
Ravikimt
Posts: 77
Joined: Tue Apr 03, 2018 12:02 pm

Re: Monitor services on remote linux host

Post by Ravikimt »

I ran nmap command on Nagios server.

sudo nmap 10.10.xxx.xx(Nagios server IP) -p 5666
Output:- Nmap scan report for 10.10.xxx.xx
Host is up (0.000062s latency).
PORT STATE SERVICE
5666/tcp closed nrpe


sudo nmap 10.10.xxx.xx(remote host ip) -p 5666
Output:-Nmap scan report for 10.10.xxx.xx
Host is up (0.27s latency).
PORT STATE SERVICE
5666/tcp open nrpe

It means port is close on Nagios Sever to open 5666 port on Nagios sever I have to add IP tables rules.

Can you please review this command to open port 5666 on Nagios server.?
iptables -A INPUT -p tcp -m tcp --dport 5666 -j ACCEPT
Locked