Raspberry/Munin : Installation d’un client SNMP pour Munin

Ma configuration ( admin est le nom de mon serveur QNAP, son IP est dans /etc/hosts ) :

Les étapes :

osmc@osmc:~$ sudo apt-get install libnet-snmp-perl

osmc@osmc:~$ sudo apt-get install nmap

osmc@osmc:~$ sudo munin-node-configure --shell --snmp admin --snmpversion 2 --snmpcommunity QNAP
ln -s '/usr/share/munin/plugins/snmp__df' '/etc/munin/plugins/snmp_admin_df'
ln -s '/usr/share/munin/plugins/snmp__df_ram' '/etc/munin/plugins/snmp_admin_df_ram'
ln -s '/usr/share/munin/plugins/snmp__if_' '/etc/munin/plugins/snmp_admin_if_1'
ln -s '/usr/share/munin/plugins/snmp__if_' '/etc/munin/plugins/snmp_admin_if_3'
ln -s '/usr/share/munin/plugins/snmp__if_err_' '/etc/munin/plugins/snmp_admin_if_err_1'
ln -s '/usr/share/munin/plugins/snmp__if_err_' '/etc/munin/plugins/snmp_admin_if_err_3'
ln -s '/usr/share/munin/plugins/snmp__if_multi' '/etc/munin/plugins/snmp_admin_if_multi'
ln -s '/usr/share/munin/plugins/snmp__memory' '/etc/munin/plugins/snmp_admin_memory'
ln -s '/usr/share/munin/plugins/snmp__netstat' '/etc/munin/plugins/snmp_admin_netstat'
ln -s '/usr/share/munin/plugins/snmp__processes' '/etc/munin/plugins/snmp_admin_processes'
ln -s '/usr/share/munin/plugins/snmp__swap' '/etc/munin/plugins/snmp_admin_swap'
ln -s '/usr/share/munin/plugins/snmp__uptime' '/etc/munin/plugins/snmp_admin_uptime'
ln -s '/usr/share/munin/plugins/snmp__users' '/etc/munin/plugins/snmp_admin_users'
ln -s '/usr/share/munin/plugins/snmp__winload' '/etc/munin/plugins/snmp_admin_winload'
ln -s '/usr/share/munin/plugins/snmp__winmem' '/etc/munin/plugins/snmp_admin_winmem'

osmc@osmc:~$ sudo munin-node-configure --shell --snmp admin --snmpversion 2 --snmpcommunity QNAP | sudo sh

osmc@osmc:~$ sudo systemctl restart munin-node

On peut tester manuellement via un telnet :

osmc@osmc:~$ telnet localhost 4949
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.
# munin node at osmc
list admin
snmp_admin_cpuload snmp_admin_df snmp_admin_df_ram snmp_admin_if_1 snmp_admin_if_3 snmp_admin_if_err_1 snmp_admin_if_err_3 snmp_admin_memory snmp_admin_netstat snmp_admin_processes snmp_admin_swap snmp_admin_uptime snmp_admin_users snmp_admin_winload snmp_admin_winmem

A noter que le QNAP ne fonctionne pas bien en version 3. Misère. Pour finir il faut modifier munin.conf et relance apache :

osmc@osmc:~$ sudo vi /etc/munin/munin.conf 
...
[admin]                                 
   address 127.0.0.1
   use_node_name no    
...
osmc@osmc:~$ sudo vi /etc/munin/plugin-conf.d/snmp_communities
[snmp_admin_*]
env.community QNAP

osmc@osmc:~$ sudo systemctl restart apache2

Pour verifier que cela fonctionne bien vous pouvez voir si les bases sont initialisées :

osmc@osmc:~$ tree /var/lib/munin/admin/
/var/lib/munin/admin/
├── admin-df_inode-_dev_mmcblk0p2-g.rrd
├── admin-df_inode-_dev_sda1-g.rrd
├── admin-df_inode-_dev_shm-g.rrd
├── admin-df_inode-devtmpfs-g.rrd
....

Le passage via SNMP augmente le temps de traitement de munin (+20 sec minimum …) :

Pour le mesurer :

osmc@osmc:~$ sudo su - munin --shell=/bin/bash
munin@osmc:~$ time munin-cron
real	1m29.225s
user	0m11.708s
sys	0m0.900s

Ensuite via l’interface on a :

Il faut noter le projet très intéressant : https://github.com/gpkvt/muninlite .

Muninlite for Qnap

At the moment there is no IPKG available to install Munin-Node on your QNAP-Device. Fortunately you can use muninlite (http://sourceforge.net/projects/muninlite/). Anyway muninlite doesn’t support QNAP-Devices very well, so I made some tweaks. You can either use the patch file and get muninlite directly from SourceForge, or you can use the complete Script from this repository. The Script is based on muninlite 1.0.4 (with all plugins enabled) and was tested on a QNAP TS-419 Pro.

Pour plus d’information sur le plugin : http://guide.munin-monitoring.org/en/latest/tutorial/snmp.html .

A suivre.

Laisser un commentaire

Votre adresse e-mail ne sera pas publiée. Les champs obligatoires sont indiqués avec *

Time limit is exhausted. Please reload CAPTCHA.