Installation et configuration d'un serveur Munin et de ses sondes

Introduction :

Munin est un système de supervision simple à mettre en place, et qui vous permettera de gérer efficacement votre parc de machine, et ceci en toute simplicité.

Installation :

Nous allons ici installer un serveur de graphique munin sur une Debian, et é clients. Le 1er client sera la machine serveur elle même et le 2ème sera une machine distante que nous voulons grapher également.

Installation du serveur:

apt-get install munin

Installation du client:

apt-get install munin-node

Debian télécharge automatiquement toutes la dépendances nécessaires.

Configuration du serveur munin :

Le serveur munin se configure par le biais du fichier /etc/munin/munin.conf

# Example configuration file for Munin, generated by 'make build'



# The next three variables specifies where the location of the RRD

# databases, the HTML output, and the logs, severally.  They all

# must be writable by the user running munin-cron.

dbdir	/var/lib/munin

htmldir	/var/www/munin #peu etre changé par vos soins

logdir	/var/log/munin

rundir  /var/run/munin



# Where to look for the HTML templates

tmpldir	/etc/munin/templates



# Make graphs show values per minute instead of per second

#graph_period minute



# Drop somejuser@fnord.comm and anotheruser@blibb.comm an email everytime 

# something changes (OK -> WARNING, CRITICAL -> OK, etc)

#contact.someuser.command mail -s "Munin notification" somejuser@fnord.comm

#contact.anotheruser.command mail -s "Munin notification" anotheruser@blibb.comm

#

# For those with Nagios, the following might come in handy. In addition,

# the services must be defined in the Nagios server as well.

#contact.nagios.command /usr/sbin/send_nsca -H nagios.host.com -c /etc/send_nsca.cfg



# a simple host tree

#[localhost.localdomain]

#    address 127.0.0.1

#    use_node_name yes



#votre machine serveur (qui sera client aussi, pour qu'elle soit graphée)

[machine.domaine.fr] #votre machine.votre-domaine.ext

	address XXX.XXX.XXX.XXX #l'ip de votre machine ou le nom de domaine

	use_node_name yes



# 

# A more complex example of a host tree

#

## First our "normal" host.

# [fii.foo.com]

#       address foo

#

## Then our other host...

# [fay.foo.com]

#       address fay

#

## Then we want totals...

# [fay.fr;Totals] #Force it into the "foo.com"-domain...

#      update no   # Turn off data-fetching for this "host".

#

#   # The graph "load1". We want to see the loads of both machines... 

#   # "fii=fii.foo.com:load.load" means "label=machine:graph.field"

#       load1.graph_title Loads side by side



#

#   # The graph "load2". Now we want them stacked on top of each other.

#       load2.graph_title Loads on top of each other

#       load2.dummy_field.stack fii=fii.foo.com:load.load fay=fay.foo.com:load.load

#       load2.dummy_field.draw AREA # We want area instead the default LINE2.

#       load2.dummy_field.label dummy # This is needed. Silly, really.

#

#   # The graph "load3". Now we want them summarised into one field

#       load3.graph_title Loads summarised

#       load3.combined_loads.sum fii.foo.com:load.load fay.foo.com:load.load

#       load3.combined_loads.label Combined loads # Must be set, as this is

#                                                 # not a dummy field!

#

## ...and on a side note, I want them listen in another order (default is

## alphabetically)

#

# # Since [foo.com] would be interpreted as a host in the domain "com", we

# # specify that this is a domain by adding a semicolon.

# [foo.com;]

#       node_order Totals fii.foo.com fay.foo.com

#

Configuration du cron du serveur :

Munin met a jour ces pages web toutes les 5 minutes via un cron (tache automatisée). Il est possible de modifier ce delai en changeant la valeur : , munin coté serveur n'est pas un service qui se redemmare via /etc/init.d/...., le cron se charge de tout.

dans le fichier /etc/cron.d/....

Configuration de l'apache : création du VHOST

Nous allons ajouter munin de 2 façons differentes, la première en ajoutant un sous domaine à notre domaine (munin.toto.fr), la seconde en créant seulement un alias sur notre domaine existant (toto.fr/munin)

Création du sous domaine:

création du fichier /etc/apache2/sites-availables/munin.conf



	ServerAdmin admin@gayux.fr

	ServerName munin.gayux.fr

	AddDefaultCharset utf-8

	DocumentRoot /var/www/munin

	

                AllowOverride All

                Options ExecCGI -MultiViews +SymLinksIfOwnerMatch

                Order allow,deny

                Allow from all

                

                        Order Allow,Deny

                        Deny from all

                

	



        ErrorLog /var/log/apache2/munin.gayux.fr-error.log



        # Possible values include: debug, info, notice, warn, error, crit,

        # alert, emerg.

	LogLevel warn

	CustomLog /var/log/apache2/munin.gayux.fr-access.log combined

	ServerSignature On

Installation du sous domaine:

a2ensite munin.conf

Autre alternative, la création d'un lien sur votre domaine principal:

ajouter la ligne suivante dans votre domaine.conf dans /etc/apache2/sites-availables

Alias /munin /var/www/munin

Configuration du client munin-node :

Le client munin node va donc être configuré sur les differentes machines que vous désirez grapher (y compris le serveur lui-même). Nous allons faire cette configuration via le fichier : /etc/munin/munin-node.conf

#

# Config-file for munin-node

#



log_level 4

log_file /var/log/munin/munin-node.log

port 4949

pid_file /var/run/munin/munin-node.pid

background 1

setseid 1



# Which port to bind to;

host *

user root

group root

setsid yes



# Regexps for files to ignore



ignore_file ~$

ignore_file \.bak$

ignore_file %$

ignore_file \.dpkg-(tmp|new|old|dist)$

ignore_file \.rpm(save|new)$



# Set this if the client doesn't report the correct hostname when

# telnetting to localhost, port 4949

#

host_name nom_machine.domaine.ext



# A list of addresses that are allowed to connect.  This must be a

# regular expression, due to brain damage in Net::Server, which

# doesn't understand CIDR-style network notation.  You may repeat

# the allow line as many times as you'd like



#allow ^127\.0\.0\.1$

allow ^XXX\.XXX\.XXX\.XXX$ #Adresse ip du serveur vers lequel le client doit envoyer ces donnees.

Configuration du cron du client :

Munin-node envoie les informations de la machine (état du processeur, mémoire, utilisation disque, réseau, mysql, mail....) toutes les 5 minutes via un cron. Il est possible de modifier ce delai en changeant la valeur :

dans le fichier /etc/cron.d/....

Lancement du client :

Pour relancer le client, tapez seulement :

/etc/init.d/munin-node restart

Redirection de ports sur les clients:

Il ne faut pas oublier de rediriger le port 4949 sur les protocoles UDP et TCP sur chacun des clients que vous inscrivez dans votre parc de machines. Ainsi chacun d'eux pourra envoyer ses informations au server sans difficultée.


Positionnement et Statistiques Gratuites Ajoutez votre site Top des sites