summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--.gitignore1
-rw-r--r--CHANGELOG (renamed from VERSION)4
-rw-r--r--Dockerfile3
-rw-r--r--munin.conf10
-rw-r--r--nginx-munin13
-rw-r--r--nginx.conf30
-rw-r--r--start-munin.sh2
-rw-r--r--test/munin/.gitkeep0
-rwxr-xr-xtest/start_test.sh19
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/*
diff --git a/VERSION b/CHANGELOG
index b348c1d..b0c56a7 100644
--- a/VERSION
+++ b/CHANGELOG
@@ -1,3 +1,7 @@
+# v7 - 2 Nov 2016
+
+* Add support for graph CGI
+
# v5 - 30 Apr 2015
* Graceful shutdown
diff --git a/Dockerfile b/Dockerfile
index 738b909..498e213 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -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
diff --git a/munin.conf b/munin.conf
index 66febbf..9dacba5 100644
--- a/munin.conf
+++ b/munin.conf
@@ -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