Tag Archives: nagios

No output on stdout) stderr: connect to address XXX.XXX.XXX.XXX port 5666: Connection refused 

This was tested on a CentOS 7.

This might have TWO possible causes

  • nrpe service is down
    use service nrpe status to test it.
    You might wanna see ‘section’ Add NRPE to service bellow, to activate nrpe as a service.
  • firewall on nrpe machine is blocking it

 

Some important files/directories

nrpe.cfg – /etc/nagios/nrpe.cfg
nagios/nrpe plugins folder – /usr/lib64/nagios/plugins/
logs – /var/log/messages

 

nrpe.cfg

My nrpe.cfg, in a CentOS 7, is located at /etc/nagios/nrpe.cfg

nano /etc/nagios/nrpe.cfg
nrpe log

In a default nrpe installation log is disabled!
You might want to enable it for better debug of the issues… Go to  and enable it.

log_file=/var/run/nrpe.log

nrpe debug mode

Yah!, the default installation will came also with debug disabled.
We want it enabled to see more information while we try to use service nrpe status for example.

debug=1

server_address

Server address… it might confuse you!
Server address ISN’T the NAGIOS’s ip address. It’s the actual external IP address of the current machine! allowed_hosts it’s actually it!

Lets check out the status of 5666 port.
lsof -i:5666
netstat -an |grep 5666

If you don’t see any result… this probably means that nrpe is down!
See the ‘section’ Add NRPE to service bellow.

Open PORT on the firewall
sudo firewall-cmd --permanent --zone=public --add-port=5666/tcp
firewall-cmd --reload
Add NRPE to service  – this will lunch nrpe on reboots –
sudo systemctl enable nrpe.service
sudo systemctl start nrpe.service

Continue reading No output on stdout) stderr: connect to address XXX.XXX.XXX.XXX port 5666: Connection refused 

Failed to obtain lock on file /var/run/nagios/nagios.pid: No such file or directory

Another nagios update – another issue -…

[1490254976] Event broker module ‘NERD’ deinitialized successfully.
[1490254991] Failed to obtain lock on file /var/run/nagios/nagios.pid: No such file or directory
[1490254991] Bailing out due to errors encountered while attempting to daemonize… (PID=792)

SHIT!

I had to

mkdir /var/run/nagios
chown nagios:nagios /var/run/nagios

 

And restart nagios.

nagios check_apt

 

Return code of 127 is out of bounds – plugin may be missing

captura-de-ecra%cc%83-2016-10-19-as-15-28-05

On the check_command, I had to prepend check_nrpe! since we are using the nrpe client on the server to read and return us the desired value.

No output returned from plugin

no_output_returned_from_plugin

On the check_command, I had to append, with for example !1, since we need to pass $$ARG1$$

NRPE: Command ‘check_apt’ not defined

captura-de-ecra%cc%83-2016-10-19-as-17-13-52

Check you /etc/nagios/nrpe.cfg you need to set it up there.

 

Well, I got it working!

On nagios nrpe server my /etc/nagios/nrpe.cfg I add the following line

command[check_apt]=/usr/lib/nagios/plugins/check_apt

Restart nagios-nrpe

service nagios-nrpe-server restart

 

On nagios server my /etc/nagios/hosts/s4.domain.com.cfg this is what I have

define service {
   use                     generic-service
   host_name               s4.domain.com
   service_description     SYS: system updates
   check_command           check_nrpe!check_apt!1
}

Restart nagios server

service nagios restart

Hooray!

captura-de-ecra%cc%83-2016-10-20-as-07-30-19

 

Ubuntu Nagios NRPE – 1, 2, 3 install!

 

0. Update the system

apt-get update && apt-get upgrade

1. Install nagios nrpe & nagios plugins

apt-get install nagios-nrpe-server nagios-plugins

2. Configure NRPE

vi /etc/nagios/nrpe.cfg

Search for server_address and replace 120.0.0.1 for the public ip of this machine.
Search for allowed_hosts and replace 120.0.0.1 for the IP of your nagios server.

3. Restart NRPE

/etc/init.d/nagios-nrpe-server restart

That’s kinda it…