Munin 和 mysql 插件

Munin 和 mysql 插件

我已经在 vps 上安装了 munin,并且我想要监控 3 个 mysql 服务器的 mysql 使用情况,我已配置 mysql_ 插件如下:

[mysql_*]
  env.mysqlconnection DBI:mysql:mysql;host=mysql1.neocrafters.com;port=3306
  env.mysqluser status
  env.mysqlpassword statusUserPass
  env.cachenamespace munin_mysql_pri
  env.mysqladmin /usr/bin/mysqladmin

[mysql2_*]
  env.mysqlconnection DBI:mysql:mysql;host=mysql2.example.com;port=3306
  env.mysqluser status
  env.mysqlpassword statusUserPass
  env.cachenamespace munin_mysql_alt1
  env.mysqladmin /usr/bin/mysqladmin

[mysql3_*]
  env.mysqlconnection DBI:mysql:mysql;host=mysql3.example.com;port=3306
  env.mysqluser status
  env.mysqlpassword statusUserPass
  env.cachenamespace munin_mysql_alt2
  env.mysqladmin /usr/bin/mysqladmin

命令munin-node-configure --suggest | grep mysql显示:

mysql_  | yes  | yes (+bin_relay_log +commands +connections +files_tables +innodb_bpool +innodb_bpool_act +innodb_insert_buf +innodb_io +innodb_io_pend +innodb_log +innodb_rows +innodb_semaphores +innodb_tnx +myisam_indexes +network_traffic +qcache +qcache_mem +replication +select_types +slow +sorts +table_locks +tmp_tables)

Munin 在面板上创建图表: 图表

但正如您所见,图表是空的,并且无法正确更新,最后更新显示 7 星期一 22:40:06,而其他图表的最后更新时间为 8 星期二 00:10:09

如果我执行以下命令:

munin-run --debug mysql_

我得到:

# Processing plugin configuration from /etc/munin/plugin-conf.d/amavis
# Processing plugin configuration from /etc/munin/plugin-conf.d/df
# Processing plugin configuration from /etc/munin/plugin-conf.d/fw_
# Processing plugin configuration from /etc/munin/plugin-conf.d/hddtemp_smartctl
# Processing plugin configuration from /etc/munin/plugin-conf.d/munin-node
# Processing plugin configuration from /etc/munin/plugin-conf.d/postfix
# Processing plugin configuration from /etc/munin/plugin-conf.d/sendmail
# Setting /rgid/ruid/ to /99/99/
# Setting /egid/euid/ to /99 99/99/
# Setting up environment
# Environment cachenamespace = munin_mysql_pri
# Environment mysqlpassword = statusUserPass
# Environment mysqlconnection = DBI:mysql:mysql;host=mysql1.example.com;port=3306
# Environment mysqluser = status
# Environment mysqladmin = /usr/bin/mysqladmin
# About to run '/etc/munin/plugins/mysql_'
Unknown graph  at /etc/munin/plugins/mysql_ line 874.

这是文件 mysql_ 第 874 行的内容:

sub show {
my $graph_name = shift;

die 'Unknown graph ' . ($graph_name ? $graph_name : '')
unless $graphs{$graph_name};

my $graph = $graphs{$graph_name};

update_data();

die "Can't show data for '$graph_name' because InnoDB is disabled."
if $graph_name =~ /innodb_/ && $data->{_innodb_disabled};

for my $ds (@{$graph->{data_sources}}) {
printf "%s.value %s\n",
    clean_fieldname($ds->{name}), $data->{$ds->{name}};
}

return 0;

}

我不知道问题是什么,你能帮帮我吗?

答案1

尝试不但... mysql_要准确插件名称:

# munin-run --debug mysql_connections

# Processing plugin configuration from /etc/munin/plugin-conf.d/munin-node
# Setting /rgid/ruid/ to /99/99/
# Setting /egid/euid/ to /99 99/99/
# Setting up environment
# Environment mysqlpassword = SuperPass
# Environment mysqlconnection = DBI:mysql:mysql;host=127.0.0.1;port=3306
# About to run '/etc/munin/plugins/mysql_connections'
max_connections.value 151
Max_used_connections.value 6
Aborted_clients.value 0
Aborted_connects.value 16
Threads_connected.value 1
Connections.value 778

相关内容