溫馨提示×

溫馨提示×

您好,登錄后才能下訂單哦!

密碼登錄×
登錄注冊×
其他方式登錄
點擊 登錄注冊 即表示同意《億速云用戶服務條款》

zabbix監控MySQL詳解

發布時間:2020-06-20 22:51:08 來源:網絡 閱讀:3485 作者:凜冬一壺酒 欄目: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

<?php

$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詳解

向AI問一下細節

免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。

AI

亚洲午夜精品一区二区_中文无码日韩欧免_久久香蕉精品视频_欧美主播一区二区三区美女