-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathDockerfile
48 lines (47 loc) · 2.41 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
FROM koyeung/nagios
MAINTAINER hyman/[email protected]
RUN apt-get update && \
apt-get install -y wget curl libdbd-pg-perl
RUN echo 'deb http://apt.postgresql.org/pub/repos/apt/ jessie-pgdg main' > /etc/apt/sources.list.d/pgdg.list && \
wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | apt-key add -
RUN apt-get update && \
apt-get install -y postgresql-9.5 postgresql-server-dev-9.5 && \
apt-get clean
ENV TZ Asia/Hong_Kong
RUN mkdir -p /usr/local/src/opm && \
cd /usr/local/src/opm && \
wget https://github.com/OPMDG/opmdg.github.io/releases/download/REL_2_3/OPM_2_3.zip && \
unzip OPM_2_3.zip && \
mv /usr/local/src/opm/opm-core-REL_2_3 /usr/local/src/opm/opm-core && \
mv /usr/local/src/opm/opm-wh_nagios-REL_2_3 /usr/local/src/opm/opm-wh_nagios && \
mv /usr/local/src/opm/check_pgactivity-REL1_13 /usr/local/src/opm/check_pgactivity && \
cd /usr/local/src/opm/opm-core/pg && \
make install && \
cd /usr/local/src/opm/opm-wh_nagios/pg && \
make install && \
rm /usr/local/src/opm/OPM_2_3.zip
RUN echo "* * * * * psql -c 'SELECT wh_nagios.dispatch_record()' opm" >> /var/spool/cron/crontabs/postgres && \
chown postgres:crontab /var/spool/cron/crontabs/postgres && \
chmod 600 /var/spool/cron/crontabs/postgres
COPY ./nagios_dispatcher.conf /usr/local/etc/nagios_dispatcher.conf
COPY ./opm.conf /usr/local/src/opm/opm-core/ui
RUN chown nagios /usr/local/etc/nagios_dispatcher.conf
RUN cp /usr/local/src/opm/opm-wh_nagios/bin/nagios_dispatcher.pl /usr/local/bin
RUN mkdir -p /var/lib/nagios3/spool/perfdata/ && \
chown nagios: /var/lib/nagios3/spool/perfdata/ && \
chown -R nagios: /var/lib/nagios3
RUN curl -L cpanmin.us | perl - [email protected] && \
curl -L cpanmin.us | perl - Mojolicious::Plugin::[email protected] && \
curl -L cpanmin.us | perl - DBI && \
curl -L cpanmin.us | perl - DBD::Pg
RUN apt-get -y install rsyslog && apt-get clean
RUN cd /usr/local/src/opm/opm-core/ui/modules && \
ln -s /usr/local/src/opm/opm-wh_nagios/ui wh_nagios
RUN mkdir /docker-entrypoint-initdb.d/
RUN cp /usr/local/src/opm/check_pgactivity/check_pgactivity /usr/local/nagios/libexec/check_pgactivity
COPY ./nagios/etc/ /usr/local/nagios/etc/
COPY ./entrypoint.sh /entrypoint.sh
COPY ./pg_hba.conf /etc/postgresql/9.5/main/pg_hba.conf
COPY ./docker-entrypoint-initdb.d/ /docker-entrypoint-initdb.d/
ENTRYPOINT ["/entrypoint.sh"]
EXPOSE 80 3000 5432