如何在Zabbix上安裝MySQL監控外掛程式PMP

來源:互聯網
上載者:User

標籤:

PMP,全稱是Percona Monitoring Plugins,是Percona公司為MySQL監控寫的外掛程式。支援Nagios,Cacti。從PMP 1.1開始,支援Zabbix。

下面,看看如何在Zabbix上安裝PMP。

 

配置Zabbix Agent

下載PMP

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

因為我的Linux版本是RHEL 6.7,故選擇RPM包

 

# wget https://www.percona.com/downloads/percona-monitoring-plugins/1.1.6/percona-zabbix-templates-1.1.6-1.noarch.rpm

# rpm -ivh percona-zabbix-templates-1.1.6-1.noarch.rpm

warning: percona-zabbix-templates-1.1.6-1.noarch.rpm: Header V4 DSA/SHA1 Signature, key ID cd2efd2a: NOKEYPreparing...                ########################################### [100%]   1:percona-zabbix-template########################################### [100%]Scripts are installed to /var/lib/zabbix/percona/scriptsTemplates are installed to /var/lib/zabbix/percona/templates

 

拷貝PMP的設定檔

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

確保Zabbix-Agent設定檔中已經開啟Include=/etc/zabbix/zabbix_agentd.d/

 

重啟Zabbix-Agent服務

# service zabbix-agent restart

 

建立MySQL的監控使用者

mysql> grant process,super,select on *.* to [email protected]‘localhost‘ identified by ‘monitor‘;

mysql> flush privileges;

 

修改指令碼中的使用者名稱和密碼

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

$mysql_user = ‘monitor‘;$mysql_pass = ‘monitor‘;$mysql_port = 3306;

 

測試指令碼能否擷取到資料庫的狀態資訊

該指令碼需測試兩部分內容

1. MySQL執行個體本身的狀態變數

2. MySQL是否為Slave

 

測試MySQL執行個體本身的狀態變數

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

/var/lib/zabbix/percona/scripts/get_mysql_stats_wrapper.sh: line 35: /usr/bin/php: No such file or directoryERROR: run the command manually to investigate the problem: /usr/bin/php -q /var/lib/zabbix/percona/scripts/ss_get_mysql_stats.php --host localhost --items gg

因為它的指令碼是用PHP實現的,故需要安裝php和php-mysql

# yum install php php-mysql

重新測試該指令碼

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

有值返回就代表OK

 

測試MySQL是否為Slave

# /var/lib/zabbix/percona/scripts/get_mysql_stats_wrapper.sh running-slave

返回0和1是正常值,返回“Access denied”則有問題。

 

匯入PMP的模板

即/var/lib/zabbix/percona/templates目錄中的zabbix_agent_template_percona_mysql_server_ht_2.0.9-sver1.1.6.xml

 

如何在Zabbix上安裝MySQL監控外掛程式PMP

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.