diff options
author | Soulou <leo.unbek@gmail.com> | 2016-11-02 00:11:51 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-11-02 00:11:51 +0100 |
commit | 73d0b3879b90fb48a9177a03382cfd132ab5c431 (patch) | |
tree | e786e6d4a761f598eec5e4753c70fdb258f04b10 | |
parent | 6580e4949d3f3cf3f1972df9a7ce284dddae96b4 (diff) | |
parent | aa2d22c92a523efd26cd575320ab90df5c94e744 (diff) | |
download | munin-73d0b3879b90fb48a9177a03382cfd132ab5c431.tar.gz munin-73d0b3879b90fb48a9177a03382cfd132ab5c431.tar.bz2 munin-73d0b3879b90fb48a9177a03382cfd132ab5c431.tar.xz munin-73d0b3879b90fb48a9177a03382cfd132ab5c431.zip |
Merge pull request #7 from Scalingo/support_cgi
Support CGI graphs
-rw-r--r-- | .gitignore | 1 | ||||
-rw-r--r-- | CHANGELOG (renamed from VERSION) | 4 | ||||
-rw-r--r-- | Dockerfile | 3 | ||||
-rw-r--r-- | munin.conf | 10 | ||||
-rw-r--r-- | nginx-munin | 13 | ||||
-rw-r--r-- | nginx.conf | 30 | ||||
-rw-r--r-- | start-munin.sh | 2 | ||||
-rw-r--r-- | test/munin/.gitkeep | 0 | ||||
-rwxr-xr-x | test/start_test.sh | 19 |
9 files changed, 76 insertions, 6 deletions
diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..9bf10b4 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +test/munin/* @@ -1,3 +1,7 @@ +# v7 - 2 Nov 2016 + +* Add support for graph CGI + # v5 - 30 Apr 2015 * Graceful shutdown @@ -5,13 +5,14 @@ MAINTAINER Leo Unbekandt <leo@scalingo.com> 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 heirloom-mailx patch + apt-get install -y -qq cron munin munin-node nginx apache2-utils wget heirloom-mailx patch spawn-fcgi libcgi-fast-perl 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.conf /etc/nginx/nginx.conf ADD ./nginx-munin /etc/nginx/sites-enabled/munin ADD ./start-munin.sh /munin ADD ./munin-graph-logging.patch /usr/share/munin @@ -6,11 +6,15 @@ #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 + +## html_strategy cron|cgi +html_strategy cron +## graph_strategy cron|cgi +graph_strategy cgi +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 index 66bf1d1..d0f5da9 100644 --- a/nginx-munin +++ b/nginx-munin @@ -1,16 +1,25 @@ server { listen 8080 default_server; server_name munin; + access_log /var/log/nginx/munin-access.log; error_log /var/log/nginx/munin-server.log; + auth_basic "Munin Server"; + auth_basic_user_file "/etc/munin/htpasswd.users"; + location /munin { root /var/cache/munin/www; } + location ^~ /munin-cgi/munin-cgi-graph/ { + fastcgi_split_path_info ^(/munin-cgi/munin-cgi-graph)(.*); + fastcgi_param PATH_INFO $fastcgi_path_info; + fastcgi_pass unix:/var/run/munin/fcgi-graph.sock; + include fastcgi_params; + } + location / { - auth_basic "Munin Server"; - auth_basic_user_file "/etc/munin/htpasswd.users"; root "/var/cache/munin/www"; } } diff --git a/nginx.conf b/nginx.conf new file mode 100644 index 0000000..baac5b6 --- /dev/null +++ b/nginx.conf @@ -0,0 +1,30 @@ +user munin; +worker_processes 4; +pid /run/nginx.pid; + +events { + worker_connections 768; + # multi_accept on; +} + +http { + sendfile on; + tcp_nopush on; + tcp_nodelay on; + keepalive_timeout 65; + types_hash_max_size 2048; + + include /etc/nginx/mime.types; + default_type application/octet-stream; + + access_log /var/log/nginx/access.log; + error_log /var/log/nginx/error.log; + + gzip on; + gzip_disable "msie6"; + + include /etc/nginx/conf.d/*.conf; + include /etc/nginx/sites-enabled/*; +} + + diff --git a/start-munin.sh b/start-munin.sh index 6df87cc..fda929c 100644 --- a/start-munin.sh +++ b/start-munin.sh @@ -114,6 +114,8 @@ fi /usr/sbin/munin-node echo "Using the following munin nodes:" echo $NODES +# start spawn-cgi to enable CGI interface with munin (dynamix graph generation) +spawn-fcgi -s /var/run/munin/fcgi-graph.sock -U munin -u munin -g munin /usr/lib/munin/cgi/munin-cgi-graph # start nginx /usr/sbin/nginx # show logs diff --git a/test/munin/.gitkeep b/test/munin/.gitkeep new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/test/munin/.gitkeep diff --git a/test/start_test.sh b/test/start_test.sh new file mode 100755 index 0000000..7f81e69 --- /dev/null +++ b/test/start_test.sh @@ -0,0 +1,19 @@ +#!/bin/bash + +if [ -z "$1" ] ; then + echo "usage: $0 <id of docker image>" + exit 1 +fi + +basedir="$( cd -P "$( dirname "$0" )" && pwd )/munin" + +docker run -it \ + -p 8080:8080 \ + -v $basedir/log:/var/log/munin \ + -v $basedir/lib:/var/lib/munin \ + -v $basedir/run:/run/munin \ + -v $basedir/cache:/var/cache/munin \ + -e MUNIN_USER=user \ + -e MUNIN_PASSWORD=secret \ + -e NODES="172.17.0.1:$(hostname)" \ + $1 |