Page 2 of 3

Re: Monitoring JMX

Posted: Tue May 15, 2018 7:49 am
by jankogaga
I have followed https://support.nagios.com/kb/article.php?id=515.
I run Centos 7 in a docker container

when trying

Code: Select all

make install-init
I get:

Code: Select all

No init file to install
make: *** [install-init] Error 1
I think that is related to the docker implementation.

Re: Monitoring JMX

Posted: Tue May 15, 2018 12:43 pm
by tgriep
The make install-init is looking for the following script
rh-upstart-init
in the startup folder.
Does it exist and does the rh-upstart-init.in file exist in that folder?

Can you post the config.log file from the nrpe source folder?

Re: Monitoring JMX

Posted: Wed May 16, 2018 2:56 am
by jankogaga
/tmp/nrpe-nrpe-3.2.1/startup/rh-upstart-init.in does exist.
Here is attached /tmp/nrpe-nrpe-3.2.1/config.log

Re: Monitoring JMX

Posted: Wed May 16, 2018 8:02 am
by scottwilkerson
Actually it should be just

Code: Select all

/tmp/nrpe-nrpe-3.2.1/startup/rh-upstart-init
However, pardon my ignorance, but can you run traditional services now in a docker container? I ask because last I worked with them a few years ago you could not.

Re: Monitoring JMX

Posted: Wed May 16, 2018 8:48 am
by jankogaga
Both, /tmp/nrpe-nrpe-3.2.1/startup/rh-upstart-init and /tmp/nrpe-nrpe-3.2.1/startup/rh-upstart-init.in exist.
I tried now starting "make install-init" from startup folder:

Code: Select all

[root@test-difin startup]# make install-init
make: *** No rule to make target `install-init'.  Stop.
Regarding docker container:
In Dockerfile you can add:

Code: Select all

COPY            supervisord.conf /etc/supervisord.conf
ENTRYPOINT      ["/usr/bin/supervisord"]
In supervisord.conf define what services-daemon will be started.
E.g. for nrpe deamon I would add (maybe I am wrong):

Code: Select all

[program:nrpe]
command=/usr/sbin/nrpe -c /usr/local/nagios/etc/nrpe.cfg -d 

Re: Monitoring JMX

Posted: Wed May 16, 2018 9:04 am
by scottwilkerson
There is no "init" file for docker then, the configure script can't detect you are in docker, you would have to skip that part and add the supervisord item

But I believe the command is as follows

Code: Select all

[program:nrpe]
command=/usr/local/nagios/bin/nrpe -c /usr/local/nagios/etc/nrpe.cfg -d

Re: Monitoring JMX

Posted: Wed May 16, 2018 10:03 am
by jankogaga
Thanks scottwilkerson.
This command does the trick.
Now, I get:

Code: Select all

[root@test-difin /]# netstat -anp |grep 5666
tcp        0      0 0.0.0.0:5666            0.0.0.0:*               LISTEN      -
tcp6       0      0 :::5666                 :::*                    LISTEN      -
but still on the Nagios Core server:

Code: Select all

/usr/local/nagios/libexec/check_nrpe -H 10.30.30.33
connect to address 10.30.30.33 port 5666: Connection refused
connect to host 10.30.30.33 port 5666: Connection refused

Re: Monitoring JMX

Posted: Wed May 16, 2018 10:35 am
by scottwilkerson
Well we are getting somewhere, again, my docker is VERY rusty, but don't you have to map ports to expose them to the outside world?

Re: Monitoring JMX

Posted: Thu May 17, 2018 3:32 am
by jankogaga
The port mapping is already done:

Code: Select all

-p 10.30.30.33:5666:5666
firewall rules on docker'host is set:

Code: Select all

-A PREROUTING -i eth0 -p tcp --dport 5666 -j DNAT --to-destination 10.30.30.33
-A PREROUTING -i eth0 -p udp --dport 5666 -j DNAT --to-destination 10.30.30.33

-A ufw-user-input -p tcp --dport 5666 -j ACCEPT
-A ufw-user-input -p udp --dport 5666 -j ACCEPT
But still can't connect to it from Nagioc Core

Re: Monitoring JMX

Posted: Thu May 17, 2018 8:34 am
by scottwilkerson
The

Code: Select all

Connection refused
is not coming form NRPE, it is at a different layer, like something is blocking the port e.g. firewall, or NRPE isn't actually bound to the port which doesn't seem to be the case because of your netstat output