[nagios] Build Jammy-based image
+ unify Dockerfiles for different Ubuntu versions + switch plugins to use Python 3, as it is the only supported version starting from Ubuntu Focal Change-Id: I0e66ed0c96ed72c8202940e8a97db17d932a5e47
This commit is contained in:
79
nagios/Dockerfile.ubuntu
Normal file
79
nagios/Dockerfile.ubuntu
Normal file
@@ -0,0 +1,79 @@
|
|||||||
|
ARG FROM=docker.io/ubuntu:jammy
|
||||||
|
FROM ${FROM}
|
||||||
|
|
||||||
|
ENV DEBIAN_FRONTEND=noninteractive
|
||||||
|
ENV APACHE_FRONTEND_PORT 8000
|
||||||
|
ENV APACHE_FRONTEND_SECURE_PORT 8443
|
||||||
|
ENV KUBE_VERSION=1.29.5
|
||||||
|
ENV ES_DSL_VERSION=8.13.1
|
||||||
|
ENV ES_VERSION=8.13.2
|
||||||
|
|
||||||
|
ENV NAGIOSADMIN_EMAIL nagios@localhost
|
||||||
|
ENV NAGIOS_HOME /opt/nagios
|
||||||
|
ENV NAGIOS_PLUGIN_DIR /usr/lib/nagios/plugins
|
||||||
|
ENV VERSION=4.5.0
|
||||||
|
|
||||||
|
RUN set -ex \
|
||||||
|
&& apt-get update \
|
||||||
|
&& apt-get upgrade -y \
|
||||||
|
&& apt-get install -y --install-recommends \
|
||||||
|
jq \
|
||||||
|
curl \
|
||||||
|
snmp \
|
||||||
|
snmpd \
|
||||||
|
unzip \
|
||||||
|
apache2 \
|
||||||
|
libssl-dev \
|
||||||
|
checkinstall \
|
||||||
|
libapache2-mod-php \
|
||||||
|
snmp-mibs-downloader \
|
||||||
|
&& apt-get install -y --no-install-recommends \
|
||||||
|
python3-pip \
|
||||||
|
python3-requests \
|
||||||
|
monitoring-plugins \
|
||||||
|
&& pip3 install --upgrade --no-cache-dir pip \
|
||||||
|
&& pip3 install --upgrade --no-cache-dir \
|
||||||
|
requests \
|
||||||
|
setuptools \
|
||||||
|
kubernetes \
|
||||||
|
elasticsearch==${ES_VERSION} \
|
||||||
|
elasticsearch-dsl==${ES_DSL_VERSION} \
|
||||||
|
&& curl --silent -L https://dl.k8s.io/v${KUBE_VERSION}/kubernetes-client-linux-amd64.tar.gz \
|
||||||
|
| tar -zC /usr/bin --strip-components=3 --wildcards -x "*/*/*/kubectl" \
|
||||||
|
&& apt-get clean && rm -rf /var/lib/apt/lists/*
|
||||||
|
|
||||||
|
RUN groupadd -g 3000 nagios \
|
||||||
|
&& useradd -u 3000 -g nagios -d ${NAGIOS_HOME} -s /bin/bash -c 'Nagios Admin' nagios \
|
||||||
|
&& adduser www-data nagios
|
||||||
|
|
||||||
|
RUN set -ex \
|
||||||
|
&& cd ${TMP_DIR} \
|
||||||
|
&& curl --silent -L https://assets.nagios.com/downloads/nagioscore/releases/nagios-${VERSION}.tar.gz \
|
||||||
|
| tar -zx --strip-components=1 \
|
||||||
|
&& ./configure --prefix=${NAGIOS_HOME} \
|
||||||
|
--with-nagios-user=nagios \
|
||||||
|
--with-nagios-group=nagios \
|
||||||
|
--with-command-user=nagios \
|
||||||
|
--with-command-group=nagios \
|
||||||
|
--with-lockfile=/var/run/nagios.lock \
|
||||||
|
&& make all \
|
||||||
|
&& make install \
|
||||||
|
&& make install-init \
|
||||||
|
&& make install-config \
|
||||||
|
&& make install-commandmode \
|
||||||
|
&& make install-webconf \
|
||||||
|
&& rm -rf ${TMP_DIR}
|
||||||
|
|
||||||
|
COPY apache2/sites-available/* /etc/apache2/sites-available/
|
||||||
|
COPY apache2/ports.conf /etc/apache2/
|
||||||
|
|
||||||
|
RUN a2ensite nagios && a2enmod cgi && a2dissite 000-default
|
||||||
|
|
||||||
|
COPY scripts/entrypoint.sh /entrypoint.sh
|
||||||
|
COPY plugins/* ${NAGIOS_PLUGIN_DIR}/
|
||||||
|
COPY scripts/snmp-mibs/* /usr/share/snmp/mibs/
|
||||||
|
|
||||||
|
EXPOSE ${APACHE_FRONTEND_PORT}/tcp
|
||||||
|
EXPOSE ${APACHE_FRONTEND_SECURE_PORT}/tcp
|
||||||
|
|
||||||
|
ENTRYPOINT ["/entrypoint.sh"]
|
@@ -1,71 +0,0 @@
|
|||||||
ARG FROM=docker.io/ubuntu:bionic
|
|
||||||
FROM ${FROM}
|
|
||||||
|
|
||||||
ENV DEBIAN_FRONTEND=noninteractive
|
|
||||||
ENV APACHE_FRONTEND_PORT 8000
|
|
||||||
ENV APACHE_FRONTEND_SECURE_PORT 8443
|
|
||||||
ENV ES_DSL_VERSION=5.4.0
|
|
||||||
ENV ES_VERSION=5.5.3
|
|
||||||
ENV KUBE_VERSION=1.16.2
|
|
||||||
ENV NAGIOSADMIN_EMAIL nagios@localhost
|
|
||||||
ENV NAGIOS_HOME /opt/nagios
|
|
||||||
ENV NAGIOS_PLUGIN_DIR /usr/lib/nagios/plugins
|
|
||||||
ENV VERSION=4.4.3
|
|
||||||
|
|
||||||
RUN apt-get -o Acquire::ForceIPv4=true -y update \
|
|
||||||
&& apt-get -y install curl apache2 checkinstall unzip libapache2-mod-php snmp snmpd snmp-mibs-downloader jq python3-requests \
|
|
||||||
&& apt-get -y install --no-install-recommends monitoring-plugins python3-pip \
|
|
||||||
&& apt-get clean \
|
|
||||||
&& rm -rf /var/lib/apt/lists/*
|
|
||||||
|
|
||||||
RUN rm -f /usr/bin/python
|
|
||||||
RUN ln -s /usr/bin/python3 /usr/bin/python
|
|
||||||
|
|
||||||
RUN pip3 install --upgrade pip \
|
|
||||||
&& hash -r \
|
|
||||||
&& pip3 --no-cache-dir install --upgrade setuptools \
|
|
||||||
&& pip3 --no-cache-dir install --upgrade kubernetes==22.6.0 \
|
|
||||||
&& pip3 --no-cache-dir install --upgrade elasticsearch==${ES_VERSION} \
|
|
||||||
&& pip3 --no-cache-dir install --upgrade elasticsearch-dsl==${ES_DSL_VERSION} \
|
|
||||||
&& pip3 install requests -U
|
|
||||||
|
|
||||||
RUN groupadd -g 3000 nagios
|
|
||||||
RUN useradd -u 3000 -g nagios -d ${NAGIOS_HOME} -s /bin/bash -c 'Nagios Admin' nagios
|
|
||||||
RUN adduser www-data nagios
|
|
||||||
|
|
||||||
RUN TMP_DIR=$(mktemp --directory) ;\
|
|
||||||
cd ${TMP_DIR} ;\
|
|
||||||
curl -sSL https://dl.k8s.io/v${KUBE_VERSION}/kubernetes-client-linux-amd64.tar.gz | tar -zxv --strip-components=1 ;\
|
|
||||||
mv ${TMP_DIR}/client/bin/kubectl /usr/local/bin/kubectl ;\
|
|
||||||
chmod +x /usr/local/bin/kubectl
|
|
||||||
|
|
||||||
ADD https://assets.nagios.com/downloads/nagioscore/releases/nagios-${VERSION}.tar.gz ${TMP_DIR}/
|
|
||||||
RUN cd ${TMP_DIR} && \
|
|
||||||
tar zxf ${TMP_DIR}/nagios-${VERSION}.tar.gz && \
|
|
||||||
cd nagios-${VERSION} && \
|
|
||||||
./configure --with-lockfile=/var/run/nagios.lock --prefix=${NAGIOS_HOME} --with-nagios-user=nagios --with-nagios-group=nagios --with-command-user=nagios --with-command-group=nagios && \
|
|
||||||
make all && \
|
|
||||||
make install && \
|
|
||||||
make install-init && \
|
|
||||||
make install-config && \
|
|
||||||
make install-commandmode && \
|
|
||||||
make install-webconf && \
|
|
||||||
cd ${TMP_DIR} && \
|
|
||||||
rm -rf nagios-* && \
|
|
||||||
rm -rf ${TMP_DIR}
|
|
||||||
|
|
||||||
COPY apache2/sites-available/* /etc/apache2/sites-available/
|
|
||||||
COPY apache2/ports.conf /etc/apache2/
|
|
||||||
|
|
||||||
RUN a2ensite nagios && \
|
|
||||||
a2enmod cgi && \
|
|
||||||
a2dissite 000-default
|
|
||||||
|
|
||||||
COPY scripts/entrypoint.sh /entrypoint.sh
|
|
||||||
COPY plugins/* ${NAGIOS_PLUGIN_DIR}/
|
|
||||||
COPY scripts/snmp-mibs/* /usr/share/snmp/mibs/
|
|
||||||
|
|
||||||
EXPOSE ${APACHE_FRONTEND_PORT}/tcp
|
|
||||||
EXPOSE ${APACHE_FRONTEND_SECURE_PORT}/tcp
|
|
||||||
|
|
||||||
ENTRYPOINT ["/entrypoint.sh"]
|
|
@@ -1,66 +0,0 @@
|
|||||||
ARG FROM=docker.io/ubuntu:focal
|
|
||||||
FROM ${FROM}
|
|
||||||
|
|
||||||
ENV DEBIAN_FRONTEND=noninteractive
|
|
||||||
ENV APACHE_FRONTEND_PORT 8000
|
|
||||||
ENV APACHE_FRONTEND_SECURE_PORT 8443
|
|
||||||
ENV ES_DSL_VERSION=7.4.0
|
|
||||||
ENV ES_VERSION=7.17.8
|
|
||||||
ENV KUBE_VERSION=1.24.6
|
|
||||||
|
|
||||||
ENV NAGIOSADMIN_EMAIL nagios@localhost
|
|
||||||
ENV NAGIOS_HOME /opt/nagios
|
|
||||||
ENV NAGIOS_PLUGIN_DIR /usr/lib/nagios/plugins
|
|
||||||
ENV VERSION=4.4.9
|
|
||||||
|
|
||||||
RUN apt-get -o Acquire::ForceIPv4=true -y update && apt-get -y upgrade && \
|
|
||||||
apt-get -y install curl apache2 checkinstall unzip libapache2-mod-php snmp snmpd snmp-mibs-downloader jq python3-requests libssl-dev && \
|
|
||||||
apt-get -y install --no-install-recommends monitoring-plugins python3-pip && \
|
|
||||||
apt-get clean && rm -rf /var/lib/apt/lists/*
|
|
||||||
|
|
||||||
RUN rm -f /usr/bin/python && ln -s /usr/bin/python3 /usr/bin/python
|
|
||||||
|
|
||||||
RUN pip3 install --upgrade pip && \
|
|
||||||
hash -r && \
|
|
||||||
pip3 --no-cache-dir install --upgrade setuptools && \
|
|
||||||
pip3 --no-cache-dir install --upgrade kubernetes && \
|
|
||||||
pip3 --no-cache-dir install --upgrade elasticsearch==${ES_VERSION} && \
|
|
||||||
pip3 --no-cache-dir install --upgrade elasticsearch-dsl==${ES_DSL_VERSION} && \
|
|
||||||
pip3 install requests -U
|
|
||||||
|
|
||||||
RUN groupadd -g 3000 nagios
|
|
||||||
RUN useradd -u 3000 -g nagios -d ${NAGIOS_HOME} -s /bin/bash -c 'Nagios Admin' nagios
|
|
||||||
RUN adduser www-data nagios
|
|
||||||
|
|
||||||
RUN TMP_DIR=$(mktemp --directory) && \
|
|
||||||
cd ${TMP_DIR} && \
|
|
||||||
curl -sSL https://dl.k8s.io/v${KUBE_VERSION}/kubernetes-client-linux-amd64.tar.gz | tar -zxv --strip-components=1 && \
|
|
||||||
mv ${TMP_DIR}/client/bin/kubectl /usr/local/bin/kubectl && \
|
|
||||||
chmod +x /usr/local/bin/kubectl
|
|
||||||
|
|
||||||
ADD https://assets.nagios.com/downloads/nagioscore/releases/nagios-${VERSION}.tar.gz ${TMP_DIR}/
|
|
||||||
RUN cd ${TMP_DIR} && \
|
|
||||||
tar zxf ${TMP_DIR}/nagios-${VERSION}.tar.gz && \
|
|
||||||
cd nagios-${VERSION} && \
|
|
||||||
./configure --with-lockfile=/var/run/nagios.lock --prefix=${NAGIOS_HOME} --with-nagios-user=nagios --with-nagios-group=nagios --with-command-user=nagios --with-command-group=nagios && \
|
|
||||||
make all && \
|
|
||||||
make install && \
|
|
||||||
make install-init && \
|
|
||||||
make install-config && \
|
|
||||||
make install-commandmode && \
|
|
||||||
make install-webconf && \
|
|
||||||
cd ${TMP_DIR} && rm -rf nagios-* && rm -rf ${TMP_DIR}
|
|
||||||
|
|
||||||
COPY apache2/sites-available/* /etc/apache2/sites-available/
|
|
||||||
COPY apache2/ports.conf /etc/apache2/
|
|
||||||
|
|
||||||
RUN a2ensite nagios && a2enmod cgi && a2dissite 000-default
|
|
||||||
|
|
||||||
COPY scripts/entrypoint.sh /entrypoint.sh
|
|
||||||
COPY plugins/* ${NAGIOS_PLUGIN_DIR}/
|
|
||||||
COPY scripts/snmp-mibs/* /usr/share/snmp/mibs/
|
|
||||||
|
|
||||||
EXPOSE ${APACHE_FRONTEND_PORT}/tcp
|
|
||||||
EXPOSE ${APACHE_FRONTEND_SECURE_PORT}/tcp
|
|
||||||
|
|
||||||
ENTRYPOINT ["/entrypoint.sh"]
|
|
@@ -6,9 +6,10 @@ cd ${SCRIPT_DIR}/..
|
|||||||
|
|
||||||
IMAGE="nagios"
|
IMAGE="nagios"
|
||||||
VERSION=${VERSION:-latest}
|
VERSION=${VERSION:-latest}
|
||||||
DISTRO=${DISTRO:-ubuntu_focal}
|
DISTRO=${DISTRO:-ubuntu}
|
||||||
|
DISTRO_VERSION=${DISTRO_VERSION:-focal}
|
||||||
REGISTRY_URI=${REGISTRY_URI:-"openstackhelm/"}
|
REGISTRY_URI=${REGISTRY_URI:-"openstackhelm/"}
|
||||||
EXTRA_TAG_INFO=${EXTRA_TAG_INFO:-""}
|
EXTRA_TAG_INFO=${EXTRA_TAG_INFO:-""}
|
||||||
docker build -f ${IMAGE}/Dockerfile.${DISTRO} --network=host -t ${REGISTRY_URI}${IMAGE}:${VERSION}-${DISTRO}${EXTRA_TAG_INFO} ${extra_build_args} ${IMAGE}
|
docker build -f ${IMAGE}/Dockerfile.${DISTRO} --network=host --build-arg="FROM=${DISTRO}:${DISTRO_VERSION}" -t ${REGISTRY_URI}${IMAGE}:${VERSION}-${DISTRO}${EXTRA_TAG_INFO} ${extra_build_args} ${IMAGE}
|
||||||
|
|
||||||
cd -
|
cd -
|
||||||
|
@@ -1,4 +1,4 @@
|
|||||||
#!/usr/bin/env python
|
#!/usr/bin/env python3
|
||||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
# you may not use this file except in compliance with the License.
|
# you may not use this file except in compliance with the License.
|
||||||
# You may obtain a copy of the License at
|
# You may obtain a copy of the License at
|
||||||
|
@@ -1,4 +1,4 @@
|
|||||||
#!/usr/bin/env python
|
#!/usr/bin/env python3
|
||||||
# -*- encoding: utf-8 -*-
|
# -*- encoding: utf-8 -*-
|
||||||
#
|
#
|
||||||
# REST API monitoring script for Nagios
|
# REST API monitoring script for Nagios
|
||||||
|
@@ -1,4 +1,4 @@
|
|||||||
#!/usr/bin/env python
|
#!/usr/bin/env python3
|
||||||
import argparse
|
import argparse
|
||||||
import sys
|
import sys
|
||||||
import requests
|
import requests
|
||||||
|
@@ -1,4 +1,4 @@
|
|||||||
#!/usr/bin/env python
|
#!/usr/bin/env python3
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
#
|
#
|
||||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
@@ -1,4 +1,4 @@
|
|||||||
#!/usr/bin/env python
|
#!/usr/bin/env python3
|
||||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
# you may not use this file except in compliance with the License.
|
# you may not use this file except in compliance with the License.
|
||||||
# You may obtain a copy of the License at
|
# You may obtain a copy of the License at
|
||||||
|
@@ -1,4 +1,4 @@
|
|||||||
#!/usr/bin/env python
|
#!/usr/bin/env python3
|
||||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
# you may not use this file except in compliance with the License.
|
# you may not use this file except in compliance with the License.
|
||||||
# You may obtain a copy of the License at
|
# You may obtain a copy of the License at
|
||||||
|
@@ -37,16 +37,20 @@
|
|||||||
docker_images:
|
docker_images:
|
||||||
- context: nagios
|
- context: nagios
|
||||||
repository: openstackhelm/nagios
|
repository: openstackhelm/nagios
|
||||||
dockerfile: Dockerfile.ubuntu_bionic
|
dockerfile: Dockerfile.ubuntu
|
||||||
tags:
|
build_args:
|
||||||
- latest-ubuntu_bionic
|
- "FROM=docker.io/ubuntu:focal"
|
||||||
- "ubuntu_bionic-{{ currentdate }}"
|
|
||||||
- context: nagios
|
|
||||||
repository: openstackhelm/nagios
|
|
||||||
dockerfile: Dockerfile.ubuntu_focal
|
|
||||||
tags:
|
tags:
|
||||||
- latest-ubuntu_focal
|
- latest-ubuntu_focal
|
||||||
- "ubuntu_focal-{{ currentdate }}"
|
- "ubuntu_focal-{{ currentdate }}"
|
||||||
|
- context: nagios
|
||||||
|
repository: openstackhelm/nagios
|
||||||
|
dockerfile: Dockerfile.ubuntu
|
||||||
|
build_args:
|
||||||
|
- "FROM=docker.io/ubuntu:jammy"
|
||||||
|
tags:
|
||||||
|
- latest-ubuntu_jammy
|
||||||
|
- "ubuntu_jammy-{{ currentdate }}"
|
||||||
files: &nagios_files
|
files: &nagios_files
|
||||||
- nagios/.*
|
- nagios/.*
|
||||||
- zuul.d/nagios.yaml
|
- zuul.d/nagios.yaml
|
||||||
|
Reference in New Issue
Block a user