MuninのMariaDB(またはMySQL)監視が「returned no data」となりグラフが生成されない場合の対処方法です。githubよりMuninのプラグイン「mysql_」を取得して設定します。(2018/09/01作成)
Capri23auto / Pixabay
0)環境
$ cat /etc/redhat-release CentOS Linux release 7.5.1804 (Core) $ mysql --version mysql Ver 15.1 Distrib 10.1.35-MariaDB, for Linux (x86_64) using readline 5.1 $ munin-node --version | head -n 2 Version: This is munin-node v2.0.33
《事象》
$ sudo tail -f /var/log/munin/munin-update.log | grep 'no data' … 2018/08/28 13:15:16 [WARNING] Service mysql_commands on XXXXXXXX/xxx.xxx.x.xxx:4949 returned no data for label Com_select 2018/08/28 13:15:16 [WARNING] Service mysql_commands on XXXXXXXX/xxx.xxx.x.xxx:4949 returned no data for label Com_delete 2018/08/28 13:15:16 [WARNING] Service mysql_commands on XXXXXXXX/xxx.xxx.x.xxx:4949 returned no data for label Com_insert …
1)Muninコンフィグ設定
$ sudo vi /etc/munin/plugin-conf.d/munin-node [mysql*] env.mysqladmin /usr/bin/mysqladmin env.mysqlopts -u munin --password=password env.mysqlconnection DBI:mysql:mysql;host=127.0.0.1;port=3306 env.mysqluser munin env.mysqlpassword password
2)MariaDB ユーザー作成
GRANT PROCESS, REPLICATION CLIENT ON *.* TO 'munin'@'localhost' IDENTIFIED BY 'password'; GRANT SELECT ON mysql.* TO 'munin'@'localhost'; FLUSH PRIVILEGES;
3)DBIモジュールとMySQLのDBDモジュールをインストール
$ sudo yum install perl-DBI perl-DBD-MySQL
4)githubよりMuninのプラグイン「mysql_」を取得
https://github.com/munin-monitoring/munin/tree/master/plugins/node.d
$ cd /usr/share/munin/plugins $ sudo mv mysql_ mysql_.BAK $ sudo wget https://github.com/munin-monitoring/munin/raw/master/plugins/node.d/mysql_ $ sudo chmod 755 mysql_
5)MuninのMySQLプラグインをワンライナーで全て有効化
$ sudo rm -rf /etc/munin/plugins/mysql_* $ /usr/share/munin/plugins/mysql_ suggest | sudo xargs -i ln -s /usr/share/munin/plugins/mysql_ /etc/munin/plugins/mysql_{}
6)munin-node再起動
$ sudo systemctl restart munin-node.service
以上