From e3504cee99dab2331df59f6463e5be5ac222dedd Mon Sep 17 00:00:00 2001 From: Soulou Date: Thu, 30 Apr 2015 16:31:07 +0200 Subject: Initial version --- Dockerfile | 19 +++++++++++++++++++ munin.conf | 16 ++++++++++++++++ nginx-munin | 16 ++++++++++++++++ start-munin.sh | 49 +++++++++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 100 insertions(+) create mode 100644 Dockerfile create mode 100644 munin.conf create mode 100644 nginx-munin create mode 100644 start-munin.sh diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..ff21e0b --- /dev/null +++ b/Dockerfile @@ -0,0 +1,19 @@ +FROM ubuntu:14.04 + +MAINTAINER Leo Unbekandt + +RUN adduser --system --home /var/lib/munin --shell /bin/false --uid 1103 --group munin + +RUN apt-get update -qq && RUNLEVEL=1 DEBIAN_FRONTEND=noninteractive \ + apt-get install -y -qq cron munin munin-node nginx apache2-utils wget +RUN rm /etc/nginx/sites-enabled/default && mkdir -p /var/cache/munin/www && chown munin:munin /var/cache/munin/www && mkdir -p /var/run/munin && chown -R munin:munin /var/run/munin + +VOLUME /var/lib/munin +VOLUME /var/log/munin + +ADD ./munin.conf /etc/munin/munin.conf +ADD ./nginx-munin /etc/nginx/sites-enabled/munin +ADD ./start-munin.sh /munin +EXPOSE 80 +CMD bash /munin + diff --git a/munin.conf b/munin.conf new file mode 100644 index 0000000..66febbf --- /dev/null +++ b/munin.conf @@ -0,0 +1,16 @@ +#dbdir /var/lib/munin +#htmldir /var/cache/munin/www +#logdir /var/log/munin +#rundir /var/run/munin +#tmpldir /etc/munin/templates +#staticdir /etc/munin/static +includedir /etc/munin/munin-conf.d +#graph_period second +#graph_strategy cron +#munin_cgi_graph_jobs 6 +#cgiurl_graph /munin-cgi/munin-cgi-graph +#max_size_x 4000 +#max_size_y 4000 +#html_strategy cron +#max_processes 16 +#rrdcached_socket /var/run/rrdcached.sock diff --git a/nginx-munin b/nginx-munin new file mode 100644 index 0000000..ab67f68 --- /dev/null +++ b/nginx-munin @@ -0,0 +1,16 @@ +server { + listen 80 default_server; + server_name munin; + access_log /var/log/nginx/munin-access.log; + error_log /var/log/nginx/munin-server.log; + + location /munin { + root /var/cache/munin/www; + } + + location / { + auth_basic "Munin Server"; + auth_basic_user_file "/etc/munin/htpasswd.users"; + root "/var/cache/munin/www"; + } +} diff --git a/start-munin.sh b/start-munin.sh new file mode 100644 index 0000000..b0fb3b0 --- /dev/null +++ b/start-munin.sh @@ -0,0 +1,49 @@ +#!/bin/bash +NODES=${NODES:-} +MUNIN_USER=${MUNIN_USER:-user} +MUNIN_PASSWORD=${MUNIN_PASSWORD:-password} + +htpasswd -b -c /etc/munin/htpasswd.users "$MUNIN_USER" "$MUNIN_PASSWORD" + +# generate node list +for NODE in $NODES +do + NAME=`echo $NODE | cut -d ":" -f1` + HOST=`echo $NODE | cut -d ":" -f2` + cat << EOF >> /etc/munin/munin.conf +[$NAME] + address $HOST + use_node_name yes + +EOF +done + +# placeholder html to prevent permission error +if [ ! -e /var/cache/munin/www/index.html ]; then +cat << EOF > /var/cache/munin/www/index.html + + + Munin + + +Munin has not run yet. Please try again in a few moments. + + +EOF +chown munin:munin /var/cache/munin/www/index.html +chmod g+w /var/cache/munin/www/index.html +fi + +# start rsyslogd +/usr/sbin/rsyslogd +# start cron +/usr/sbin/cron +# start local munin-node +/usr/sbin/munin-node +echo "Using the following munin nodes:" +echo $NODES +# start apache +/usr/sbin/nginx +# show logs +echo "Tailing /var/log/syslog..." +tail -F /var/log/syslog /var/log/munin/munin-update.log -- cgit v1.2.3