forked from firecat53/dockerfiles
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added Check-MK monitoring Dockerfile.
- Loading branch information
Showing
7 changed files
with
143 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
# Check_MK | ||
|
||
FROM ubuntu:16.04 | ||
MAINTAINER Scott Hansen, [email protected] | ||
|
||
ENV VERSION 1.2.8p1 | ||
ENV DEBIAN_FRONTEND noninteractive | ||
|
||
COPY start.sh /start.sh | ||
RUN apt-get update -q && \ | ||
apt-get install -qy gdebi-core \ | ||
wget \ | ||
msmtp \ | ||
msmtp-mta \ | ||
heirloom-mailx && \ | ||
wget https://mathias-kettner.de/support/$VERSION/check-mk-raw-${VERSION}_0.xenial_amd64.deb && \ | ||
gdebi -nq check-mk-raw-${VERSION}_0.xenial_amd64.deb && \ | ||
rm check-mk-raw-${VERSION}_0.xenial_amd64.deb && \ | ||
chmod +x /start.sh && \ | ||
apt-get autoremove -qy gdebi-core \ | ||
wget && \ | ||
rm -rf /var/lib/apt/lists/* && \ | ||
|
||
CMD ["/start.sh"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
Docker Check-MK Monitoring | ||
========================== | ||
|
||
This is a Dockerfile to set up `Check-MK Monitoring`_ along with | ||
Msmtp send-only mail (using Gmail, Mandrill, etc.) for notifications. | ||
|
||
Build | ||
----- | ||
|
||
Ensure the correct version from the `downloads page`_ is noted in the | ||
Dockerfile. If your site requires Check-MK to run with tmpfs, remove the line | ||
in start.sh that disables it, then run the container with either `--priviliged` | ||
or `--cap-add SYS_ADMIN`. | ||
|
||
Build from Dockerfile:: | ||
|
||
docker build -t check_mk . | ||
|
||
Create data-only volume. Check-MK site configurations will be auto-generated in | ||
/opt/omd/sites. :: | ||
|
||
docker run -v /opt/omd/sites -v /config --name check_mk_config ubuntu | ||
|
||
Edit the msmtprc and msmtp-aliases files with your email SMTP info. Default | ||
site/user is omd. Then:: | ||
|
||
docker cp msmtprc check_mk_config:/config/ | ||
docker cp msmtp-aliases check_mk_config:/config/ | ||
|
||
Run | ||
___ | ||
|
||
Systemd service file is also available. :: | ||
|
||
docker run -d --volumes-from check_mk_config -v /etc/localtime:/etc/localtime -p 5000:5000 --name check_mk_run check_mk | ||
|
||
Be patient when starting (20-40 seconds). The site has to be generated | ||
initially, then regenerated on subsequent runs to make sure all the permissions | ||
and user/groups are correct. Existing site info will not be overwritten! | ||
|
||
Manage | ||
------ | ||
|
||
The default site name is 'default'. You can use the omd commands to control that | ||
site:: | ||
|
||
$ docker exec -it check_mk_run /bin/bash | ||
# omd --help | ||
# omd su default | ||
OMD[defatul]:~$ .... | ||
|
||
.. _Check-MK Monitoring: http://mathias-kettner.com/check_mk.html | ||
.. _downloads page: http://mathias-kettner.com/check_mk_download.php?HTML=yes |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
[Unit] | ||
Description=Check-MK container | ||
After=docker.service | ||
|
||
[Service] | ||
Restart=always | ||
RestartSec=10 | ||
ExecStartPre=-/usr/bin/docker rm check_mk_run | ||
ExecStart=/usr/bin/docker run \ | ||
--volumes-from check_mk_config \ | ||
-p 5000:5000 \ | ||
-v /etc/localtime:/etc/localtime:ro \ | ||
--name check_mk_run check_mk | ||
ExecStop=/usr/bin/docker stop check_mk_run | ||
|
||
[Install] | ||
WantedBy=multi-user.target |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
root: <email address> | ||
omd: <email address> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
# msmtp config file | ||
|
||
# gmail | ||
account gmail | ||
host smtp.gmail.com | ||
port 587 | ||
protocol smtp | ||
auth on | ||
from <email address> | ||
user <email address> | ||
password <password> | ||
tls on | ||
tls_trust_file /etc/ssl/certs/ca-certificates.crt | ||
|
||
# use gmail as default | ||
account default : gmail | ||
|
||
aliases /etc/msmtp-aliases | ||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
#!/bin/bash | ||
SITE=default | ||
|
||
# Link msmtp data volume to /etc/msmtprc | ||
chgrp omd /config/msmtp* | ||
chmod 640 /config/msmtprc | ||
ln -s /config/* /etc/ | ||
|
||
if [[ ! -d "/opt/omd/sites/$SITE" ]]; then | ||
# First Run | ||
# Set up a default site "omd" | ||
omd create "$SITE" | ||
|
||
# We don't want TMPFS as it requires higher privileges | ||
omd config "$SITE" set TMPFS off | ||
|
||
# Accept connections on any IP address, since we get a random one | ||
omd config "$SITE" set APACHE_TCP_ADDR 0.0.0.0 | ||
else | ||
# Reinitialize SITE | ||
omd mv "$SITE" temp | ||
omd mv temp "$SITE" | ||
fi | ||
omd start "$SITE" | ||
tail -f "/opt/omd/sites/$SITE/var/log/nagios.log" |