From b481b73a8fe8f2aeda2c1d41bf6d723fa58e5442 Mon Sep 17 00:00:00 2001 From: Chris Yocum Date: Tue, 22 Dec 2020 09:07:16 -0500 Subject: [PATCH] Merge in changes for PR #115 --- Dockerfile | 25 +++++++++++++++++++++---- README.md | 3 ++- overlay/etc/xinetd.d/livestatus | 14 ++++++++++++++ overlay/opt/nagios/etc/nagios.cfg | 1 + 4 files changed, 38 insertions(+), 5 deletions(-) create mode 100644 overlay/etc/xinetd.d/livestatus diff --git a/Dockerfile b/Dockerfile index fca249a..661f50d 100644 --- a/Dockerfile +++ b/Dockerfile @@ -22,7 +22,8 @@ ENV NAGIOS_HOME=/opt/nagios \ NAGIOS_BRANCH=nagios-4.4.6 \ NAGIOS_PLUGINS_BRANCH=release-2.3.3 \ NRPE_BRANCH=nrpe-4.0.2 \ - NSCA_TAG=nsca-2.10.0 + NSCA_TAG=nsca-2.10.0 \ + MK_LIVESTATUS_VERSION=1.6.0p19 RUN echo postfix postfix/main_mailer_type string "'Internet Site'" | debconf-set-selections && \ echo postfix postfix/mynetworks string "127.0.0.0/8" | debconf-set-selections && \ @@ -86,7 +87,6 @@ RUN echo postfix postfix/main_mailer_type string "'Internet Site'" | debconf-set snmpd \ snmp-mibs-downloader \ unzip \ - python2 \ xinetd && \ apt-get -qq clean && \ rm -rf /var/lib/apt/lists/* @@ -178,6 +178,7 @@ RUN cd /tmp && \ cp sample-config/nsca.cfg ${NAGIOS_HOME}/etc/ && \ cp sample-config/send_nsca.cfg ${NAGIOS_HOME}/etc/ +# Install additional plugins RUN cd /opt && \ wget -O get-pip.py https://bootstrap.pypa.io/get-pip.py && \ python2 get-pip.py && \ @@ -193,6 +194,18 @@ RUN cd /opt && \ cp /opt/nagios-mssql/check_mssql_database.py ${NAGIOS_HOME}/libexec/ && \ cp /opt/nagios-mssql/check_mssql_server.py ${NAGIOS_HOME}/libexec/ +# Install mk-livestatus +RUN cd /tmp && \ + wget https://mathias-kettner.de/download/mk-livestatus-${MK_LIVESTATUS_VERSION}.tar.gz && \ + tar zxf mk-livestatus-${MK_LIVESTATUS_VERSION}.tar.gz && \ + cd mk-livestatus-${MK_LIVESTATUS_VERSION} && \ + ./configure --with-nagios4 && \ + make && \ + make install + +RUN mkdir -p /usr/local/nagios/var/rw && \ + chown ${NAGIOS_USER}:${NAGIOS_GROUP} /usr/local/nagios/var/rw + RUN sed -i.bak 's/.*\=www\-data//g' /etc/apache2/envvars #RUN export DOC_ROOT="DocumentRoot $(echo ${NAGIOS_HOME}/share)" && \ @@ -270,13 +283,17 @@ RUN apt-get -qq -y autoremove && \ nagios-plugins \ nrpe \ nagiosgraph \ - nsca && \ + nsca \ + mk-livestatus-${MK_LIVESTATUS_VERSION}* && \ # Remove some other files and dirs rm -rf /opt/nagiosgraph/etc/fix-nagiosgraph-multiple-selection.sh \ /opt/get-pip.py -# Expose port 80 for the web UI +# Expose ports +# 80 for the web UI EXPOSE 80 +# 6557 for mk-livestatus +EXPOSE 6557 # Specify volumes VOLUME "${NAGIOS_HOME}/var" "${NAGIOS_HOME}/etc" "/var/log/apache2" "/opt/Custom-Nagios-Plugins" "/opt/nagiosgraph/var" "/opt/nagiosgraph/etc" diff --git a/README.md b/README.md index 6a9a039..33b88e3 100644 --- a/README.md +++ b/README.md @@ -10,6 +10,7 @@ Fork of [JasonRivers Docker Nagios image](https://github.com/JasonRivers/Docker- * [#101](https://github.com/JasonRivers/Docker-Nagios/pull/101) - Fixes to allow building on ARM aarch64 architecture (@garethrandall) * [#110](https://github.com/JasonRivers/Docker-Nagios/pull/110) - Update to Ubuntu 18.04 LTS (@asimzeeshan) * [#112](https://github.com/JasonRivers/Docker-Nagios/pull/112) - Add python3-nagiosplugin for plugins that need it (@davralin) +* [#115](https://github.com/JasonRivers/Docker-Nagios/pull/115) - Add mk_livestatus allowing it to work w/ Thruk (@mmerian) * [#116](https://github.com/JasonRivers/Docker-Nagios/pull/116) - Update Nagios to 4.4.6 (@mmerian) * [#120](https://github.com/JasonRivers/Docker-Nagios/pull/120) - Add NSCA (@mmerian) @@ -25,7 +26,7 @@ Things that I have changed/updated so far: ## Information -Nagios Core 4.4.6 running on Ubuntu 18.04 LTS with NagiosGraph, NRPE, & NSCA. +Nagios Core 4.4.6 running on Ubuntu 20.04 LTS with NagiosGraph, NRPE, & NSCA. ### Configurations diff --git a/overlay/etc/xinetd.d/livestatus b/overlay/etc/xinetd.d/livestatus new file mode 100644 index 0000000..12d2e61 --- /dev/null +++ b/overlay/etc/xinetd.d/livestatus @@ -0,0 +1,14 @@ +service livestatus +{ + type = UNLISTED + port = 6557 + socket_type = stream + protocol = tcp + wait = no + cps = 100 3 + flags = NODELAY + user = nagios + server = /usr/local/bin/unixcat + server_args = /usr/local/nagios/var/rw/live + disable = no +} \ No newline at end of file diff --git a/overlay/opt/nagios/etc/nagios.cfg b/overlay/opt/nagios/etc/nagios.cfg index d0fdbc3..6189565 100644 --- a/overlay/opt/nagios/etc/nagios.cfg +++ b/overlay/opt/nagios/etc/nagios.cfg @@ -223,6 +223,7 @@ event_broker_options=-1 #broker_module=/somewhere/module1.o #broker_module=/somewhere/module2.o arg1 arg2=3 debug=0 +broker_module=/usr/local/lib/mk-livestatus/livestatus.o /usr/local/nagios/var/rw/live event_broker_options=-1 # LOG ROTATION METHOD