Création — Nicolas THOREZ 2020/02/21 14:23
munin collecte et analyse les ressources utilisées par les serveurs qu'il surveille. Dans le cadre du MCO, l'outil permet à l'administrateur de connaître l'état précis des ressources d'un serveur et leurs évolutions dans le temps.
root. Faîtes donc attention à ce que vous faîtes.munin nécessite un serveur apache2 correctement configuré. Pour cela, on met à jour les dépôts APT :
apt-get update
apt-get install -y apache2 libcgi-fast-perl libapache2-mod-fcgid libwww-perl
apache2 :
a2enmod fcgid
APT à jour :
apt-get update
apt-get install -y munin
munin :
nano /etc/munin/munin.conf
dbdir.htmldir et on modifie sa valeur par /var/www/munin.logdir.rundir.tmpldir.CTRL+W la section a simple host tree) :[] et on la remplace par le FQDN du serveur munin.CTRL+O et on quitte avec CTRL+X.munin :
mkdir -p /var/www/munin
chown munin:munin /var/www/munin
/etc/munin/apache24.conf dans le dossier /etc/apache2/conf-available/ :
cd /etc/apache2/conf-available/ ln -s /etc/munin/apache24.conf ./munin.conf
nano /etc/apache2/conf-available/munin.conf
# Munin configuration for apache2
#
# Apache can serve munin's files that are either statically generated
# (in a cron job) or generated on demand (via cgi).
# The relevant munin settings are "html_strategy" and "graph_strategy".
# The related apache settings can be adjusted at the end of this file.
#
# See /usr/share/doc/munin/README.Debian for details.
# ***** COMMON SETTINGS FOR ALL STRATEGIES *****
ScriptAlias /munin-cgi/munin-cgi-graph /usr/lib/munin/cgi/munin-cgi-graph
Alias /munin/static/ /var/www/munin/static/
<Directory /var/www/munin>
Require all granted
Options FollowSymLinks SymLinksIfOwnerMatch
</Directory>
<Directory /usr/lib/munin/cgi>
Require all granted
Options FollowSymLinks SymLinksIfOwnerMatch
<IfModule mod_fcgid.c>
SetHandler fcgid-script
</IfModule>
<IfModule !mod_fcgid.c>
SetHandler cgi-script
</IfModule>
</Directory>
# ***** SETTINGS FOR CGI/CRON STRATEGIES *****
# pick _one_ of the following lines depending on your "html_strategy"
# html_strategy: cron (default)
Alias /munin /var/www/munin
# html_strategy: cgi (requires the apache module "cgid" or "fcgid")
#ScriptAlias /munin /usr/lib/munin/cgi/munin-cgi-html
/etc/cron.d/munin pour remplacer /var/cache/munin/www par /var/www/munin.
systemctl restart munin.service systemctl restart munin-node.service systemctl restart apache2.service
munin via l'adresse http://ip_du_serveur_munin/munin.
Dans le cas où munin devrait être accessible sur Internet et du fait des données sensibles qu'il présente, on peut rajouter une demande de mot de passe pour accéder au site. Pour cela :
/etc/apache2/conf-available/munin.conf pour ajouter la directive AllowOverride all. Le fichier ressemble du coup à ça :
# Munin configuration for apache2
#
# Apache can serve munin's files that are either statically generated
# (in a cron job) or generated on demand (via cgi).
# The relevant munin settings are "html_strategy" and "graph_strategy".
# The related apache settings can be adjusted at the end of this file.
#
# See /usr/share/doc/munin/README.Debian for details.
# ***** COMMON SETTINGS FOR ALL STRATEGIES *****
ScriptAlias /munin-cgi/munin-cgi-graph /usr/lib/munin/cgi/munin-cgi-graph
Alias /munin/static/ /var/www/munin/static/
<Directory /var/www/munin>
AllowOverride all
Require all granted
Options FollowSymLinks SymLinksIfOwnerMatch
</Directory>
<Directory /usr/lib/munin/cgi>
Require all granted
Options FollowSymLinks SymLinksIfOwnerMatch
<IfModule mod_fcgid.c>
SetHandler fcgid-script
</IfModule>
<IfModule !mod_fcgid.c>
SetHandler cgi-script
</IfModule>
</Directory>
# ***** SETTINGS FOR CGI/CRON STRATEGIES *****
# pick _one_ of the following lines depending on your "html_strategy"
# html_strategy: cron (default)
Alias /munin /var/www/munin
# html_strategy: cgi (requires the apache module "cgid" or "fcgid")
#ScriptAlias /munin /usr/lib/munin/cgi/munin-cgi-html
/var/www/munin/.htaccess :
nano /var/www/munin/.htaccess
AuthType Basic AuthName "Members Only" AuthUserFile /var/www/munin/htpasswd.users <limit GET PUT POST> require valid-user </limit>
chown www-data:www-data /var/www/munin/.htaccess chmod 400 /var/www/munin/.htaccess
htpasswd -c /var/www/munin/htpasswd.users muninadmin
muninadmin.apache2 :
service apache2 restart
munin est désormais protégé par un mot de passe.APT :
apt-get update
apt-get install -y munin-node munin-plugins-extra
munin-node-configure --suggest
/usr/share/munin/plugins/ et le dossier actif /etc/munin/plugins/. Par exemple, pour le plugin acpi :
cd /etc/munin/plugins/ ln -s /usr/share/munin/plugins/acpi .
munin-node-configure --suggest --shell | sh
/etc/munin/munin-node.conf :
nano /etc/munin/munin-node.conf
regex). Par exemple, pour un serveur dont l'adresse IP est 192.168.20.54, la ligne à ajouter sera :
allow ^192\.168\.20\.54$
service munin-node restart
/etc/munin/munin-conf.d :
cd /etc/munin/munin-conf.d
MySQL, on créera donc le fichier bdd.conf :
touch bdd.conf
nano bdd.conf
srv-mysql, dans le groupe bdd et dont l'adresse IP est 192.168.20.55, on ajoutera :
[srv-mysql.bdd] address 192.168.20.55 use_node_name yes
systemctl restart apache2.service
munin collecte les données toutes les 5 min par défaut. C'est le temps qu'il vous faudra attendre pour voir apparaître le nouveau client sur la page web.
Add-WindowsCapability -Online -Name "SNMP.Client~~~~0.0.1.0"
services.msc et on édite Service SNMP.Agent, Interruptions et/ou Sécurité n'apparaissent pas, redémarrer le service, voire le client Windows.Agent, on coche tous les services.Interruptions, on ajoute public au nom de la communauté et on ajoute l'adresse du serveur Munin dans les destinations des interruptions.Sécurité, on ajoute la communauté public en mode LECTURE CREATION et on active Accepter les paquets SNMP provenant de n'importe quel hôte.OK et on redémarre le service.
apt update && apt install -y libnet-snmp-perl
windows.shyrka.sys dans l'exemple) :/etc/hosts.
munin-node-configure -snmp windows.shyrka.sys
Plugin | Used | Suggestions ------ | ---- | ----------- snmp__cpuload | no | yes (+windows.shyrka.sys) snmp__df | no | yes (+windows.shyrka.sys) snmp__df_ram | no | yes (+windows.shyrka.sys) snmp__fc_if_ | no | no [[[ plugin has neither autoconf not suggest support ]]] snmp__fc_if_err_ | no | no [[[ plugin has neither autoconf not suggest support ]]] snmp__if_ | no | yes (+windows.shyrka.sys/22 +windows.shyrka.sys/25) snmp__if_err_ | no | yes (+windows.shyrka.sys/22 +windows.shyrka.sys/25) snmp__if_multi | no | yes (+windows.shyrka.sys) snmp__load | no | no [[[ plugin has neither autoconf not suggest support ]]] snmp__memory | no | yes (+windows.shyrka.sys) snmp__netapp_diskusage_ | no | no [[[ plugin has neither autoconf not suggest support ]]] snmp__netapp_inodeusage_ | no | no [[[ plugin has neither autoconf not suggest support ]]] snmp__netstat | no | yes (+windows.shyrka.sys) snmp__print_pages | no | no [[[ plugin has neither autoconf not suggest support ]]] snmp__print_supplies | no | no [[[ plugin has neither autoconf not suggest support ]]] snmp__processes | no | yes (+windows.shyrka.sys) snmp__rdp_users | no | yes (+windows.shyrka.sys) snmp__sensors_fsc_bx_fan | no | no [[[ plugin has neither autoconf not suggest support ]]] snmp__sensors_fsc_bx_temp | no | no [[[ plugin has neither autoconf not suggest support ]]] snmp__sensors_fsc_fan | no | no [[[ plugin has neither autoconf not suggest support ]]] snmp__sensors_fsc_temp | no | no [[[ plugin has neither autoconf not suggest support ]]] snmp__sensors_mbm_fan | no | no [[[ plugin has neither autoconf not suggest support ]]] snmp__sensors_mbm_temp | no | no [[[ plugin has neither autoconf not suggest support ]]] snmp__sensors_mbm_volt | no | no [[[ plugin has neither autoconf not suggest support ]]] snmp__swap | no | yes (+windows.shyrka.sys) snmp__uptime | no | yes (+windows.shyrka.sys) snmp__users | no | yes (+windows.shyrka.sys) snmp__winload | no | yes (+windows.shyrka.sys) snmp__winmem | no | yes (+windows.shyrka.sys)
Suggestions, les modules pour lequels des données sont disponibles apparaissent avec la mention yes. Pour activer un module, il suffit de créer un lien du module choisi en y ajouter le nom (pour ceux qui porte la mention +windows.shyrka.sys) et l'indice (pour ceux qui portent la mention +windows.shyrka.sys/xx). Par exemple, pour snmp_cpuload :
ln -s /usr/share/munin/plugins/snmp__cpuload /etc/munin/plugins/snmp_windows.shyrka.sys_cpuload
snmp_if_ :
ln -s /usr/share/munin/plugins/snmp__if_ /etc/munin/plugins/snmp_windows.shyrka.sys_if_22 ln -s /usr/share/munin/plugins/snmp__if_ /etc/munin/plugins/snmp_windows.shyrka.sys_if_25
windwos.shyrka.sys et non celui de la machine portant le node, à savoir le serveur Munin). Ce qui donne :
[windows.shyrka.sys] address 127.0.0.1 use_node_name no
munin-node et apache2 :
service munin-node restart service apache2 restart
/dev/null :
ls -l /lib/systemd/system/munin.service # Retour lrwxrwxrwx 1 root root 9 mars 3 2017 munin.service -> /dev/null
rm -f /lib/systemd/system/munin.service
systemctl daemon-reload
systemctl status munin.service
# Retour correct :
● munin.service - LSB: Create /var/run/munin on boot
Loaded: loaded (/etc/init.d/munin; generated; vendor preset: enabled)
Active: inactive (dead)
Docs: man:systemd-sysv-generator(8)
systemctl start munin.service
systemctl status munin.service
# Retour
● munin.service - LSB: Create /var/run/munin on boot
Loaded: loaded (/etc/init.d/munin; generated; vendor preset: enabled)
Active: active (exited) since Mon 2020-04-06 10:29:03 CEST; 6s ago
Docs: man:systemd-sysv-generator(8)
Process: 6678 ExecStart=/etc/init.d/munin start (code=exited, status=0/SUCCESS)
avril 06 10:29:03 mlb-monitor-2 systemd[1]: Starting LSB: Create /var/run/munin on boot...
avril 06 10:29:03 mlb-monitor-2 systemd[1]: Started LSB: Create /var/run/munin on boot.