This shows you the differences between two versions of the page.
Next revision | Previous revision | ||
munin [2020/08/03 14:17] willy created |
munin [2020/08/07 10:35] willy improvements |
||
---|---|---|---|
Line 10: | Line 10: | ||
- | ==== Configuration côté client === | + | ====== Configuration côté serveur à monitorer ====== |
* Installer les paquets: | * Installer les paquets: | ||
Line 25: | Line 25: | ||
''munin-node-configure --suggest'' | ''munin-node-configure --suggest'' | ||
- | === Monitoring bind9 === | + | ===== Monitoring bind9 ===== |
Pour un serveur disposant de bind9, il faut en plus effectuer les actions suivantes. | Pour un serveur disposant de bind9, il faut en plus effectuer les actions suivantes. | ||
Line 31: | Line 31: | ||
Ajouter le fichier ''/etc/munin/plugin-conf.d/99-bind'' avec le contenu suivant: | Ajouter le fichier ''/etc/munin/plugin-conf.d/99-bind'' avec le contenu suivant: | ||
<code> | <code> | ||
+ | [bind9] | ||
+ | env.logfile /var/log/named/query.log | ||
+ | |||
[bind9_rndc] | [bind9_rndc] | ||
user root | user root | ||
- | env.querystats /var/log/bind9/named.stats | + | env.querystats /var/log/named/named.stats |
</code> | </code> | ||
- | Créer le dossier /var/log/bind9 | + | Créer le dossier /var/log/named |
<code bash> | <code bash> | ||
- | mkdir /var/log/bind9 | + | mkdir /var/log/named |
- | chown bind:bind /var/log/bind9 | + | chown bind:bind /var/log/named |
</code> | </code> | ||
- | Demander la permission à AppArmor. En gros il s'agit de modifier deux fichiers comme indiqué dans le diff: | + | :!: Sur debian (10), il existe déjà un profil apparmor qui prend en compte le dossier ''/var/log/named'' |
- | * /etc/apparmor.d/usr.sbin.named | + | |
- | * /etc/apparmor.d/local/usr.sbin.named | + | |
- | <code diff [enable_line_numbers="true"]> | + | |
- | root@vps2:/etc# git diff 135f HEAD apparmor.d/usr.sbin.named | + | |
- | diff --git a/apparmor.d/usr.sbin.named b/apparmor.d/usr.sbin.named | + | |
- | index a4622da..b11451e 100644 | + | |
- | --- a/apparmor.d/usr.sbin.named | + | |
- | +++ b/apparmor.d/usr.sbin.named | + | |
- | @@ -90,5 +90,5 @@ | + | |
- | owner /var/tmp/krb5_* rwk, | + | |
- | + | ||
- | # Site-specific additions and overrides. See local/README for details. | + | |
- | - #include <local/usr.sbin.named> | + | |
- | + include <local/usr.sbin.named> | + | |
- | } | + | |
- | root@vps2:/etc# git diff 135f HEAD apparmor.d/local/usr.sbin.named | + | |
- | diff --git a/apparmor.d/local/usr.sbin.named b/apparmor.d/local/usr.sbin.named | + | |
- | index e69de29..dc0c2fd 100644 | + | |
- | --- a/apparmor.d/local/usr.sbin.named | + | |
- | +++ b/apparmor.d/local/usr.sbin.named | + | |
- | @@ -0,0 +1 @@ | + | |
- | + /var/log/bind9/** rwk, | + | |
- | + | ||
- | </code> | + | |
- | + | ||
- | Oui, je sais, c'est overkill 8-) . Tout ça pour deux lignes (lignes 11 et 19). | + | |
- | Redémarrer apparmor | ||
- | <code bash> | ||
- | systemctl restart apparmor | ||
- | </code> | ||
- | |||
- | * | ||
Mettre a jour le fichier ''/etc/bind/named.conf.options'' | Mettre a jour le fichier ''/etc/bind/named.conf.options'' | ||
<code diff [enable_line_numbers="true"]> | <code diff [enable_line_numbers="true"]> | ||
Line 86: | Line 57: | ||
listen-on-v6 { any; }; | listen-on-v6 { any; }; | ||
- | + statistics-file "/var/log/bind9/named.stats"; | + | + statistics-file "/var/log/named/named.stats"; |
+}; | +}; | ||
+ | + | ||
+logging { | +logging { | ||
+ channel b_log { | + channel b_log { | ||
- | + file "/var/log/bind9/bind.log" versions 30 size 1m; | + | + file "/var/log/named/bind.log" versions 30 size 1m; |
+ print-category yes; | + print-category yes; | ||
+ print-severity yes; | + print-severity yes; | ||
Line 99: | Line 70: | ||
+ | + | ||
+ channel b_debug { | + channel b_debug { | ||
- | + file "/var/log/bind9/debug.log" versions 2 size 1m; | + | + file "/var/log/named/debug.log" versions 2 size 1m; |
+ print-category yes; | + print-category yes; | ||
+ print-severity yes; | + print-severity yes; | ||
Line 107: | Line 78: | ||
+ | + | ||
+ channel b_query { | + channel b_query { | ||
- | + file "/var/log/bind9/query.log"; | + | + file "/var/log/named/query.log"; |
+ print-severity yes; | + print-severity yes; | ||
+ print-time yes; | + print-time yes; | ||
Line 129: | Line 100: | ||
Ajouter le fichier ''/etc/logrotate.d/bind'' avec le contenu suivant. | Ajouter le fichier ''/etc/logrotate.d/bind'' avec le contenu suivant. | ||
- | <code> | + | <code bash [enable_line_numbers="true"]> |
- | /var/log/bind9/query.log | + | /var/log/named/query.log |
- | /var/log/bind9/named.stats | + | /var/log/named/named.stats |
{ | { | ||
Line 144: | Line 115: | ||
</code> | </code> | ||
+ | Bien sur tout cela est ajustable en fonction de votre environnement notamment les lignes 5 et 6 | ||
- | ==== Configuration côté serveur === | + | ==== Aperçu ==== |
+ | |||
+ | DNS queries by status | ||
+ | |||
+ | {{ ::screenshot_2020-08-03_at_18.24.10.png?direct&400 |}} | ||
+ | |||
+ | DNS queries by type | ||
+ | |||
+ | {{ :screenshot_2020-08-03_at_18.24.33.png?direct&400 |}} | ||
+ | |||
+ | |||
+ | ====== Configuration côté serveur monitoring ====== | ||
* Installer les paquets: | * Installer les paquets: | ||
* munin-node | * munin-node | ||
- | * Créer une configuration locale dans /etc/munin/munin-conf.d/cmnog-node.conf . Le plus important étant que le fichier dans ce repertoire se termine par .conf. | + | * Créer une configuration locale dans ''/etc/munin/munin-conf.d/cmnog-node.conf'' . Le plus important étant que le fichier dans ce repertoire se termine par .conf. Il faut rajouter autant d'entrées qu'il faut par serveur |
Ex: | Ex: | ||
Line 164: | Line 147: | ||
</code> | </code> | ||
+ | ===== Visualisation ===== | ||
+ | |||
+ | En fonction du serveur web installé, il faudra ajuster la configuration de votre environnement web. | ||
+ | |||
+ | Si c'est //apache2//, la configuration par défaut de munin, permet de consulter la page de monitoring à l'adresse **http://nom.de.mon.serveur.web/munin** . | ||
+ | Des précisions se trouvent dans ''/etc/apache2/conf-enabled/munin.conf'' | ||
+ | <code apache [enable_line_numbers="true"]> | ||
+ | # 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/cache/munin/www/static/ | ||
+ | |||
+ | <Directory /var/cache/munin/www> | ||
+ | Require all granted | ||
+ | Options None | ||
+ | Order Allow,Deny | ||
+ | Allow from all | ||
+ | </Directory> | ||
+ | |||
+ | <Directory /usr/lib/munin/cgi> | ||
+ | Require local | ||
+ | <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/cache/munin/www | ||
+ | # html_strategy: cgi (requires the apache module "cgid" or "fcgid") | ||
+ | #ScriptAlias /munin /usr/lib/munin/cgi/munin-cgi-html | ||
+ | </code> | ||
+ | |||
+ | La directive à la ligne 20 permet d'autoriser tout ou des préfixes IPv4/IPv6 précis. | ||
+ | |||
+ | <code apache> | ||
+ | Allow from 10.112.0.0/13 2001:db8:cafe::/48 | ||
+ | </code> | ||
+ | |||
+ | Et voilà 8-) |