Skip to content

Commit a3a84c8

Browse files
authored
Merge pull request #1 from opinkerfi/docker-adagios-centos7-systemd
Adagios running on Centos7 with systemd
2 parents c5fef6a + 5d16be5 commit a3a84c8

File tree

5 files changed

+33
-125
lines changed

5 files changed

+33
-125
lines changed

Dockerfile

Lines changed: 21 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
# Based on appcontainers/nagios
44
############################################################
55

6-
FROM centos:latest
6+
FROM centos/systemd
77
MAINTAINER "Gardar Thorsteinsson" <gardart@gmail.com>
88

99
ENV ADAGIOS_HOST adagios.local
@@ -29,11 +29,11 @@ RUN yum --enablerepo=ok-testing install -y naemon naemon-livestatus git adagios
2929
# Lets make sure adagios can write to naemon configuration files, and that
3030
# it is a valid git repo so we have audit trail
3131
WORKDIR /etc/naemon
32-
#RUN git config user.name "admin"
33-
#RUN git config user.email "admin@adagios.local"
34-
#RUN git init /etc/naemon
35-
#UN git add .
36-
#RUN git commit -a -m "Initial commit"
32+
RUN git init /etc/naemon
33+
RUN git config user.name "admin"
34+
RUN git config user.email "admin@adagios.local"
35+
RUN git add .
36+
RUN git commit -a -m "Initial commit"
3737

3838
# Fix permissions for naemon and pnp4nagios
3939
RUN chown -R naemon:naemon /etc/naemon /etc/adagios /var/lib/adagios /var/lib/pnp4nagios /var/log/pnp4nagios /var/spool/pnp4nagios /etc/pnp4nagios/process_perfdata.cfg /var/log/okconfig
@@ -109,38 +109,29 @@ RUN pynag config --append cfg_dir=/etc/naemon/commands/
109109

110110
RUN mv /etc/httpd/conf.d/thruk_cookie_auth_vhost.conf /etc/httpd/conf.d/thruk_cookie_auth_vhost.conf.disabled
111111

112+
RUN htpasswd -b /etc/thruk/htpasswd "$ADAGIOS_USER" "$ADAGIOS_PASS"
113+
RUN rm -f /etc/nagios/passwd
114+
RUN ln -s /etc/thruk/htpasswd /etc/nagios/passwd
115+
112116
# Redirect root URL to /adagios
113117
RUN echo "RedirectMatch ^/$ /adagios" > /etc/httpd/conf.d/redirect.conf
114118

115-
# Install supervisor and supervisor-quick. Service restarts are painfully slow
116-
# otherwise
117-
RUN pip install supervisor
118-
RUN pip install supervisor-quick
119-
120-
# Remove cache and default passwd files
121-
RUN rm -rf /var/cache/yum /etc/nagios/passwd /etc/thruk/htpasswd
122-
123-
# Copy supervisor config over to the container
124-
COPY supervisord.conf /etc/supervisord.conf
125-
126-
# Copy custom supervisor init.d script (for nagios start|stop)
127-
COPY naemon-supervisor-wrapper.sh /usr/bin/naemon-supervisor-wrapper.sh
128-
RUN sed -i 's|^\(nagios_init_script\)=\(.*\)$|\1="sudo /usr/bin/naemon-supervisor-wrapper.sh"|g' /etc/adagios/adagios.conf
129-
RUN echo "naemon ALL=NOPASSWD: /usr/bin/naemon-supervisor-wrapper.sh" >> /etc/sudoers
130-
131-
# Create childlogdir
132-
RUN mkdir /var/log/supervisor
119+
# Fix permissions for naemon and pnp4nagios
120+
RUN chown -R naemon:naemon /etc/naemon /etc/adagios /var/lib/adagios /var/lib/pnp4nagios /var/log/pnp4nagios /var/spool/pnp4nagios /etc/pnp4nagios/process_perfdata.cfg /var/log/okconfig
121+
# ACL group permissions need g+rwx
122+
RUN chmod g+rwx -R /etc/naemon /etc/adagios /var/lib/adagios /var/lib/pnp4nagios /var/log/pnp4nagios /var/spool/pnp4nagios /etc/pnp4nagios/process_perfdata.cfg /var/log/okconfig
123+
RUN setfacl -R -m group:naemon:rwx -m d:group:naemon:rwx /etc/naemon/ /etc/adagios /var/lib/adagios /var/lib/pnp4nagios /var/log/pnp4nagios /var/spool/pnp4nagios /etc/pnp4nagios/process_perfdata.cfg /var/log/okconfig
133124

134-
# Copy over our custom init script
135-
COPY run.sh /usr/bin/run.sh
125+
# Enable services
126+
RUN systemctl enable httpd
127+
RUN systemctl enable naemon
128+
RUN systemctl enable npcd
136129

137-
# Make run.sh and supervisor wrapper script executable
138-
RUN chmod 755 /usr/bin/run.sh /usr/bin/naemon-supervisor-wrapper.sh
130+
# Remove yum cache
131+
RUN rm -rf /var/cache/yum
139132

140133
WORKDIR /etc/naemon
141134

142-
ENTRYPOINT ["/bin/bash", "/usr/bin/run.sh"]
143-
144135
EXPOSE 80
145136

146137
VOLUME ["/etc/naemon", "/var/log/naemon"]

README.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,18 @@ docker create \
1717

1818
Log in with user `thrukadmin` and password `thrukadmin`
1919

20+
## Building
21+
22+
```
23+
git clone https://github.com/opinkerfi/docker-adagios-rpm.git
24+
cd docker-adagios-rpm
25+
docker build -t adagios_systemd_image .
26+
docker run --cap-add=SYS_ADMIN --name adagios -v /sys/fs/cgroup:/sys/fs/cgroup -p 8080:80 -d adagios_systemd_image
27+
```
28+
29+
Then you should be able to access http://localhost:8080
30+
Log in with user `thrukadmin` and password `thrukadmin`
31+
2032
## Parameters
2133

2234
The parameters are split into two halves, separated by a colon, the left hand side representing the host and the right the container side.

naemon-supervisor-wrapper.sh

Lines changed: 0 additions & 11 deletions
This file was deleted.

run.sh

Lines changed: 0 additions & 50 deletions
This file was deleted.

supervisord.conf

Lines changed: 0 additions & 34 deletions
This file was deleted.

0 commit comments

Comments
 (0)