1. 程式人生 > >zabbix之監控監控MySQL

zabbix之監控監控MySQL

zabbix 監控 mysql

監控MySQL

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

[[email protected] 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

[[email protected] alertscripts]# yum install percona-zabbix-templates php php-mysql

4、查看具體安裝了什麽軟件

[[email protected] alertscripts]# rpm -qa php

技術分享

5、導入模板

模板見附件

技術分享

6、拷貝配置文件

[[email protected] alertscripts]# cp /var/lib/zabbix/percona/templates/userparameter_percona_mysql.conf /etc/zabbix/zabbix_agentd.d/

7、腳本存放位置

[[email protected] scripts]# pwd

/var/lib/zabbix/percona/scripts

8、重啟服務

[[email protected] scripts]# systemctl restart zabbix-agent

9、創建一個配置文件,內容,用戶名,密碼。

<註意:生產環境中,需要創建一個監控用戶>

[[email protected] scripts]# vim ss_get_mysql_stats.php.cnf

[[email protected] scripts]# cat ss_get_mysql_stats.php.cnf

<?php

$mysql_user = ‘root‘;

$mysql_pass = ‘s3cret‘;(我這裏root密碼為空,因為沒有設置)

9、打開配置文件查看監控的內容,根據需要獲取相應的參數

技術分享

10、執行下腳本

[[email protected] scripts]# ./get_mysql_stats_wrapper.sh

獲得的指標

技術分享

11、配置主機添加模板

技術分享

然後查看圖形

連接數

技術分享

本文出自 “一杯水” 博客,請務必保留此出處http://6528161.blog.51cto.com/6518161/1959137

zabbix之監控監控MySQL