Monitorare Virtual Host di Apache con Munin
Munin è uno splendido framework che permette di monitorare le prestazione dei vostri server e metterle in forma grafica tramite l’ottimo RDDTool
Per la configurazione di Munin vi rimando al sito o a questo tutorial in italiano
Nel particolare, apache viene monitorato tramite il modulo mod_status, che però restituisce i risultato per l’intero Apache
come nell’immagine seguente

Può essere più utile invece avere i dati divisi per ogni singolo Virtual Host
Bjørn Ruberg ha scritto un plugin per munin che fa questo, sfruttando un modulo di apache un po vecchiotto, mod_watch, che purtroppo non viene più distribuito.
Cercando un po’ in giro si trova però il sorgente ed è abbastanza semplice installarlo in debian
apt-get install apache-dev
tar -zxvf mod_watch318.tgz
cd mod_watch-3.18
make install-dynamic
NB Se usate apache due allora dovete usare mod_watch4
***************************************************************
How to build mod_watch for Apache 2.0To build a DSO version of mod_watch for Apache 2.0, first
verify the configuration at the top of the Makefile.dso then
type:make -f Makefile.dso build
make -f Makefile.dso installTo build a static version of mod_watch for Apache 2.0:
cd (path to)/apache_2.0.44
mkdir -p modules/com/snert
mv (path to)/mod_watch-4.2 modules/com/snert/watch
./buildconf
./configure \
–enable-watch \
… (your other configuration options) …
make install***************************************************************
Modifichiamo /etc/apache/modules.conf
e aggiungiamo la riga:
LoadModule watch_module /usr/lib/apache/1.3/mod_watch.so
Poi editiamo /etc/apache/httpd.conf
<IfModule mod_watch.c>
# Allows the URL used to query virtual host data:
#
# http://www.snert.com/watch-info
#
<Location /watch-info>
SetHandler watch-info
Order allow,deny
Allow from hostname
</Location>
# Intended for debugging and analysis of shared memory
# hash table and weenie files:
#
# http://www.snert.com/watch-table
#<Location /watch-table>
SetHandler watch-table
Order allow,deny
Allow from hostname
</Location><Location /watch-list>
SetHandler watch-list
Order allow,deny
Allow from hostname
</Location>
</IfModule>
Dove chiaramente hostname va sostituito con un host a vostra scelta (tipicamente localhost)
Stop & start apache (restart a volte non basta
)
/etc/init.d/apache stop && /etc/init.d/apache start
Possiamo verificare da riga di comando che tutto funzioni
./mod_watch.pl -f ifRequests,ifDocuments http://www.freshnet.org/watch-list/
65236
11851
14:59.59
SERVER
Ora installiamo il plugin
cp mod_watch /usr/share/munin/plugins/
cd /etc/munin/plugins
ln -sf /usr/share/munin/plugins/apache_watch apache_watch_bytes
ln -sf /usr/share/munin/plugins/apache_watch apache_watch_documents
ln -sf /usr/share/munin/plugins/apache_watch apache_watch_requestes
Come ultima cosa riavviamo munin-node
/etc/init.d/munin-node restart
Il risultato finale ci mostrerà, ad esempio, le richieste divise per singolo virtualhost

March 8th, 2007 at 7:51 pm
[...] http://www.freshnet.org/wordpress/2007/03/08/monitorare-virtual-host-di-apache-con-munin/ [...]