munin-server: utilisation de fastcgi

Sorry, mais j'ai préféré ne pas le faire avec fastcgiwrap pour être sûr
de contrôler le nombre de process lancés à un instant donné. De plus, je
galérais avec les path et les requests_uri pour les faire fitter aux pages
que munin génère.
This commit is contained in:
Daniel STAN 2014-03-16 17:51:04 +01:00
parent 8e6e5552ed
commit f5ed044766
8 changed files with 136 additions and 3 deletions

View file

@ -3,4 +3,8 @@
<Package name="rrdcached"/> <!-- speed up graphing -->
<Path name="/etc/default/rrdcached"/>
<Python name="/etc/munin/munin.conf"/>
<Path name="/etc/init.d/munin-fastcgi"/>
<Group name="nginx">
<Path name="/etc/nginx/sites-available/munin" />
</Group>
</Bundle>

View file

@ -0,0 +1,3 @@
<FileInfo>
<Info owner='root' group='root' perms='0755'/>
</FileInfo>

View file

@ -0,0 +1,84 @@
#! /bin/sh
### BEGIN INIT INFO
# Provides: munin-fastcgi
# Required-Start: $remote_fs $network
# Required-Stop: $remote_fs $network
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: starts munin-fastcgi
# Description: Spawn Munin FCGI sockets for Web access
### END INIT INFO
#
# munin-fastcgi Startup script for Munin CGI services
#
# chkconfig: - 84 15
# description: Loading Munin CGI services using spawn-cgi
# HTML files and CGI.
#
# Author: Ryan Norbauer <ryan.norbauer@gmail.com>
# Modified: Geoffrey Grosenbach http://topfunky.com
# Modified: David Krmpotic http://davidhq.com
# Modified: Kun Xi http://kunxi.org
# Modified: http://drumcoder.co.uk/
# Modified: http://uname.pingveno.net/
DAEMON=/usr/bin/spawn-fcgi
FCGI_GRAPH_SOCK=/var/run/munin/fastcgi-munin-graph.sock
FCGI_HTML_SOCK=/var/run/munin/fastcgi-munin-html.sock
WWW_USER=www-data
FCGI_USER=munin
FCGI_GROUP=munin
FCGI_SPAWN_GRAPH=/usr/lib/munin/cgi/munin-cgi-graph
FCGI_SPAWN_HTML=/usr/lib/munin/cgi/munin-cgi-html
PIDFILE_GRAPH=/var/run/munin/fastcgi-munin-graph.pid
PIDFILE_HTML=/var/run/munin/fastcgi-munin-html.pid
DESC="Munin FCGI for Graph and HTML"
# Gracefully exit if the package has been removed.
test -x $DAEMON || exit 0
test -x $FCGI_SPAWN_GRAPH || exit 0
test -x $FCGI_SPAWN_HTML || exit 0
start() {
$DAEMON -s $FCGI_GRAPH_SOCK -U $WWW_USER -u $FCGI_USER -g $FCGI_GROUP -P $PIDFILE_GRAPH $FCGI_SPAWN_GRAPH 2> /dev/null || echo "Graph Already running"
$DAEMON -s $FCGI_HTML_SOCK -U $WWW_USER -u $FCGI_USER -g $FCGI_GROUP -P $PIDFILE_HTML $FCGI_SPAWN_HTML 2> /dev/null || echo "HTML Already running"
}
stop() {
kill -QUIT `cat $PIDFILE_GRAPH` || echo "Graph not running"
kill -QUIT `cat $PIDFILE_HTML` || echo "HTML Not running"
}
restart() {
kill -HUP `cat $PIDFILE_GRAPH` || echo "Can't reload Graph"
kill -HUP `cat $PIDFILE_HTML` || echo "Can't reload HTML"
}
case "$1" in
start)
echo "Starting $DESC: "
start
;;
stop)
echo "Stopping $DESC: "
stop
;;
restart|reload)
echo "Restarting $DESC: "
stop
# One second might not be time enough for a daemon to stop,
# if this happens, d_start will fail (and dpkg will break if
# the package is being upgraded). Change the timeout if needed
# be, or change d_stop to have start-stop-daemon use --retry.
# Notice that using --retry slows down the shutdown process somewhat.
sleep 1
start
;;
*)
echo "Usage: $SCRIPTNAME {start|stop|restart|reload}" >&2
exit 3
;;
esac
exit $?

View file

@ -0,0 +1,3 @@
<FileInfo>
<Info owner='root' group='root' perms='0644'/>
</FileInfo>

View file

@ -0,0 +1,30 @@
# Fichier géré par bcfg2 !
server {
listen 80;
listen [::]:80 ipv6only=on;
server_name fy.adm.crans.org fy.crans.org munin.crans.org;
#access_log off;
root /var/www/munin/;
index index.html index.htm;
location / {
fastcgi_pass unix:/var/run/munin/fastcgi-munin-html.sock;
include fastcgi_params;
}
location /munin-graph {
fastcgi_split_path_info ^(/munin-graph)(.*);
fastcgi_param PATH_INFO $fastcgi_path_info;
fastcgi_pass unix:/var/run/munin/fastcgi-munin-graph.sock;
include fastcgi_params;
}
location /static/ {
alias /etc/munin/static/;
}
location /favicon.ico {
alias /etc/munin/static/$request_uri;
}
}

View file

@ -1571,6 +1571,7 @@
<Group name="munin-server"
category="supervisor-server">
<Bundle name="munin-server"/>
<Group name="nginx">
<!-- <Bundle name="munin"/> -->
</Group>

View file

@ -186,6 +186,14 @@ service("mysql",
service("munin-node",
pidf="munin/munin-node")
service("munin-server",
name="munin-fastcgi",
pidf="munin/fastcgi-munin-graph",
extra=[
"if failed unixsocket /var/run/munin/fastcgi-munin-graph.sock then restart",
"if failed unixsocket /var/run/munin/fastcgi-munin-html.sock then restart",
])
service("nslcd",
pidf="nslcd/nslcd",
extra=["if failed unixsocket /var/run/nslcd/socket then restart"])

View file

@ -38,13 +38,13 @@ contact.roots.command mail -s "Munin - ${var:host} : ${var:graph_title}" nobody@
#contact.impression.command mail -s "Munin - ${var:graph_title}" impression@crans.org
# Nagios
contact.nagios.command /usr/sbin/send_nsca -H localhost -c /etc/send_nsca.cfg -to 120 > /dev/null
contacts nagios
#contact.nagios.command /usr/sbin/send_nsca -H localhost -c /etc/send_nsca.cfg -to 120 > /dev/null
#contacts nagios
# Les graphes sont réalisés via le CGI
graph_strategy cgi
cgiurl /munin-bin
cgiurl_graph /munin-cgi/munin-cgi-graph
cgiurl_graph /munin-graph
# Et l'html aussi
html_strategy cgi