Monitoring Docker containers

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.
jankogaga
Posts: 37
Joined: Thu Apr 19, 2018 8:16 am

Re: Monitoring JMX

Post 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.
User avatar
tgriep
Madmin
Posts: 9177
Joined: Thu Oct 30, 2014 9:02 am

Re: Monitoring JMX

Post 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?
Be sure to check out our Knowledgebase for helpful articles and solutions!
jankogaga
Posts: 37
Joined: Thu Apr 19, 2018 8:16 am

Re: Monitoring JMX

Post 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
Attachments
config.log
(62.84 KiB) Downloaded 355 times
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

Re: Monitoring JMX

Post 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.
Former Nagios employee
Creator:
ahumandesign.com
enneagrams.com
jankogaga
Posts: 37
Joined: Thu Apr 19, 2018 8:16 am

Re: Monitoring JMX

Post 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 
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

Re: Monitoring JMX

Post 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
Former Nagios employee
Creator:
ahumandesign.com
enneagrams.com
jankogaga
Posts: 37
Joined: Thu Apr 19, 2018 8:16 am

Re: Monitoring JMX

Post 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
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

Re: Monitoring JMX

Post 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?
Former Nagios employee
Creator:
ahumandesign.com
enneagrams.com
jankogaga
Posts: 37
Joined: Thu Apr 19, 2018 8:16 am

Re: Monitoring JMX

Post 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
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

Re: Monitoring JMX

Post 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
Former Nagios employee
Creator:
ahumandesign.com
enneagrams.com
Locked