-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
53 lines (46 loc) · 2.05 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
FROM jasonrivers/nagios:latest
ENV LIVESTATUS 1.4.0p38
ENV WMIC 1.3.14-3
ENV WMIPLUS 1.64
RUN apt-get update && apt-get install -y \
mc sudo \
libnumber-format-perl libconfig-inifiles-perl libdatetime-perl \
graphviz \
librrd-dev \
libboost-all-dev && \
apt-get clean && rm -Rf /var/lib/apt/lists/*
# MK live status
COPY src/mk-livestatus-${LIVESTATUS}.tar.gz /tmp/mk-livestatus.tar.gz
RUN cd /tmp && \
tar zxf mk-livestatus.tar.gz && \
rm -f mk-livestatus.tar.gz && \
mv mk-livestatus* mk-livestatus && \
cd mk-livestatus && \
./configure --with-nagios4 && \
make && \
make install && \
rm -rf /tmp/mk-livestatus
# edit nagios.cfg
RUN sed -i 's!#broker_module=/somewhere/module1.o!broker_module=/usr/local/lib/mk-livestatus/livestatus.o /opt/nagios/var/rw/live debug=0!' /opt/nagios/etc/nagios.cfg
# WMIC
COPY src/wmi-client_${WMIC}_amd64.deb /tmp/wmic.deb
RUN cd /tmp && \
dpkg -x wmic.deb wmic && \
cp wmic/usr/bin/wmic /usr/local/bin && \
rm -rf wmic*
# POSTFIX set mail from
RUN echo "sender_canonical_maps = hash:/etc/postfix/canonical" >> /etc/postfix/main.cf && \
sed -i '3iif ! [ "${MAIL_FROM}" = "" ]; then\necho "root ${MAIL_FROM}" > /etc/postfix/canonical\n/usr/sbin/postmap hash:/etc/postfix/canonical\nfi' /etc/sv/postfix/run
### CHEK_WMI_PLUS
# copy to dest
COPY src/check_wmi_plus.v${WMIPLUS}.tar.gz /opt/Check_WMI_Plus/check_wmi_plus.v${WMIPLUS}.tar.gz
# install and config
RUN cd /opt/Check_WMI_Plus && \
tar zxvf check_wmi_plus.v${WMIPLUS}.tar.gz && \
rm check_wmi_plus.v${WMIPLUS}.tar.gz && \
cd /opt/Check_WMI_Plus/etc/check_wmi_plus && \
cp check_wmi_plus.conf.sample check_wmi_plus.conf && \
sed -i "s/^\$base_dir.*/\$base_dir=\'\/opt\/Check_WMI_Plus\';/" check_wmi_plus.conf && \
sed -i "s/^\$wmic_command.*/\$wmic_command=\"\/usr\/local\/bin\/wmic\";/" check_wmi_plus.conf && \
cd /opt/Check_WMI_Plus && \
sed -i "s/^my \$conf_file.*$/my \$conf_file=\'\/opt\/Check_WMI_Plus\/etc\/check_wmi_plus\/check_wmi_plus.conf\';/" check_wmi_plus.pl