Daniel Dehennin <daniel.dehen...@baby-gnu.org> writes: Hello,
An updated patch for the nginx configuration, cgi-graph URI are under /munin-cgi not /cgi-bin/. Regards. From 0a4b758768b566f52423e5f07769471bd446be4d Mon Sep 17 00:00:00 2001 From: Daniel Dehennin <daniel.dehen...@baby-gnu.org> Date: Fri, 10 Aug 2012 10:51:41 +0200 Subject: [PATCH] Install examples for configuration with nginx and FastCGI * debian/munin.examples: Install examples files. * debian/munin.nginx.conf: Configuration sample for nginx. * debian/munin-cgi.conf: Configuration to disable generation of html and graphs, should be put under /etc/munin/munin-conf.d/. * debian/munin-cgi-graph.init: Init script to start munin-cgi-graph. * debian/munin-cgi-html.init: Init script to start munin-cgi-html. --- debian/munin-cgi-graph.init | 116 +++++++++++++++++++++++++++++++++++++++++++ debian/munin-cgi-html.init | 116 +++++++++++++++++++++++++++++++++++++++++++ debian/munin-cgi.conf | 17 +++++++ debian/munin.examples | 4 ++ debian/munin.nginx.conf | 47 ++++++++++++++++++ 5 files changed, 300 insertions(+) create mode 100644 debian/munin-cgi-graph.init create mode 100644 debian/munin-cgi-html.init create mode 100644 debian/munin-cgi.conf create mode 100644 debian/munin.examples create mode 100644 debian/munin.nginx.conf diff --git a/debian/munin-cgi-graph.init b/debian/munin-cgi-graph.init new file mode 100644 index 0000000..9754691 --- /dev/null +++ b/debian/munin-cgi-graph.init @@ -0,0 +1,116 @@ +#! /bin/sh + +### BEGIN INIT INFO +# Provides: munin-cgi-graph +# Required-Start: $network $named $local_fs $remote_fs +# Required-Stop: $network $named $local_fs $remote_fs +# Default-Start: 2 3 4 5 +# Default-Stop: 0 1 6 +# Short-Description: starts FastCGI for Munin-Graph +# Description: starts FastCGI for Munin-Graph using start-stop-daemon +### END INIT INFO +# -------------------------------------------------------------- +# Based on Munin-CGI-Graph Spawn-FCGI Startscript by Julien Schmidt +# eMail: munin-trac at julienschmidt.com +# www: http://www.julienschmidt.com +# -------------------------------------------------------------- +# Install: +# 1. Copy this file to /etc/init.d +# 2. run "update-rc.d munin-cgi-graph defaults" +# -------------------------------------------------------------- + +PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin +NAME=munin-cgi-graph +PID_FILE="/var/run/munin/$NAME.pid" +SOCK_FILE="/var/run/munin/$NAME.socket" +CGI_SCRIPT="/usr/lib/munin/cgi/$NAME" +DAEMON=/usr/bin/spawn-fcgi +DAEMON_OPTS="-s $SOCK_FILE -U www-data -u munin -g munin -P $PID_FILE -- $CGI_SCRIPT" + +# -------------------------------------------------------------- +# No edits necessary beyond this line +# -------------------------------------------------------------- + +if [ ! -x $DAEMON ]; then + echo "File not found or is not executable: $DAEMON!" + exit 0 +fi + +status() { + if [ ! -r $PID_FILE ]; then + return 1 + fi + + FCGI_PID=`cat $PID_FILE` + if [ -z "${FCGI_PID}" ]; then + return 1 + fi + + FCGI_RUNNING=`ps -p ${FCGI_PID} | grep ${FCGI_PID}` + if [ -z "${FCGI_RUNNING}" ]; then + return 1 + fi + + return 0 +} + +start() { + if status; then + echo "FCGI is already running!" + exit 1 + else + $DAEMON $DAEMON_OPTS + fi +} + +stop () { + if ! status; then + echo "No PID-file at $PID_FILE found or PID not valid. Maybe not running" + exit 1 + fi + + # Kill process + kill -9 `cat $PID_FILE` + + # Remove PID-file + rm -f $PID_FILE + + # Remove Sock-File + rm -f $SOCK_FILE +} + +case "$1" in + start) + echo "Starting $NAME: " + start + echo "... DONE" + ;; + + stop) + echo "Stopping $NAME: " + stop + echo "... DONE" + ;; + + force-reload|restart) + echo "Stopping $NAME: " + stop + start + echo "... DONE" + ;; + + status) + if status; then + echo "FCGI is RUNNING" + else + echo "FCGI is NOT RUNNING" + fi + ;; + + *) + echo "Usage: $0 {start|stop|restart|status}" + exit 1 + ;; +esac + +exit 0 diff --git a/debian/munin-cgi-html.init b/debian/munin-cgi-html.init new file mode 100644 index 0000000..a155060 --- /dev/null +++ b/debian/munin-cgi-html.init @@ -0,0 +1,116 @@ +#! /bin/sh + +### BEGIN INIT INFO +# Provides: munin-cgi-html +# Required-Start: $network $named $local_fs $remote_fs +# Required-Stop: $network $named $local_fs $remote_fs +# Default-Start: 2 3 4 5 +# Default-Stop: 0 1 6 +# Short-Description: starts FastCGI for Munin-HTML +# Description: starts FastCGI for Munin-HTML using start-stop-daemon +### END INIT INFO +# -------------------------------------------------------------- +# Based on Munin-CGI-Graph Spawn-FCGI Startscript by Julien Schmidt +# eMail: munin-trac at julienschmidt.com +# www: http://www.julienschmidt.com +# -------------------------------------------------------------- +# Install: +# 1. Copy this file to /etc/init.d +# 2. run "update-rc.d munin-cgi-html defaults" +# -------------------------------------------------------------- + +PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin +NAME=munin-cgi-html +PID_FILE="/var/run/munin/$NAME.pid" +SOCK_FILE="/var/run/munin/$NAME.socket" +CGI_SCRIPT="/usr/lib/munin/cgi/$NAME" +DAEMON=/usr/bin/spawn-fcgi +DAEMON_OPTS="-s $SOCK_FILE -U www-data -u munin -g munin -P $PID_FILE -- $CGI_SCRIPT" + +# -------------------------------------------------------------- +# No edits necessary beyond this line +# -------------------------------------------------------------- + +if [ ! -x $DAEMON ]; then + echo "File not found or is not executable: $DAEMON!" + exit 0 +fi + +status() { + if [ ! -r $PID_FILE ]; then + return 1 + fi + + FCGI_PID=`cat $PID_FILE` + if [ -z "${FCGI_PID}" ]; then + return 1 + fi + + FCGI_RUNNING=`ps -p ${FCGI_PID} | grep ${FCGI_PID}` + if [ -z "${FCGI_RUNNING}" ]; then + return 1 + fi + + return 0 +} + +start() { + if status; then + echo "FCGI is already running!" + exit 1 + else + $DAEMON $DAEMON_OPTS + fi +} + +stop () { + if ! status; then + echo "No PID-file at $PID_FILE found or PID not valid. Maybe not running" + exit 1 + fi + + # Kill process + kill -9 `cat $PID_FILE` + + # Remove PID-file + rm -f $PID_FILE + + # Remove Sock-File + rm -f $SOCK_FILE +} + +case "$1" in + start) + echo "Starting $NAME: " + start + echo "... DONE" + ;; + + stop) + echo "Stopping $NAME: " + stop + echo "... DONE" + ;; + + force-reload|restart) + echo "Stopping $NAME: " + stop + start + echo "... DONE" + ;; + + status) + if status; then + echo "FCGI is RUNNING" + else + echo "FCGI is NOT RUNNING" + fi + ;; + + *) + echo "Usage: $0 {start|stop|restart|status}" + exit 1 + ;; +esac + +exit 0 diff --git a/debian/munin-cgi.conf b/debian/munin-cgi.conf new file mode 100644 index 0000000..6226259 --- /dev/null +++ b/debian/munin-cgi.conf @@ -0,0 +1,17 @@ +## Disable generation of graph and html by munin-cron +## Put this file under /etc/munin/munin-conf.d/ + +# Graphics files are normally generated on-demand by a CGI process. +# See http://munin-monitoring.org/wiki/CgiHowto2 for more +# documentation. Since 2.0, there is no official support for cron running +# munin-graph. It has been rewritten to use the cgi code. +# It is single threaded *by design* now. +# +graph_strategy cgi + +# HTML files are normally generated by munin-html, no matter if the +# files are used or not. You can change this to on-demand generation +# by following the instructions in +# http://munin-monitoring.org/wiki/CgiHowto2 +# +html_strategy cgi diff --git a/debian/munin.examples b/debian/munin.examples new file mode 100644 index 0000000..d4cfed4 --- /dev/null +++ b/debian/munin.examples @@ -0,0 +1,4 @@ +debian/munin-cgi-graph.init +debian/munin-cgi-html.init +debian/munin-cgi.conf +debian/munin.nginx.conf diff --git a/debian/munin.nginx.conf b/debian/munin.nginx.conf new file mode 100644 index 0000000..fb83173 --- /dev/null +++ b/debian/munin.nginx.conf @@ -0,0 +1,47 @@ +## +# Example configuration for munin using munin-cgi-html and +# munin-cgi-graph as FastCGI +# +# Put this file in /etc/nginx/sites-available and link it in +# /etc/nginx/sites-enabled +# +# In addition, the Munin log files and html area should be writable +# to the web server. +# +# Based on http://munin-monitoring.org/wiki/CgiHowto2#nginx +## + +server { + listen 127.0.0.1; + + root /var/cache/munin; + + access_log /var/log/nginx/munin-access.log; + error_log /var/log/nginx/munin-errors.log; + + # Make site accessible from http://localhost/ + server_name localhost; + + location / { + deny all; + } + + location /munin/static/ { + alias /etc/munin/static/; + expires 31d; + } + + location /munin/ { + fastcgi_split_path_info ^(/munin)(.*); + fastcgi_param PATH_INFO $fastcgi_path_info; + fastcgi_pass unix:/var/run/munin/munin-cgi-html.socket; + include fastcgi_params; + } + + 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/munin-cgi-graph.socket; + include fastcgi_params; + } +} -- 1.7.10.4 -- Daniel Dehennin Récupérer ma clef GPG: gpg --keyserver pgp.mit.edu --recv-keys 0x7A6FE2DF
pgp4cyVqBS1rr.pgp
Description: PGP signature