欢迎投稿

今日深度:

Zabbix监控mariadb,zabbixmariadb

Zabbix监控mariadb,zabbixmariadb


                         Zabbix监控mariadb

zabbix自带的MySQL插件来监控mysql数据库,但是太过简陋了,对于我们dba来说,基本没有啥作用,所以需要做更详细的监控,而percona就有这个详细监控的模版以及脚本,正好拿过来用。

 

 

 

wget https://www.percona.com/downloads/percona-monitoring-plugins/percona-monitoring-plugins-1.1.7/binary/redhat/7/x86_64/percona-zabbix-templates-1.1.7-2.noarch.rpm

 

Percona组成介绍

 

1、PHP脚本    用来数据采集

 

2、shell脚本  用来调用采集信息

 

3、zabbix配置文件

 

4、zabbix模板文件

 

 

二、安装及配置

 

1、下载及安装

 

https://www.percona.com/downloads/percona-monitoring-plugins/LATEST/

 

同时也支持Nagios和catcti

 

wget https://www.percona.com/downloads/percona-monitoring-plugins/percona-monitoring-plugins-1.1.7/binary/redhat/6/x86_64/percona-zabbix-templates-1.1.7-2.noarch.rpm

 

rpm -ivh percona-zabbix-templates-1.1.7-2.noarch.rpm

 

yum install percona-zabbix-templates php php-mysql -

 

[root@devops-mysql-node1 ~]# 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   为MYSQL监控模板

 

将配置文件拷贝到/etc/zabbix/zabbix_agentd.d/目录

cp /var/lib/zabbix/percona/templates/userparameter_percona_mysql.conf /etc/zabbix/zabbix_agentd.d/

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

$mysql_user = 'zabbix';

$mysql_pass = 'zabbix';

$mysql_port = 3306;

$mysql_socket = NULL;

$mysql_flags = 0;

测试环境root密码为空,如果生产环境会创建专门只读账号。

 

需要改配置文件需要重启

/etc/init.d/zabbix-agent restart

进行测试会返回测试结果

[root@localhost ~]# cd /var/lib/zabbix/percona/scripts/

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

0

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

16939                                                                                                     

[root@localhost ~]# /opt/remi/php72/root/usr/bin/php -q /var/lib/zabbix/percona/scripts/ss_get_mysql_stats.php --host 9.110.187.131 --items gg  

gg:16

 

 

2、导入模板
标签无效 "/zabbix_export/date": "YYYY-MM-DDThh:mm:ssZ" 预计。

 

解决办法
将zabbix_agent_template_percona_mysql_server_ht_2.0.9-sver1.1.7.xml导入zabbix2.4中再导出。之后将新的导出xml导入到3.2中问题解决。

 

 

Received value [rm: 无法删除"/tmp/localhost-mysql_cacti_stats.txt": 不允许的操作0] is not suitable for value type [Numeric (float)]

 

解决办法
cd /tmp
chown -R zabbix.zabbix localhost-mysql_cacti_stats.txt 
/etc/init.d/zabbix-agent restart

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

www.htsjk.Com true http://www.htsjk.com/mariadb/36074.html NewsArticle Zabbix监控mariadb,zabbixmariadb                           Z abbix监控mariadb zabbix自带的MySQL插件来监控mysql数据库,但是太过简陋了,对于我们dba来说,基本没有啥作用,所以需要...
相关文章
    暂无相关文章
评论暂时关闭