Mysql 监控6

2022-06-30 00:18:37 浏览数 (1)

添加模板

配置 Zabbix Server

  • Grab the latest tarball from the Percona Software Downloads directory to your desktop.
  • Unpack it to get zabbix/templates/ folder.
  • Import the XML template using Zabbix UI (Configuration -> Templates -> Import) by additionally choosing “Screens”.
  • Create/edit hosts by assigning them “Percona Templates” group and linking the template “Percona MySQL Server Template” (Templates tab).

上面一段直接摘抄于官方文档,因为写得已经很具体了


总结

  • 安装插件包 percona-zabbix-templates
  • 拷贝配置 userparameter_percona_mysql.conf
  • 配置密码 ss_get_mysql_stats.php.cnf
  • 安装依赖包 php php-mysql
  • zabbix 赋权
  • zabbix-server 进行连接测试
  • 添加模板

命令汇总

  • mysql -V
  • cp /var/lib/zabbix/percona/templates/userparameter_percona_mysql.conf /etc/zabbix/zabbix_agentd.d/
  • cat /var/lib/zabbix/percona/scripts/ss_get_mysql_stats.php.cnf
  • /var/lib/zabbix/percona/scripts/get_mysql_stats_wrapper.sh gg
  • yum install php php-mysql
  • cat /tmp/localhost-mysql_cacti_stats.txt
  • cat /var/lib/zabbix/percona/scripts/get_mysql_stats_wrapper.sh
  • sudo -u zabbix -H /var/lib/zabbix/percona/scripts/get_mysql_stats_wrapper.sh running-slave
  • sudo -u zabbix -H /var/lib/zabbix/percona/scripts/get_mysql_stats_wrapper.sh gg
  • chown zabbix.zabbix /tmp/localhost-mysql_cacti_stats.txt
  • mkdir /home/zabbix
  • cp /etc/skel/.* /home/zabbix/
  • chown -R zabbix.zabbix /home/zabbix/
  • vim .my.cnf
  • zabbix_get -s mysql-server -p 10050 -k "MySQL.running-slave"
  • zabbix_get -s mysql-server -p 10050 -k "MySQL.Threads-connected"
  • zabbix_get -s mysql-server -p 10050 -k "MySQL.max-connections"

原文地址

0 人点赞