centos Munin MySQL插件出现未知图形错误

qyzbxkaa  于 2023-04-20  发布在  Mysql
关注(0)|答案(2)|浏览(177)

我在CentOS 7上安装了munin-node。用于监视系统资源的默认插件工作正常。我按照在线步骤启用了mysql_插件。但是,我遇到了以下错误:

> sudo munin-run --debug mysql_
# Skipping systemd properties simulation due to lack of permissions.
# Processing plugin configuration from /etc/munin/plugin-conf.d/00-default
# Processing plugin configuration from /etc/munin/plugin-conf.d/munin-node
# Processing plugin configuration from /etc/munin/plugin-conf.d/mysql
# Setting /rgid/ruid/ to /4257/498/
# Setting /egid/euid/ to /4257 4257/498/
# Setting up environment
# Environment mysqlpassword = password
# Environment mysqlconnection = DBI:mysql:information_schema;mysql_read_default_file=/etc/my.cnf
# Environment mysqluser = munin
# Environment mysqladmin = /usr/bin/mysqladmin
# About to run '/etc/munin/plugins/mysql_'
Unknown graph  at /etc/munin/plugins/mysql_ line 1805.

这似乎是插件代码本身的问题。有没有其他人遇到过类似的问题和/或有修复?

设置步骤

  1. $ sudo yum install munin-node
  2. $ sudo ln -s /usr/share/munin/plugins/mysql_ /etc/munin/plugins/mysql_
    1.使用以下命令创建/etc/munin.plugin-conf.d/mysql
[mysql*]
env.mysqlconnection DBI:mysql:information_schema;mysql_read_default_file=/etc/my.cnf
env.mysqluser munin
env.mysqlpassword munin

1.在MySQL中创建munin用户:

CREATE USER 'munin'@'localhost' IDENTIFIED BY 'munin';
GRANT PROCESS, SUPER ON *.* TO 'munin'@'localhost';
GRANT SELECT ON mysql.* TO 'munin'@'localhost';
FLUSH PRIVILEGES;
  1. $ sudo systemctl restart munin-node
lnxxn5zx

lnxxn5zx1#

munin-node安装附带的默认MySQL插件对我们不起作用(在原始帖子中提到的错误)。
相反,我们发现了这个替代插件,我们的工作:
https://github.com/kjellm/munin-mysql
由于CentOS 7使用systemd,您必须将Makefile中的$(MUNIN_NODE) restart行更改为systemctl restart munin-node
希望这能帮助其他可能遇到我们同样问题的人。

ubbxdtey

ubbxdtey2#

我在CentOS 7.7上使用munin 2时遇到了同样的问题。
mysql_和mysql_connection不工作,但mysql_connections工作得很好,我不知道为什么,但这些步骤使它为我工作。
步骤1:更改符号链接名称

mv /etc/munin/plugins/mysql_ /etc/munin/plugins/mysql_connections

步骤2:更新配置文件,在我的例子中,它是/etc/munin/plugin-conf.d/munin-node(路径取决于您的系统)

[mysql_*]
env.mysqluser your_user
env.mysqlpassword your_user_password
env.mysqlopts -u your_user --password=your_user_password # don't use -p 
env.mysqladmin /usr/local/mysql/bin/mysqladmin 
env.mysqlconnection DBI:mysql:db_name;host=127.0.0.1;mysql_read_default_file=/etc/my.cnf

步骤3:使用--debug选项进行测试

munin-run --debug mysql_connections

如果有任何错误,如
也许DBD::mysql perl模块还没有完全安装,
安装额外的软件包将修复它。

yum install perl-DBD-mysql

相关问题