网创优客建站品牌官网
为成都网站建设公司企业提供高品质网站建设
热线:028-86922220
成都专业网站建设公司

定制建站费用3500元

符合中小企业对网站设计、功能常规化式的企业展示型网站建设

成都品牌网站建设

品牌网站建设费用6000元

本套餐主要针对企业品牌型网站、中高端设计、前端互动体验...

成都商城网站建设

商城网站建设费用8000元

商城网站建设因基本功能的需求不同费用上面也有很大的差别...

成都微信网站建设

手机微信网站建站3000元

手机微信网站开发、微信官网、微信商城网站...

建站知识

当前位置:首页 > 建站知识

zabbix监控MySQL详解

注意事项:

创新互联网站设计,为客户量身定制各类网站建设业务,包括企业型、电子商务型、成都响应式网站建设公司、行业门户型等各类网站,实战经验丰富,成功案例众多。以客户利益为出发点,创新互联网站制作为客户规划、定制网站制作符合企业需求、带有营销价值的网络建站方案认真对待每一个客户,我们不用口头的语言来吹擂我们的优秀,上千多家的成功案例见证着我们的成长。

实验环境

CentOS Linux release 7.0.1406 (Core)

[root@localhost scripts]# MySQL -v

Welcome to the MariaDB monitor.  Commands end with ; or \g.

Your MariaDB connection id is 10683

Server version: 5.5.52-MariaDB MariaDB Server

因为我是在一台服务器上做的,需要如下:

zabbix_agentd httpd mysqld zabbix_server 

1、使用percona监控插件监控MySQL

[root@localhost alertscripts]# yum install http://www.percona.com/downloads/percona-release/redhat/0.1-4/percona-release-0.1-4.noarch.rpm

2、percona组成部分

  • PHP脚本

  • shell脚本去调用PHP脚本

  • zabbix配置文件

  • zabbix模板文件

3、安装percona-zabbix模板 PHP PHP-MySQL

[root@localhost alertscripts]# yum install percona-zabbix-templates php php-mysql

4、查看具体安装了什么软件

[root@localhost alertscripts]# rpm -qa php

[root@localhost scripts]# rpm -ql percona-zabbix-templates

/var/lib/zabbix/percona

/var/lib/zabbix/percona/scripts

/var/lib/zabbix/percona/scripts/get_mysql_stats_wrapper.sh

/var/lib/zabbix/percona/scripts/ss_get_mysql_stats.php

/var/lib/zabbix/percona/templates

/var/lib/zabbix/percona/templates/userparameter_percona_mysql.conf

/var/lib/zabbix/percona/templates/zabbix_agent_template_percona_mysql_server_ht_2.0.9-sver1.1.7.xml

[root@localhost scripts]# 

5、导入模板

/var/lib/zabbix/percona/templates/zabbix_agent_template_percona_mysql_server_ht_2.0.9-sver1.1.7.xml

zabbix监控MySQL详解

6、拷贝配置文件

[root@localhost alertscripts]# cp /var/lib/zabbix/percona/templates/userparameter_percona_mysql.conf /etc/zabbix/zabbix_agentd.d/

7、脚本存放位置

[root@localhost scripts]# pwd

/var/lib/zabbix/percona/scripts

8、重启服务

[root@localhost scripts]# systemctl restart zabbix-agent

9、创建一个配置文件,内容,用户名,密码。

<注意:生产环境中,需要创建一个监控用户>

[root@localhost scripts]# vim ss_get_mysql_stats.php.cnf

[root@localhost scripts]# cat ss_get_mysql_stats.php.cnf

$mysql_user = 'root';

$mysql_pass = 's3cret';(我这里root密码为空,因为没有设置)

9、打开配置文件查看监控的内容,根据需要获取相应的参数

zabbix监控MySQL详解

10、执行下脚本

[root@localhost scripts]# ./get_mysql_stats_wrapper.sh

获得的指标

[root@localhost scripts]# ./get_mysql_stats_wrapper.sh

7

4

4

4

2746

273953

1

20

0

0

8191

6663

1507

26

0

1507

11、脚本中有点小BUG

zabbix监控MySQL详解

11、配置主机添加模板,用惯了英文换会英文界面

zabbix监控MySQL详解

然后查看图形连接数

zabbix监控MySQL详解


网站名称:zabbix监控MySQL详解
文章路径:http://bjjierui.cn/article/pdhehi.html

其他资讯