diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 9437f26..9360c26 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -13,48 +13,38 @@ on: jobs: build: if: "!contains(github.event.head_commit.message, 'skip ci')" - runs-on: ubuntu-22.04 + runs-on: ubuntu-24.04 strategy: matrix: - architecture: [linux-amd64, linux-arm64, linux-arm-v7] + architecture: [linux-amd64, linux-arm64] outputs: version: ${{ steps.prep.outputs.version }} branch: ${{ steps.prep.outputs.branch }} + time: ${{ steps.vars.outputs.time }} steps: - name: Checkout - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Check if architecture exists id: arch_check run: | (test -f Dockerfile.${{ matrix.architecture }} && echo "check=passed" >> $GITHUB_OUTPUT) || echo "check=failed" >> $GITHUB_OUTPUT - # Workaround for Cargo issue: https://github.com/rust-lang/cargo/issues/8719 - - name: Set Swap Space - uses: pierotofy/set-swap-space@v1.0 - with: - swap-size-gb: 10 - - run: | - sudo mkdir -p /var/lib/docker - sudo mount -t tmpfs -o size=10G none /var/lib/docker - sudo systemctl restart docker - - name: Set up QEMU if: "contains(steps.arch_check.outputs.check, 'passed')" - uses: docker/setup-qemu-action@v2.1.0 + uses: docker/setup-qemu-action@v3.0.0 - name: Set up Docker Buildx if: "contains(steps.arch_check.outputs.check, 'passed')" - uses: docker/setup-buildx-action@v2.4.1 + uses: docker/setup-buildx-action@v3.3.0 with: install: true version: latest - # Fix for https://github.com/docker/buildx/issues/1509 - driver-opts: image=moby/buildkit:v0.10.5 #:master + driver-opts: image=moby/buildkit:master - name: Login to docker.io if: "contains(steps.arch_check.outputs.check, 'passed')" - uses: docker/login-action@v2.1.0 + uses: docker/login-action@v3.2.0 with: registry: docker.io username: ${{ secrets.DOCKER_USERNAME }} @@ -62,7 +52,7 @@ jobs: - name: Login to ghcr.io if: "contains(steps.arch_check.outputs.check, 'passed')" - uses: docker/login-action@v2.1.0 + uses: docker/login-action@v3.2.0 with: registry: ghcr.io username: ${{ github.repository_owner }} @@ -96,41 +86,11 @@ jobs: echo $GITHUB_OUTPUT - - name: Build and push - Attempt 1 + - name: Build and push continue-on-error: true if: "contains(steps.arch_check.outputs.check, 'passed')" id: build_attempt1 - uses: docker/build-push-action@v4.0.0 - with: - push: true - platforms: ${{ steps.prep.outputs.platform }} - file: ./Dockerfile.${{ matrix.architecture }} - cache-from: docker.io/${{ steps.prep.outputs.cache }} - cache-to: docker.io/${{ steps.prep.outputs.cache }} - tags: | - docker.io/${{ steps.prep.outputs.tag }} - ghcr.io/${{ steps.prep.outputs.tag }} - labels: | - org.opencontainers.image.created=${{ steps.prep.outputs.created }} - org.opencontainers.image.title=${{ steps.prep.outputs.title }} - org.opencontainers.image.revision=${{ steps.prep.outputs.revision }} - org.opencontainers.image.source=${{ steps.prep.outputs.source }} - org.opencontainers.image.vendor=${{ steps.prep.outputs.vendor }} - org.opencontainers.image.url=${{ steps.prep.outputs.url }} - org.opencontainers.image.version=${{ steps.prep.outputs.version }} - build-args: | - GITHUB_TOKEN=${{ secrets.GHCR_TOKEN }} - BUILD_ARCHITECTURE=${{ matrix.architecture }} - ${{ steps.prep.outputs.build-args }} - - - name: Sleep - if: (steps.build_attempt1.outcome == 'failure') - run: | - sleep 30 - - - name: Build and push - Attempt 2 - if: (steps.build_attempt1.outcome == 'failure') - uses: docker/build-push-action@v4.0.0 + uses: docker/build-push-action@v5.4.0 with: push: true platforms: ${{ steps.prep.outputs.platform }} @@ -154,18 +114,18 @@ jobs: ${{ steps.prep.outputs.build-args }} publish: - runs-on: ubuntu-22.04 + runs-on: ubuntu-24.04 strategy: matrix: registry: [docker.io, ghcr.io] needs: [build] steps: - name: Checkout - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Login to docker.io if: matrix.registry == 'docker.io' - uses: docker/login-action@v2.1.0 + uses: docker/login-action@v3.2.0 with: registry: docker.io username: ${{ secrets.DOCKER_USERNAME }} @@ -173,13 +133,13 @@ jobs: - name: Login to ghcr.io if: matrix.registry == 'ghcr.io' - uses: docker/login-action@v2.1.0 + uses: docker/login-action@v3.2.0 with: registry: ghcr.io username: ${{ github.repository_owner }} password: ${{ secrets.GHCR_TOKEN }} - - name: Create manifests - Attempt 1 + - name: Create manifests continue-on-error: true id: manifest_attempt1 env: @@ -189,50 +149,8 @@ jobs: TAG=${{ needs.build.outputs.branch }} SOURCE=${IMAGE}:${TAG}-${GITHUB_SHA:0:7}-${GITHUB_RUN_NUMBER} VERSION=${{ needs.build.outputs.version }} - BRANCH=${{ needs.build.outputs.branch }} - [[ -f Dockerfile.linux-amd64 ]] && AMD64=${SOURCE}-linux-amd64 - [[ -f Dockerfile.linux-arm64 ]] && ARM64=${SOURCE}-linux-arm64 - [[ -f Dockerfile.linux-arm-v7 ]] && ARMV7=${SOURCE}-linux-arm-v7 - docker manifest create ${IMAGE}:${TAG} ${AMD64} ${ARM64} ${ARMV7} - docker manifest push ${IMAGE}:${TAG} - docker manifest create ${IMAGE}:${TAG}-${VERSION} ${AMD64} ${ARM64} ${ARMV7} - docker manifest push ${IMAGE}:${TAG}-${VERSION} - docker manifest create ${IMAGE}:${TAG}-${VERSION} ${AMD64} ${ARM64} ${ARMV7} - docker manifest push ${IMAGE}:${TAG}-${VERSION} - if [[ ${BRANCH} == master ]]; then - docker manifest create ${IMAGE}:latest ${AMD64} ${ARM64} ${ARMV7} - docker manifest push ${IMAGE}:latest - fi - - - name: Sleep - if: (steps.manifest_attempt1.outcome == 'failure') - run: | - sleep 30 - - - name: Create manifests - Attempt 2 - if: (steps.manifest_attempt1.outcome == 'failure') - env: - DOCKER_CLI_EXPERIMENTAL: enabled - run: | - IMAGE=${{ matrix.registry }}/$(echo ${GITHUB_REPOSITORY} | tr '[:upper:]' '[:lower:]' | sed s/docker-//) - TAG=${{ needs.build.outputs.branch }} - SOURCE=${IMAGE}:${TAG}-${GITHUB_SHA:0:7}-${GITHUB_RUN_NUMBER} - VERSION=${{ needs.build.outputs.version }} - BRANCH=${{ needs.build.outputs.branch }} - [[ -f Dockerfile.linux-amd64 ]] && AMD64=${SOURCE}-linux-amd64 - [[ -f Dockerfile.linux-arm64 ]] && ARM64=${SOURCE}-linux-arm64 - [[ -f Dockerfile.linux-arm-v7 ]] && ARMV7=${SOURCE}-linux-arm-v7 - docker manifest rm ${IMAGE}:${TAG} || true - docker manifest create ${IMAGE}:${TAG} ${AMD64} ${ARM64} ${ARMV7} - docker manifest push ${IMAGE}:${TAG} - docker manifest rm ${IMAGE}:${TAG}-${VERSION} || true - docker manifest create ${IMAGE}:${TAG}-${VERSION} ${AMD64} ${ARM64} ${ARMV7} - docker manifest push ${IMAGE}:${TAG}-${VERSION} - docker manifest rm ${IMAGE}:${TAG}-${VERSION} || true - docker manifest create ${IMAGE}:${TAG}-${VERSION} ${AMD64} ${ARM64} ${ARMV7} - docker manifest push ${IMAGE}:${TAG}-${VERSION} - if [[ ${BRANCH} == master ]]; then - docker manifest rm ${IMAGE}:latest || true - docker manifest create ${IMAGE}:latest ${AMD64} ${ARM64} ${ARMV7} - docker manifest push ${IMAGE}:latest + docker buildx imagetools create -t ${IMAGE}:${TAG} ${SOURCE}-linux-amd64 ${SOURCE}-linux-arm64 + docker buildx imagetools create -t ${IMAGE}:${TAG}-${VERSION} ${SOURCE}-linux-amd64 ${SOURCE}-linux-arm64 + if [[ ${GITHUB_REF//refs\/heads\//} == main ]]; then + docker buildx imagetools create -t ${IMAGE}:latest ${SOURCE}-linux-amd64 ${SOURCE}-linux-arm64 fi \ No newline at end of file diff --git a/Dockerfile.linux-amd64 b/Dockerfile.linux-amd64 index 3c1280b..835f0fb 100644 --- a/Dockerfile.linux-amd64 +++ b/Dockerfile.linux-amd64 @@ -2,44 +2,43 @@ ARG BUILDKIT_SBOM_SCAN_CONTEXT=true ARG BUILDKIT_SBOM_SCAN_STAGE=true -FROM ubuntu:22.04 - -LABEL name="Nagios" \ - nagiosVersion="4.5.1" \ - nagiosPluginsVersion="2.4.9" \ - nrpeVersion="4.1.0" \ - nscaVersion="2.10.2" \ - ncpaVersion="3.0.2" \ - nagiostvVersion="0.8.7" \ - homepage="https://www.nagios.com/" \ - maintainer="Tronyx " +FROM ubuntu:24.04 + +LABEL name="Nagios" +LABEL nagiosVersion="4.5.4" +LABEL nagiosPluginsVersion="2.4.11" +LABEL nrpeVersion="4.1.1" +LABEL nscaVersion="2.10.3" +LABEL ncpaVersion="3.1.0" +LABEL nagiostvVersion="0.9.2" +LABEL homepage="https://www.nagios.com/" +LABEL maintainer="Tronyx " # Environment variables -ENV NAGIOS_HOME=/opt/nagios \ - NAGIOS_USER=nagios \ - NAGIOS_GROUP=nagios \ - NAGIOS_CMDUSER=nagios \ - NAGIOS_CMDGROUP=nagios \ - NAGIOS_FQDN=nagios.example.com \ - NAGIOSADMIN_USER=nagiosadmin \ - NAGIOSADMIN_PASS=nagios \ - APACHE_RUN_USER=nagios \ - APACHE_RUN_GROUP=nagios \ - APACHE_LOCK_DIR=/var/run \ - APACHE_LOG_DIR=/var/log/apache2 \ - NAGIOS_TIMEZONE=UTC \ - DEBIAN_FRONTEND=noninteractive \ - NAGIOS_BRANCH=nagios-4.5.1 \ - NAGIOS_PLUGINS_BRANCH=release-2.4.9 \ - NRPE_BRANCH=nrpe-4.1.0 \ - NSCA_TAG=nsca-2.10.2 \ - NCPA_BRANCH=v3.0.2 \ - NAGIOSTV_VERSION=0.8.7 - -ENV NG_CGI_URL=/cgi-bin \ - NG_NAGIOS_CONFIG_FILE=${NAGIOS_HOME}/etc/nagios.cfg \ - NG_CGI_DIR=${NAGIOS_HOME}/sbin \ - NG_WWW_DIR=${NAGIOS_HOME}/share/nagiosgraph +ENV NAGIOS_HOME=/opt/nagios +ENV NAGIOS_USER=nagios +ENV NAGIOS_GROUP=nagios +ENV NAGIOS_CMDUSER=nagios +ENV NAGIOS_CMDGROUP=nagios +ENV NAGIOS_FQDN=nagios.example.com +ENV NAGIOSADMIN_USER=nagiosadmin +ENV NAGIOSADMIN_PASS=nagios +ENV APACHE_RUN_USER=nagios +ENV APACHE_RUN_GROUP=nagios +ENV APACHE_LOCK_DIR=/var/run +ENV APACHE_LOG_DIR=/var/log/apache2 +ENV NAGIOS_TIMEZONE=UTC +ENV DEBIAN_FRONTEND=noninteractive +ENV NG_CGI_URL=/cgi-bin +ENV NG_NAGIOS_CONFIG_FILE=${NAGIOS_HOME}/etc/nagios.cfg +ENV NG_CGI_DIR=${NAGIOS_HOME}/sbin +ENV NG_WWW_DIR=${NAGIOS_HOME}/share/nagiosgraph +ENV NAGIOS_BRANCH=nagios-4.5.4 +ENV NAGIOS_PLUGINS_BRANCH=release-2.4.11 +ENV NRPE_BRANCH=nrpe-4.1.1 +ENV NSCA_TAG=nsca-2.10.3 +ENV NCPA_BRANCH=v3.1.0 +ENV NAGIOSTV_VERSION=0.9.2 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 && \ @@ -56,6 +55,7 @@ RUN echo postfix postfix/main_mailer_type string "'Internet Site'" | debconf-set bsd-mailx \ build-essential \ ca-certificates \ + curl \ dnsutils \ fping \ freetds-dev \ @@ -69,6 +69,7 @@ RUN echo postfix postfix/main_mailer_type string "'Internet Site'" | debconf-set libcgi-pm-perl \ libcrypt-des-perl \ libcrypt-rijndael-perl \ + libcrypt-x509-perl \ libdbd-mysql-perl \ libdbd-pg-perl \ libdbi-dev \ @@ -81,30 +82,31 @@ RUN echo postfix postfix/main_mailer_type string "'Internet Site'" | debconf-set libgd-gd2-perl \ libjson-perl \ libldap2-dev \ - libmysqlclient-dev \ + libmariadb-dev \ libnagios-object-perl \ libmonitoring-plugin-perl \ libnet-snmp-perl \ libnet-tftp-perl \ libnet-xmpp-perl \ libpq-dev \ - libpython2-dev \ libpython3-dev \ libredis-perl \ librrds-perl \ libssl-dev \ libswitch-perl \ + libtext-glob-perl \ libwww-perl \ m4 \ - netcat \ + netcat-traditional \ openssh-client \ parallel \ php-cli \ php-gd \ postfix \ - python2 \ - python3-pip \ + python3-full \ python3-nagiosplugin \ + python3-pip \ + python3-venv \ rsync \ rsyslog \ runit \ @@ -219,11 +221,11 @@ RUN cd /tmp && \ # Install additional plugins RUN cd /opt && \ - wget -q -O get-pip.py https://bootstrap.pypa.io/pip/2.7/get-pip.py && \ - python2 get-pip.py && \ - pip install --no-cache-dir "pymssql<2.2.0" && \ - pip3 install --no-cache-dir --find-links https://wheel-index.linuxserver.io/ubuntu/ pywbem paramiko pplogger paho-mqtt && \ - pip3 install --no-cache-dir --find-links https://wheel-index.linuxserver.io/ubuntu/ --upgrade requests && \ + #python3 -m venv .venv && \ + #. .venv/bin/activate && \ + pip3 install --break-system-packages --no-cache-dir pymssql && \ + pip3 install --break-system-packages --no-cache-dir --find-links https://wheel-index.linuxserver.io/ubuntu/ pywbem paramiko pplogger paho-mqtt && \ + pip3 install --break-system-packages --no-cache-dir --find-links https://wheel-index.linuxserver.io/ubuntu/ --upgrade requests && \ git clone https://github.com/willixix/naglio-plugins.git WL-Nagios-Plugins && \ git clone https://github.com/JasonRivers/nagios-plugins.git JR-Nagios-Plugins && \ git clone https://github.com/justintime/nagios-plugins.git JE-Nagios-Plugins && \ @@ -286,9 +288,13 @@ RUN echo "use_timezone=${NAGIOS_TIMEZONE}" >> ${NAGIOS_HOME}/etc/nagios.cfg # Copy example config in-case the user has started with empty var or etc RUN mkdir -p /orig/var && \ mkdir -p /orig/etc && \ + mkdir -p /orig/graph-etc && \ + mkdir -p /orig/graph-var && \ mkdir -p /orig/xinetd.d && \ cp -Rp ${NAGIOS_HOME}/var/* /orig/var/ && \ cp -Rp ${NAGIOS_HOME}/etc/* /orig/etc/ && \ + cp -Rp /opt/nagiosgraph/etc/* /orig/graph-etc && \ + cp -Rp /opt/nagiosgraph/var/* /orig/graph-var && \ cp -Rp /etc/xinetd.d/* /orig/xinetd.d/ ## Set the permissions for example config @@ -310,7 +316,7 @@ RUN cd /opt/nagiosgraph/etc && \ sh fix-nagiosgraph-multiple-selection.sh # Enable all runit services -RUN ln -s /etc/sv/* /etc/service +RUN ln -sf /etc/sv/* /etc/service # Fix ping permissions for Nagios user RUN chmod u+s /usr/bin/ping diff --git a/Dockerfile.linux-arm-v7 b/Dockerfile.linux-arm-v7 index dba7b25..5fe944d 100644 --- a/Dockerfile.linux-arm-v7 +++ b/Dockerfile.linux-arm-v7 @@ -2,44 +2,43 @@ ARG BUILDKIT_SBOM_SCAN_CONTEXT=true ARG BUILDKIT_SBOM_SCAN_STAGE=true -FROM ubuntu:22.04 - -LABEL name="Nagios" \ - nagiosVersion="4.5.1" \ - nagiosPluginsVersion="2.4.9" \ - nrpeVersion="4.1.0" \ - nscaVersion="2.10.2" \ - ncpaVersion="3.0.2" \ - nagiostvVersion="0.8.7" \ - homepage="https://www.nagios.com/" \ - maintainer="Tronyx " +FROM ubuntu:24.04 + +LABEL name="Nagios" +LABEL nagiosVersion="4.5.2" +LABEL nagiosPluginsVersion="2.4.10" +LABEL nrpeVersion="4.1.0" +LABEL nscaVersion="2.10.2" +LABEL ncpaVersion="3.1.0" +LABEL nagiostvVersion="0.9.2" +LABEL homepage="https://www.nagios.com/" +LABEL maintainer="Tronyx " # Environment variables -ENV NAGIOS_HOME=/opt/nagios \ - NAGIOS_USER=nagios \ - NAGIOS_GROUP=nagios \ - NAGIOS_CMDUSER=nagios \ - NAGIOS_CMDGROUP=nagios \ - NAGIOS_FQDN=nagios.example.com \ - NAGIOSADMIN_USER=nagiosadmin \ - NAGIOSADMIN_PASS=nagios \ - APACHE_RUN_USER=nagios \ - APACHE_RUN_GROUP=nagios \ - APACHE_LOCK_DIR=/var/run \ - APACHE_LOG_DIR=/var/log/apache2 \ - NAGIOS_TIMEZONE=UTC \ - DEBIAN_FRONTEND=noninteractive \ - NAGIOS_BRANCH=nagios-4.5.1 \ - NAGIOS_PLUGINS_BRANCH=release-2.4.9 \ - NRPE_BRANCH=nrpe-4.1.0 \ - NSCA_TAG=nsca-2.10.2 \ - NCPA_BRANCH=v3.0.2 \ - NAGIOSTV_VERSION=0.8.7 - -ENV NG_CGI_URL=/cgi-bin \ - NG_NAGIOS_CONFIG_FILE=${NAGIOS_HOME}/etc/nagios.cfg \ - NG_CGI_DIR=${NAGIOS_HOME}/sbin \ - NG_WWW_DIR=${NAGIOS_HOME}/share/nagiosgraph +ENV NAGIOS_HOME /opt/nagios +ENV NAGIOS_USER nagios +ENV NAGIOS_GROUP nagios +ENV NAGIOS_CMDUSER nagios +ENV NAGIOS_CMDGROUP nagios +ENV NAGIOS_FQDN nagios.example.com +ENV NAGIOSADMIN_USER nagiosadmin +ENV NAGIOSADMIN_PASS nagios +ENV APACHE_RUN_USER nagios +ENV APACHE_RUN_GROUP nagios +ENV APACHE_LOCK_DIR /var/run +ENV APACHE_LOG_DIR /var/log/apache2 +ENV NAGIOS_TIMEZONE UTC +ENV DEBIAN_FRONTEND noninteractive +ENV NG_CGI_URL /cgi-bin +ENV NG_NAGIOS_CONFIG_FILE ${NAGIOS_HOME}/etc/nagios.cfg +ENV NG_CGI_DIR ${NAGIOS_HOME}/sbin +ENV NG_WWW_DIR ${NAGIOS_HOME}/share/nagiosgraph +ENV NAGIOS_BRANCH nagios-4.5.2 +ENV NAGIOS_PLUGINS_BRANCH release-2.4.10 +ENV NRPE_BRANCH nrpe-4.1.0 +ENV NSCA_TAG nsca-2.10.2 +ENV NCPA_BRANCH v3.1.0 +ENV NAGIOSTV_VERSION 0.9.2 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 && \ @@ -60,16 +59,21 @@ RUN echo postfix postfix/main_mailer_type string "'Internet Site'" | debconf-set dnsutils \ fping \ freetds-dev \ + gcc \ + gcc-arm* \ gettext \ git \ gperf \ iputils-ping \ jq \ + krb5-config \ + krb5-user \ libapache2-mod-php \ libcache-memcached-perl \ libcgi-pm-perl \ libcrypt-des-perl \ libcrypt-rijndael-perl \ + libcrypt-x509-perl \ libdbd-mysql-perl \ libdbd-pg-perl \ libdbi-dev \ @@ -82,31 +86,33 @@ RUN echo postfix postfix/main_mailer_type string "'Internet Site'" | debconf-set libgd-dev \ libgd-gd2-perl \ libjson-perl \ + libkrb5-dev \ libldap2-dev \ - libmysqlclient-dev \ + libmariadb-dev \ libnagios-object-perl \ libmonitoring-plugin-perl \ libnet-snmp-perl \ libnet-tftp-perl \ libnet-xmpp-perl \ libpq-dev \ - libpython2-dev \ libpython3-dev \ libredis-perl \ librrds-perl \ libssl-dev \ libswitch-perl \ + libtext-glob-perl \ libwww-perl \ m4 \ - netcat \ + netcat-traditional \ openssh-client \ parallel \ php-cli \ php-gd \ postfix \ - python2 \ - python3-pip \ + python3-full \ python3-nagiosplugin \ + python3-pip \ + python3-venv \ rsync \ rsyslog \ runit \ @@ -230,14 +236,11 @@ RUN cd /opt && \ curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sed 's#/proc/self/exe#\/bin\/sh#g' | sh -s -- --profile minimal -y && \ . "/root/.cargo/env" && \ export PATH="/root/.cargo/bin:$PATH" && \ - wget -q -O get-pip.py https://bootstrap.pypa.io/pip/2.7/get-pip.py && \ - python2 get-pip.py && \ - echo "Cython==0.29.35" >> constraints.txt && \ - export PIP_CONSTRAINT="$(pwd)/constraints.txt" && \ - pip install --no-cache-dir "pymssql<2.2.0" && \ - python3 -m pip install --upgrade pip && \ - pip3 install --no-cache-dir --find-links https://wheel-index.linuxserver.io/ubuntu/ pywbem paramiko pplogger paho-mqtt bcrypt && \ - pip3 install --no-cache-dir --find-links https://wheel-index.linuxserver.io/ubuntu/ --upgrade requests && \ + #python3 -m venv .venv && \ + #. .venv/bin/activate && \ + pip3 install --break-system-packages --no-cache-dir pymssql && \ + pip3 install --break-system-packages --no-cache-dir --find-links https://wheel-index.linuxserver.io/ubuntu/ pywbem paramiko pplogger paho-mqtt && \ + pip3 install --break-system-packages --no-cache-dir --find-links https://wheel-index.linuxserver.io/ubuntu/ --upgrade requests && \ git clone https://github.com/willixix/naglio-plugins.git WL-Nagios-Plugins && \ git clone https://github.com/JasonRivers/nagios-plugins.git JR-Nagios-Plugins && \ git clone https://github.com/justintime/nagios-plugins.git JE-Nagios-Plugins && \ @@ -300,9 +303,13 @@ RUN echo "use_timezone=${NAGIOS_TIMEZONE}" >> ${NAGIOS_HOME}/etc/nagios.cfg # Copy example config in-case the user has started with empty var or etc RUN mkdir -p /orig/var && \ mkdir -p /orig/etc && \ + mkdir -p /orig/graph-etc && \ + mkdir -p /orig/graph-var && \ mkdir -p /orig/xinetd.d && \ cp -Rp ${NAGIOS_HOME}/var/* /orig/var/ && \ cp -Rp ${NAGIOS_HOME}/etc/* /orig/etc/ && \ + cp -Rp /opt/nagiosgraph/etc/* /orig/graph-etc && \ + cp -Rp /opt/nagiosgraph/var/* /orig/graph-var && \ cp -Rp /etc/xinetd.d/* /orig/xinetd.d/ ## Set the permissions for example config @@ -324,7 +331,7 @@ RUN cd /opt/nagiosgraph/etc && \ sh fix-nagiosgraph-multiple-selection.sh # Enable all runit services -RUN ln -s /etc/sv/* /etc/service +RUN ln -sf /etc/sv/* /etc/service # Fix ping permissions for Nagios user RUN chmod u+s /usr/bin/ping @@ -337,7 +344,7 @@ RUN echo "ServerName ${NAGIOS_FQDN}" > /etc/apache2/conf-available/servername.co # Cleanup # Remove unecessary packages after install/setup are complete -RUN apt-get -qq -y remove software-properties-common && \ +RUN apt-get -qq -y remove software-properties-common libkrb5-dev krb5-config krb5-user gcc-arm* && \ apt-get -qq -y autoremove && \ # Remove dirs from git clones, cache, rustup, etc. rm -rf /root/.cache \ @@ -349,9 +356,10 @@ RUN apt-get -qq -y remove software-properties-common && \ /var/lib/dpkg/status-old && \ true > /var/log/dpkg.log && \ true > /var/log/lastlog && \ - true > /var/log/apt/term.log && \ + ####true > /var/log/apt/term.log && \ + true > /var/log/apt/term.log # Remove rust and all dependencies - echo y | /root/.cargo/bin/rustup self uninstall + #echo y | /root/.cargo/bin/rustup self uninstall # Expose port 80 for the web UI EXPOSE 80 5667 diff --git a/Dockerfile.linux-arm64 b/Dockerfile.linux-arm64 index 1301df0..16e98d0 100644 --- a/Dockerfile.linux-arm64 +++ b/Dockerfile.linux-arm64 @@ -2,44 +2,43 @@ ARG BUILDKIT_SBOM_SCAN_CONTEXT=true ARG BUILDKIT_SBOM_SCAN_STAGE=true -FROM ubuntu:22.04 - -LABEL name="Nagios" \ - nagiosVersion="4.5.1" \ - nagiosPluginsVersion="2.4.9" \ - nrpeVersion="4.1.0" \ - nscaVersion="2.10.2" \ - ncpaVersion="3.0.2" \ - nagiostvVersion="0.8.7" \ - homepage="https://www.nagios.com/" \ - maintainer="Tronyx " +FROM ubuntu:24.04 + +LABEL name="Nagios" +LABEL nagiosVersion="4.5.4" +LABEL nagiosPluginsVersion="2.4.11" +LABEL nrpeVersion="4.1.1" +LABEL nscaVersion="2.10.3" +LABEL ncpaVersion="3.1.0" +LABEL nagiostvVersion="0.9.2" +LABEL homepage="https://www.nagios.com/" +LABEL maintainer="Tronyx " # Environment variables -ENV NAGIOS_HOME=/opt/nagios \ - NAGIOS_USER=nagios \ - NAGIOS_GROUP=nagios \ - NAGIOS_CMDUSER=nagios \ - NAGIOS_CMDGROUP=nagios \ - NAGIOS_FQDN=nagios.example.com \ - NAGIOSADMIN_USER=nagiosadmin \ - NAGIOSADMIN_PASS=nagios \ - APACHE_RUN_USER=nagios \ - APACHE_RUN_GROUP=nagios \ - APACHE_LOCK_DIR=/var/run \ - APACHE_LOG_DIR=/var/log/apache2 \ - NAGIOS_TIMEZONE=UTC \ - DEBIAN_FRONTEND=noninteractive \ - NAGIOS_BRANCH=nagios-4.5.1 \ - NAGIOS_PLUGINS_BRANCH=release-2.4.9 \ - NRPE_BRANCH=nrpe-4.1.0 \ - NSCA_TAG=nsca-2.10.2 \ - NCPA_BRANCH=v3.0.2 \ - NAGIOSTV_VERSION=0.8.7 - -ENV NG_CGI_URL=/cgi-bin \ - NG_NAGIOS_CONFIG_FILE=${NAGIOS_HOME}/etc/nagios.cfg \ - NG_CGI_DIR=${NAGIOS_HOME}/sbin \ - NG_WWW_DIR=${NAGIOS_HOME}/share/nagiosgraph +ENV NAGIOS_HOME=/opt/nagios +ENV NAGIOS_USER=nagios +ENV NAGIOS_GROUP=nagios +ENV NAGIOS_CMDUSER=nagios +ENV NAGIOS_CMDGROUP=nagios +ENV NAGIOS_FQDN=nagios.example.com +ENV NAGIOSADMIN_USER=nagiosadmin +ENV NAGIOSADMIN_PASS=nagios +ENV APACHE_RUN_USER=nagios +ENV APACHE_RUN_GROUP=nagios +ENV APACHE_LOCK_DIR=/var/run +ENV APACHE_LOG_DIR=/var/log/apache2 +ENV NAGIOS_TIMEZONE=UTC +ENV DEBIAN_FRONTEND=noninteractive +ENV NG_CGI_URL=/cgi-bin +ENV NG_NAGIOS_CONFIG_FILE=${NAGIOS_HOME}/etc/nagios.cfg +ENV NG_CGI_DIR=${NAGIOS_HOME}/sbin +ENV NG_WWW_DIR=${NAGIOS_HOME}/share/nagiosgraph +ENV NAGIOS_BRANCH=nagios-4.5.4 +ENV NAGIOS_PLUGINS_BRANCH=release-2.4.11 +ENV NRPE_BRANCH=nrpe-4.1.1 +ENV NSCA_TAG=nsca-2.10.3 +ENV NCPA_BRANCH=v3.1.0 +ENV NAGIOSTV_VERSION=0.9.2 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 && \ @@ -56,6 +55,7 @@ RUN echo postfix postfix/main_mailer_type string "'Internet Site'" | debconf-set bsd-mailx \ build-essential \ ca-certificates \ + curl \ dnsutils \ fping \ freetds-dev \ @@ -69,6 +69,7 @@ RUN echo postfix postfix/main_mailer_type string "'Internet Site'" | debconf-set libcgi-pm-perl \ libcrypt-des-perl \ libcrypt-rijndael-perl \ + libcrypt-x509-perl \ libdbd-mysql-perl \ libdbd-pg-perl \ libdbi-dev \ @@ -81,30 +82,31 @@ RUN echo postfix postfix/main_mailer_type string "'Internet Site'" | debconf-set libgd-gd2-perl \ libjson-perl \ libldap2-dev \ - libmysqlclient-dev \ + libmariadb-dev \ libnagios-object-perl \ libmonitoring-plugin-perl \ libnet-snmp-perl \ libnet-tftp-perl \ libnet-xmpp-perl \ libpq-dev \ - libpython2-dev \ libpython3-dev \ libredis-perl \ librrds-perl \ libssl-dev \ libswitch-perl \ + libtext-glob-perl \ libwww-perl \ m4 \ - netcat \ + netcat-traditional \ openssh-client \ parallel \ php-cli \ php-gd \ postfix \ - python2 \ - python3-pip \ + python3-full \ python3-nagiosplugin \ + python3-pip \ + python3-venv \ rsync \ rsyslog \ runit \ @@ -223,13 +225,11 @@ RUN cd /tmp && \ # Install additional plugins RUN cd /opt && \ - wget -q -O get-pip.py https://bootstrap.pypa.io/pip/2.7/get-pip.py && \ - python2 get-pip.py && \ - echo "Cython==0.29.35" >> constraints.txt && \ - export PIP_CONSTRAINT="$(pwd)/constraints.txt" && \ - pip install --no-cache-dir "pymssql<2.2.0" && \ - pip3 install --no-cache-dir --find-links https://wheel-index.linuxserver.io/ubuntu/ pywbem paramiko pplogger paho-mqtt && \ - pip3 install --no-cache-dir --find-links https://wheel-index.linuxserver.io/ubuntu/ --upgrade requests && \ + #python3 -m venv .venv && \ + #. .venv/bin/activate && \ + pip3 install --break-system-packages --no-cache-dir pymssql && \ + pip3 install --break-system-packages --no-cache-dir --find-links https://wheel-index.linuxserver.io/ubuntu/ pywbem paramiko pplogger paho-mqtt && \ + pip3 install --break-system-packages --no-cache-dir --find-links https://wheel-index.linuxserver.io/ubuntu/ --upgrade requests && \ git clone https://github.com/willixix/naglio-plugins.git WL-Nagios-Plugins && \ git clone https://github.com/JasonRivers/nagios-plugins.git JR-Nagios-Plugins && \ git clone https://github.com/justintime/nagios-plugins.git JE-Nagios-Plugins && \ @@ -292,9 +292,13 @@ RUN echo "use_timezone=${NAGIOS_TIMEZONE}" >> ${NAGIOS_HOME}/etc/nagios.cfg # Copy example config in-case the user has started with empty var or etc RUN mkdir -p /orig/var && \ mkdir -p /orig/etc && \ + mkdir -p /orig/graph-etc && \ + mkdir -p /orig/graph-var && \ mkdir -p /orig/xinetd.d && \ cp -Rp ${NAGIOS_HOME}/var/* /orig/var/ && \ cp -Rp ${NAGIOS_HOME}/etc/* /orig/etc/ && \ + cp -Rp /opt/nagiosgraph/etc/* /orig/graph-etc && \ + cp -Rp /opt/nagiosgraph/var/* /orig/graph-var && \ cp -Rp /etc/xinetd.d/* /orig/xinetd.d/ ## Set the permissions for example config @@ -316,7 +320,7 @@ RUN cd /opt/nagiosgraph/etc && \ sh fix-nagiosgraph-multiple-selection.sh # Enable all runit services -RUN ln -s /etc/sv/* /etc/service +RUN ln -sf /etc/sv/* /etc/service # Fix ping permissions for Nagios user RUN chmod u+s /usr/bin/ping diff --git a/README.md b/README.md index 956bad3..48a39e3 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # Docker-Nagios -![GitHub Workflow Status](https://img.shields.io/github/actions/workflow/status/tronyx/Docker-Nagios/build.yml) [![CodeFactor](https://www.codefactor.io/repository/github/tronyx/docker-nagios/badge)](https://www.codefactor.io/repository/github/tronyx/docker-nagios) [![Docker Pulls](https://img.shields.io/docker/pulls/tronyx/nagios.svg)](https://hub.docker.com/r/tronyx/nagios) ![Docker Image Size with architecture (latest by date/latest semver)](https://img.shields.io/docker/image-size/tronyx/nagios?arch=amd64&label=amd64) ![Docker Image Size with architecture (latest by date/latest semver)](https://img.shields.io/docker/image-size/tronyx/nagios?arch=arm64&label=arm64) ![Docker Image Size with architecture (latest by date/latest semver)](https://img.shields.io/docker/image-size/tronyx/nagios?arch=arm&label=arm-v7) [![GitHub](https://img.shields.io/github/license/mashape/apistatus.svg)](https://github.com/tronyx/Docker-Nagios/blob/master/LICENSE.md) +![GitHub Workflow Status](https://img.shields.io/github/actions/workflow/status/tronyx/Docker-Nagios/build.yml) [![CodeFactor](https://www.codefactor.io/repository/github/tronyx/docker-nagios/badge)](https://www.codefactor.io/repository/github/tronyx/docker-nagios) [![Docker Pulls](https://img.shields.io/docker/pulls/tronyx/nagios.svg)](https://hub.docker.com/r/tronyx/nagios) ![Docker Image Size with architecture (latest by date/latest semver)](https://img.shields.io/docker/image-size/tronyx/nagios?arch=amd64&label=amd64) ![Docker Image Size with architecture (latest by date/latest semver)](https://img.shields.io/docker/image-size/tronyx/nagios?arch=arm64&label=arm64) [![GitHub](https://img.shields.io/github/license/mashape/apistatus.svg)](https://github.com/tronyx/Docker-Nagios/blob/master/LICENSE.md) ## Notes @@ -14,34 +14,35 @@ Fork of [JasonRivers Docker Nagios image](https://github.com/JasonRivers/Docker- * [#120](https://github.com/JasonRivers/Docker-Nagios/pull/120) - Add NSCA ([mmerian](https://github.com/mmerian)) * [#130](https://github.com/JasonRivers/Docker-Nagios/issues/130) - Add Perl encryption libraries ([rehashedsalt](https://github.com/rehashedsalt)) * [#132](https://github.com/JasonRivers/Docker-Nagios/issues/132) - Add rSync ([LutzLegu](https://github.com/LutzLegu)) +* [#165](https://github.com/JasonRivers/Docker-Nagios/pull/165) - Added libcrypt-x509-per and libtext-glob-perl modules ([Scott-Jones-COS](https://github.com/Scott-Jones-COS)) Listing these as I wish to give the original users credit for their work. ## Changes That I've Made -Things that I have changed/updated so far: +Things that I have changed/updated/added to date: -* Updated the image to Ubuntu 22.04 LTS +* Updated the image to Ubuntu 24.04 LTS * Updated Nagios Core to the current latest * Updated Nagios Plugins to current latest * Updated NRPE to current latest * Updated NCPA to current latest * Updated NSCA to current latest * Added NagiosTV -* Built multi-arch images +* Built multi-arch images (amd64 & arm64) ## Information -Nagios Core running on Ubuntu 22.04 LTS with NagiosGraph, NRPE, NCPA, NSCA, CheckMK, and NagiosTV. +Nagios Core running on Ubuntu 24.04 LTS with NagiosGraph, NRPE, NCPA, NSCA, and NagiosTV. | Product | Version | | ------- | ------- | -| [Nagios Core](https://github.com/NagiosEnterprises/nagioscore/releases) | 4.5.1 | -| [Nagios Plugins](https://github.com/nagios-plugins/nagios-plugins) | 2.4.9 | -| [NRPE](https://github.com/NagiosEnterprises/nrpe) | 4.1.0 | -| [NCPA](https://github.com/NagiosEnterprises/ncpa) | 3.0.2 | -| [NSCA](https://github.com/NagiosEnterprises/nsca) | 2.10.2 | -| [NagiosTV](https://github.com/chriscareycode/nagiostv-react) | 0.8.7 | +| [Nagios Core](https://github.com/NagiosEnterprises/nagioscore/releases) | 4.5.4 | +| [Nagios Plugins](https://github.com/nagios-plugins/nagios-plugins) | 2.4.11 | +| [NRPE](https://github.com/NagiosEnterprises/nrpe) | 4.1.1 | +| [NCPA](https://github.com/NagiosEnterprises/ncpa) | 3.1.0 | +| [NSCA](https://github.com/NagiosEnterprises/nsca) | 2.10.3 | +| [NagiosTV](https://github.com/chriscareycode/nagiostv-react) | 0.9.2 | You can find the Docker Hub Registry [HERE](https://hub.docker.com/r/tronyx/nagios) or the GitHub Registry [HERE](https://github.com/tronyx/Docker-Nagios/pkgs/container/nagios). @@ -58,6 +59,14 @@ docker pull tronyx/nagios docker pull ghcr.io/tronyx/nagios ``` +#### Versions/Docker Tags + +| Branch | Image Tag | Notes | +| ------- | ------- | ------- | +| Master | latest | Master branch that is known to be stable. | +| Develop | develop | My testing/development branch for updates. | +| Ubuntu-22.04 | ubuntu-22.04 | Older Ubuntu base version that still has Python 2 and the plugins that require it. Use this for arm-v7 hardware. Will keep this as up-to-date as possible. | + ### Running Run the container with the example configuration using the following `docker` commands: diff --git a/overlay/usr/local/bin/start_nagios b/overlay/usr/local/bin/start_nagios index a231be0..bf4da4e 100755 --- a/overlay/usr/local/bin/start_nagios +++ b/overlay/usr/local/bin/start_nagios @@ -14,6 +14,16 @@ if [ -z "$(ls -A /opt/nagios/var)" ]; then cp -Rp /orig/var/* /opt/nagios/var/ fi +if [ -z "$(ls -A /opt/nagiosgraph/etc)" ]; then + echo "Started with empty /opt/nagiosgraph/etc, copying example data in-place" + cp -Rp /orig/graph-etc/* /opt/nagiosgraph/etc/ +fi + +if [ -z "$(ls -A /opt/nagiosgraph/var)" ]; then + echo "Started with empty /opt/nagiosgraph/var, copying example data in-place" + cp -Rp /orig/graph-var/* /opt/nagiosgraph/var/ +fi + if [ -z "$(ls -A /etc/xinetd.d)" ]; then echo "Started with empty xinetd config, copying example data in-place" cp -Rp /orig/xinetd.d/* /etc/xinetd.d/