Munin

From Anthony Pastor Wiki Notes - Verba volant, scripta manent
Jump to navigation Jump to search

MySQL plugins configuration

vi /etc/munin/plugin-conf.d/munin-node
[mysql*]
user root
env.mysqlopts --defaults-file=/etc/mysql/debian.cnf
env.mysqluser debian-sys-maint
env.mysqlconnection DBI:mysql:mysql;mysql_read_default_file=/etc/mysql/debian.cnf
  • If this user doesn't exist:
GRANT ALL PRIVILEGES on *.* TO 'debian-sys-maint'@'localhost' IDENTIFIED BY 'exampleeeee' WITH GRANT OPTION;
  • If this user exist but we have to update the password:
UPDATE user SET Password=PASSWORD('exampleeeee') WHERE User='debian-sys-maint';
  • Edit /etc/mysql/debian.cnf:
# Automatically generated for Debian scripts. DO NOT TOUCH!
[client]
host     = localhost
user     = debian-sys-maint
password = exampleeeee
socket   = /var/run/mysqld/mysqld.sock
[mysql_upgrade]
host     = localhost
user     = debian-sys-maint
password = exampleeeee
socket   = /var/run/mysqld/mysqld.sock
basedir  = /usr
  • You have to symlink plugins you want to be graphed:
ln -s /usr/share/munin/plugins/mysql_ /etc/munin/plugins/mysql_bin_relay_log
ln -s /usr/share/munin/plugins/mysql_ /etc/munin/plugins/mysql_commands
ln -s /usr/share/munin/plugins/mysql_ /etc/munin/plugins/mysql_connections
ln -s /usr/share/munin/plugins/mysql_ /etc/munin/plugins/mysql_files_tables
ln -s /usr/share/munin/plugins/mysql_ /etc/munin/plugins/mysql_innodb_bpool
ln -s /usr/share/munin/plugins/mysql_ /etc/munin/plugins/mysql_innodb_bpool_act
ln -s /usr/share/munin/plugins/mysql_ /etc/munin/plugins/mysql_innodb_insert_buf
ln -s /usr/share/munin/plugins/mysql_ /etc/munin/plugins/mysql_innodb_io
ln -s /usr/share/munin/plugins/mysql_ /etc/munin/plugins/mysql_innodb_io_pend
ln -s /usr/share/munin/plugins/mysql_ /etc/munin/plugins/mysql_innodb_log
ln -s /usr/share/munin/plugins/mysql_ /etc/munin/plugins/mysql_innodb_rows
ln -s /usr/share/munin/plugins/mysql_ /etc/munin/plugins/mysql_innodb_semaphores
ln -s /usr/share/munin/plugins/mysql_ /etc/munin/plugins/mysql_innodb_tnx
ln -s /usr/share/munin/plugins/mysql_ /etc/munin/plugins/mysql_myisam_indexes
ln -s /usr/share/munin/plugins/mysql_ /etc/munin/plugins/mysql_network_traffic
ln -s /usr/share/munin/plugins/mysql_ /etc/munin/plugins/mysql_qcache
ln -s /usr/share/munin/plugins/mysql_ /etc/munin/plugins/mysql_qcache_mem
ln -s /usr/share/munin/plugins/mysql_ /etc/munin/plugins/mysql_replication
ln -s /usr/share/munin/plugins/mysql_ /etc/munin/plugins/mysql_select_types
ln -s /usr/share/munin/plugins/mysql_ /etc/munin/plugins/mysql_slow
ln -s /usr/share/munin/plugins/mysql_ /etc/munin/plugins/mysql_sorts
ln -s /usr/share/munin/plugins/mysql_ /etc/munin/plugins/mysql_table_locks
ln -s /usr/share/munin/plugins/mysql_ /etc/munin/plugins/mysql_tmp_tables
  • Debian / Ubuntu requirements:
aptitude update
aptitude install make gcc libcache-{perl,cache-perl} libmysqlclient-dev liblz-dev zlib1g-dev libgz-devel liblz-dev 

cpan Module::Pluggable
cpan DBI
cpan DBD::mysql
  • If you get an error, you could enventually force install:
$ cpan
force install DBD::mysql
  • I got this issue during the installation, here's the resolution:
DBI connect('mysql;mysql_connect_timeout=5','root',...) failed: Access denied for user 'root'@'localhost' (using password: NO) at ./mysql_replication line 903

You have replace in this file /usr/share/munin/plugins/mysql_ :

    my %section_map = (
[[User:Anthoanthop|Anthoanthop]] ([[User talk:Anthoanthop|talk]]) 17:14, 5 May 2015 (CEST)
        'BACKGROUND THREAD'        => \&skip,
    );

With:

    my %section_map = (
~~~~
        'BACKGROUND THREAD'        => \&skip,
        'INDIVIDUAL BUFFER POOL INFO'   => \&skip, 
    );
  • If needed, here's the mysql_ file:

munin_mysql_

Debugging

su - munin --shell=/bin/bash

/usr/share/munin/munin-update --nofork --debug