-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
106 lines (97 loc) · 5.82 KB
/
Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
FROM quay.io/fedora/fedora-minimal:41
ARG NAGIOS_VERSION="4.5.9"
ARG NAGIOS_PLUGINS_VERSION="2.4.12"
ARG NAGIOS_THEMES_VERSION="0.2.0"
ARG NCPA_VERSION="3.1.2"
ARG NRPE_VERSION="4.1.3"
ARG NSCA_VERSION="2.10.3"
ARG MONGOSH_VERSION="2.3.8"
ARG CHECK_MONGODB_PLUGINS_VERSION="1.0.0"
ARG NAGIOSTV_VERSION="0.9.2"
ARG S6_OVERLAY_VERSION="3.2.0.2"
ENV MAIL_ADDRESS="" \
MAIL_PASS="" \
MAIL_RELAY_HOST="[smtp.gmail.com]:587" \
MONGOSH_DISABLE_TELEMETRY=false \
NAGIOS_FQDN="nagios.example.com" \
NAGIOSADMIN_USER="nagiosadmin" \
NAGIOSADMIN_PASS="nagios" \
NAGIOS_STARTPAGE="default" \
NAGIOS_THEME="default"
ADD https://github.com/just-containers/s6-overlay/releases/download/v${S6_OVERLAY_VERSION}/s6-overlay-noarch.tar.xz /tmp
ADD https://github.com/just-containers/s6-overlay/releases/download/v${S6_OVERLAY_VERSION}/s6-overlay-noarch.tar.xz.sha256 /tmp
ADD https://github.com/just-containers/s6-overlay/releases/download/v${S6_OVERLAY_VERSION}/s6-overlay-x86_64.tar.xz /tmp
ADD https://github.com/just-containers/s6-overlay/releases/download/v${S6_OVERLAY_VERSION}/s6-overlay-x86_64.tar.xz.sha256 /tmp
ADD https://github.com/mongodb-js/mongosh/releases/download/v${MONGOSH_VERSION}/mongosh-${MONGOSH_VERSION}-linux-x64-openssl3.tgz /tmp
ADD https://github.com/NagiosEnterprises/nagioscore/releases/download/nagios-${NAGIOS_VERSION}/nagios-${NAGIOS_VERSION}.tar.gz /tmp
ADD https://github.com/nagios-plugins/nagios-plugins/releases/download/release-${NAGIOS_PLUGINS_VERSION}/nagios-plugins-${NAGIOS_PLUGINS_VERSION}.tar.gz /tmp
ADD https://github.com/NagiosEnterprises/nrpe/releases/download/nrpe-${NRPE_VERSION}/nrpe-${NRPE_VERSION}.tar.gz /tmp
ADD https://github.com/NagiosEnterprises/nsca/releases/download/nsca-${NSCA_VERSION}/nsca-${NSCA_VERSION}.tar.gz /tmp
ADD https://github.com/chriscareycode/nagiostv-react/releases/download/v${NAGIOSTV_VERSION}/nagiostv-${NAGIOSTV_VERSION}.tar.gz /tmp
ADD https://github.com/arajczy/nagios-themes/archive/refs/tags/nagios-themes-v${NAGIOS_THEMES_VERSION}.tar.gz /tmp
RUN dnf -y --refresh upgrade && \
dnf -y --setopt install_weak_deps=False install \
automake bc cyrus-sasl-plain fcgiwrap fping gcc gcc-c++ gd gd-devel gzip httpd-tools iputils kernel-devel libdbi-devel libpq-devel lm_sensors mailx make mariadb-devel nc net-snmp net-snmp-utils nginx openssl openssl-devel-engine perl-bignum perl-FindBin perl-lib perl-Net-SNMP php php-fpm postfix python python-nagiosplugin python-toml shadow-utils samba-client tar unzip xz && \
# adjust ping permissions \
chmod 4755 /usr/bin/ping && \
# Add nagios user \
groupadd -g 1001 nagios && useradd -u 1001 -d /usr/local/nagios -g nagios nagios && \
usermod -aG nagios nginx && \
# configure snmp \
echo mibs +ALL > /etc/snmp/snmp.conf && \
# install s6-overlay \
cd /tmp && sha256sum -c *.sha256 && \
tar -C / -Jxpf /tmp/s6-overlay-noarch.tar.xz && \
tar -C / -Jxpf /tmp/s6-overlay-x86_64.tar.xz && \
# install mongosh \
tar -C /tmp -zxf /tmp/mongosh-${MONGOSH_VERSION}-linux-x64-openssl3.tgz && \
mv /tmp/mongosh-${MONGOSH_VERSION}-linux-x64-openssl3/bin/mongosh /usr/bin && \
mv /tmp/mongosh-${MONGOSH_VERSION}-linux-x64-openssl3/bin/mongosh_crypt_v1.so /usr/lib && \
# install nagios \
tar -C /tmp -zxf /tmp/nagios-${NAGIOS_VERSION}.tar.gz && cd /tmp/nagios-${NAGIOS_VERSION} && \
./configure && \
make all && make install && make install-commandmode && make install-config && make clean && \
# install nagios-plugins \
tar -C /tmp -zxf /tmp/nagios-plugins-${NAGIOS_PLUGINS_VERSION}.tar.gz && \
cd /tmp/nagios-plugins-${NAGIOS_PLUGINS_VERSION} && \
./configure \
--with-nagios-user=nagios \
--with-nagios-group=nagios && \
# patch nagios-plugins \
sed -i s/PS_COMMAND/PING_COMMAND/ plugins/check_load.c && \
make && make install && make clean && \
# install NRPE \
tar -C /tmp -zxf /tmp/nrpe-${NRPE_VERSION}.tar.gz && \
cd /tmp/nrpe-${NRPE_VERSION} && \
./configure --enable-command-args && \
make check_nrpe && cp src/check_nrpe /usr/local/nagios/libexec/ && make clean && \
# install NSCA \
tar -C /tmp -zxf /tmp/nsca-${NSCA_VERSION}.tar.gz && \
cd /tmp/nsca-${NSCA_VERSION} && \
./configure \
--with-nsca-user=nagios \
--with-nsca-grp=nagios && \
make all && \
cp src/nsca /usr/local/nagios/bin/ && cp src/send_nsca /usr/local/nagios/bin/ && \
cp sample-config/nsca.cfg /usr/local/nagios/etc/ && cp sample-config/send_nsca.cfg /usr/local/nagios/etc/ && \
# copy default config to /usr/local/nagios/defaults \
cp -R /usr/local/nagios/etc /usr/local/nagios/defaults && \
# install NAGIOSTV \
tar -C /usr/local/nagios/share -zxf /tmp/nagiostv-$NAGIOSTV_VERSION.tar.gz && \
tar -C /usr/local/nagios/ -zxpf /tmp/nagios-themes-v${NAGIOS_THEMES_VERSION}.tar.gz \
--strip-components=1 \
--exclude=README.md && \
# cleanup \
dnf -y remove automake gcc gcc-c++ gd-devel kernel-devel make openssl-devel-engine shadow-utils tar unzip xz && \
dnf -y autoremove && dnf -y clean all && rm -rf /tmp/*
# Install NCPA
ADD --chmod=0755 https://raw.githubusercontent.com/NagiosEnterprises/ncpa/v${NCPA_VERSION}/client/check_ncpa.py /usr/local/nagios/libexec/
# Install check-mongodb-plugins
ADD --chmod=0755 https://raw.githubusercontent.com/m-erhardt/check-mongodb-plugins/v${CHECK_MONGODB_PLUGINS_VERSION}/check_mongodb_stats.py /usr/local/nagios/libexec/
ADD --chmod=0755 https://raw.githubusercontent.com/m-erhardt/check-mongodb-plugins/v${CHECK_MONGODB_PLUGINS_VERSION}/check_mongodb_dbsize.py /usr/local/nagios/libexec/
# Install check_snmp_int plugin
ADD --chmod=0755 https://raw.githubusercontent.com/SteScho/manubulon-snmp/master/plugins/check_snmp_int.pl /usr/local/nagios/libexec/
COPY root /
VOLUME /usr/local/nagios/etc /usr/local/nagios/themes /usr/local/nagios/var
EXPOSE 80
ENTRYPOINT [ "/init" ]