forked from jjethwa/icinga2
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
106 lines (96 loc) · 4.07 KB
/
Dockerfile
File metadata and controls
106 lines (96 loc) · 4.07 KB
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
# Dockerfile for icinga2 with icingaweb2
# https://github.com/jjethwa/icinga2
FROM debian:stretch
MAINTAINER Jordan Jethwa
ENV APACHE2_HTTP=REDIRECT \
ICINGA2_FEATURE_GRAPHITE=false \
ICINGA2_FEATURE_GRAPHITE_HOST=graphite \
ICINGA2_FEATURE_GRAPHITE_PORT=2003 \
ICINGA2_FEATURE_GRAPHITE_URL=http://graphite \
ICINGA2_USER_FULLNAME="Icinga2" \
ICINGA2_FEATURE_DIRECTOR="true" \
ICINGA2_FEATURE_DIRECTOR_KICKSTART="true" \
ICINGA2_FEATURE_DIRECTOR_USER="icinga2-director"
RUN export DEBIAN_FRONTEND=noninteractive \
&& apt-get update \
&& apt-get upgrade -y \
&& apt-get install -y --no-install-recommends \
apache2 \
ca-certificates \
curl \
gnupg \
lsb-release \
mailutils \
mariadb-client \
mariadb-server \
php-curl \
php-ldap \
php-mysql \
procps \
pwgen \
snmp \
ssmtp \
sudo \
supervisor \
unzip \
wget \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*
RUN export DEBIAN_FRONTEND=noninteractive \
&& curl -s https://packages.icinga.com/icinga.key \
| apt-key add - \
&& echo "deb http://packages.icinga.org/debian icinga-$(lsb_release -cs) main" > /etc/apt/sources.list.d/icinga2.list \
&& export DEBIAN_FRONTEND=noninteractive \
&& apt-get update \
&& apt-get install -y --no-install-recommends \
icinga2 \
icinga2-ido-mysql \
icingacli \
icingaweb2 \
monitoring-plugins \
nagios-nrpe-plugin \
nagios-snmp-plugins \
nagios-plugins-contrib \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*
ADD content/ /
ARG GITREF_ICINGAWEB2=master
ARG GITREF_DIRECTOR=master
ARG GITREF_MODGRAPHITE=master
ARG GITREF_MODAWS=master
# Temporary hack to get icingaweb2 modules via git
RUN mkdir -p /usr/local/share/icingaweb2/modules/ \
&& wget -q --no-cookies -O - "https://github.com/Icinga/icingaweb2/archive/${GITREF_ICINGAWEB2}.tar.gz" \
| tar xz --strip-components=2 --directory=/usr/local/share/icingaweb2/modules -f - icingaweb2-${GITREF_ICINGAWEB2}/modules/monitoring icingaweb2-${GITREF_ICINGAWEB2}/modules/doc \
# Icinga Director
&& mkdir -p /usr/local/share/icingaweb2/modules/director/ \
&& wget -q --no-cookies -O - "https://github.com/Icinga/icingaweb2-module-director/archive/${GITREF_DIRECTOR}.tar.gz" \
| tar xz --strip-components=1 --directory=/usr/local/share/icingaweb2/modules/director --exclude=.gitignore -f - \
&& icingacli module enable director \
# Icingaweb2 Graphite
&& mkdir -p /usr/local/share/icingaweb2/modules/graphite \
&& wget -q --no-cookies -O - "https://github.com/Icinga/icingaweb2-module-graphite/archive/${GITREF_MODGRAPHITE}.tar.gz" \
| tar xz --strip-components=1 --directory=/usr/local/share/icingaweb2/modules/graphite -f - icingaweb2-module-graphite-${GITREF_MODGRAPHITE}/ \
&& cp -r /usr/local/share/icingaweb2/modules/graphite/templates /etc/icingaweb2/modules/graphite/ \
# Icingaweb2 AWS
&& mkdir -p /usr/local/share/icingaweb2/modules/aws \
&& wget -q --no-cookies -O - "https://github.com/Icinga/icingaweb2-module-aws/archive/${GITREF_MODAWS}.tar.gz" \
| tar xz --strip-components=1 --directory=/usr/local/share/icingaweb2/modules/aws -f - icingaweb2-module-aws-${GITREF_MODAWS}/ \
&& wget -q --no-cookies "https://github.com/aws/aws-sdk-php/releases/download/2.8.30/aws.zip" \
&& unzip -d /usr/local/share/icingaweb2/modules/aws/library/vendor/aws aws.zip \
&& rm aws.zip \
# Final fixes
&& sed -i 's/vars\.os.*/vars.os = "Docker"/' /etc/icinga2/conf.d/hosts.conf \
&& mv /etc/icingaweb2/ /etc/icingaweb2.dist \
&& mkdir /etc/icingaweb2 \
&& mv /etc/icinga2/ /etc/icinga2.dist \
&& mkdir /etc/icinga2 \
&& usermod -aG icingaweb2 www-data \
&& usermod -aG nagios www-data \
&& chmod u+s,g+s \
/bin/ping \
/bin/ping6 \
/usr/lib/nagios/plugins/check_icmp
EXPOSE 80 443 5665
# Initialize and run Supervisor
ENTRYPOINT ["/opt/run"]