Nagios dockerised application

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.
Locked
jim
Posts: 37
Joined: Wed Jun 08, 2016 11:18 am

Nagios dockerised application

Post by jim »

Hello All,

I want to create a dockerised application of nagios which would monitor my servers very much the same way as like as like nagios installed on Physical servers:

My docker file looks like:

Code: Select all

[jim@docker1 ~]$ cat Documents/nagios-docker/Dockerfile 
FROM centos

MAINTAINER Jim<[email protected]>

RUN yum -y install make httpd php php-cli gcc glibc glibc-common gd gd-devel net-snmp openssl-devel wget unzip

RUN useradd nagios && groupadd nagcmd && usermod -a -G nagcmd nagios && usermod -a -G nagcmd apache

ADD https://assets.nagios.com/downloads/nagioscore/releases/nagios-4.1.1.tar.gz /tmp/nagios-4.1.1.tar.gz

RUN cd /tmp && tar -zxvf nagios-4.1.1.tar.gz && cd nagios*  && ./configure --with-command-group=nagcmd && make all && make install && make install-config && make install-commandmode && make install-webconf && /usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg && htpasswd -c /usr/local/nagios/etc/htpasswd.users nagios

ADD http://www.nagios-plugins.org/download/nagios-plugins-2.1.1.tar.gz  /tmp/nagios-plugins-2.1.1.tar.gz
RUN cd /tmp && tar -zxvf nagios-plugins-* && cd nagios-plugins* && ./configure --with-nagios-user=nagios --with-nagios-group=nagios && make all && make install

EXPOSE 80

VOLUME /usr/local/nagios/bin
VOLUME /usr/local/nagios/etc
VOLUME /usr/local/nagios/libexec
[jim@docker1 ~]$

Code: Select all

[jim@docker1 nagios-docker]$ docker run -d --name jim-nagios-daemon jim_nagios_docker /usr/local/nagios/bin/nagios -d /usr/local/nagios/etc/nagios.cfg
5cde29b82098b02565199bd2cfc2740c97ade0bab74dff20260e26a55f339e18
[jim@docker1 nagios-docker]$ docker ps -a
CONTAINER ID        IMAGE                 COMMAND                  CREATED             STATUS                     PORTS               NAMES
5cde29b82098        jim_nagios_docker   "/usr/local/nagios/bi"   5 seconds ago       Exited (0) 4 seconds ago                       jim-nagios-daemon
[jim@docker1 nagios-docker]$ 
Not sure why it making an exit? It should be running all the time.
eltrasimaco
Posts: 75
Joined: Thu Aug 02, 2012 7:15 am

Re: Nagios dockerised application

Post by eltrasimaco »

Shouldnt exit, there must be something wrong with permissions, missing paths or alike
See logs or raise the docker output to debug in order to track the problem. Did you fix it?
tmcdonald
Posts: 9117
Joined: Mon Sep 23, 2013 8:40 am

Re: Nagios dockerised application

Post by tmcdonald »

I'll point out that Docker questions should be asked in a Docker-specific forum going forward, as we don't officially support that here.

As far as your Nagios issues go, you might consider turning on debugging in nagios.cfg to get a better idea of what is happening before a crash:

https://assets.nagios.com/downloads/nag ... ebug_level

I'd recommend turning them up as high as they go for starters (debug_level=-1, debug_verbosity=2)
Former Nagios employee
Locked