diff options
author | Soulou <leo@unbekandt.eu> | 2015-04-30 16:31:07 +0200 |
---|---|---|
committer | Soulou <leo@unbekandt.eu> | 2015-04-30 16:31:07 +0200 |
commit | e3504cee99dab2331df59f6463e5be5ac222dedd (patch) | |
tree | 65b6681743022105241cc423eb035f96f826edc0 | |
download | munin-e3504cee99dab2331df59f6463e5be5ac222dedd.tar.gz munin-e3504cee99dab2331df59f6463e5be5ac222dedd.tar.bz2 munin-e3504cee99dab2331df59f6463e5be5ac222dedd.tar.xz munin-e3504cee99dab2331df59f6463e5be5ac222dedd.zip |
Initial version
-rw-r--r-- | Dockerfile | 19 | ||||
-rw-r--r-- | munin.conf | 16 | ||||
-rw-r--r-- | nginx-munin | 16 | ||||
-rw-r--r-- | start-munin.sh | 49 |
4 files changed, 100 insertions, 0 deletions
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 <leo.unbekandt@appsdeck.eu> + +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 +<html> +<head> + <title>Munin</title> +</head> +<body> +Munin has not run yet. Please try again in a few moments. +</body> +</html> +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 |