linux下Cacti監控MySQL資料庫狀態例子

來源:互聯網
上載者:User

1、監控指令碼下載及配置

wget http://mysql-cacti-templates.googlecode.com/files/better-cacti-templates-1.1.8.tar.gz
tar zxvf better-cacti-templates-1.1.8.tar.gz
cd better-cacti-templates-1.1.8
cp scripts/ss_get_mysql_stats.php /var/www/html/cacti/scripts/

監控mysql只需要用到兩個檔案:

模板檔案:./templates/cacti_host_template_x_mysql_server_ht_0.8.6i-sver1.1.8.xml
外掛程式:./scriptsss_get_mysql_stats.php
修改ss_get_mysql_stats.php 檔案:

vim /var/www/html/cacti/scripts/ss_get_mysql_stats.php

 


 
配置MySQL伺服器,讓cacti所在機器能夠訪問MySQL伺服器的狀態資訊,必須擁有”process”許可權。如果要監控InnoDB狀態,還必須有”SUPER”許可權。

mysql> grant process,super on *.* to 'cactiuser'@'%' identified by 'cactiuser'; mysql> grant all privileges on cacti.*  to cactiuser@"%" identified by "cactiuser"; mysql> flush privileges;

 

3、匯入模板
將模板cacti_host_template_x_mysql_server_ht_0.8.6i-sver1.1.8.xml從linux下到本地電腦,登陸web匯入:


 

4、添加mysql監控
在Console選項卡下的左側功能表列中選擇Devices,選擇一個Device或建立一個Device,在Associated Graph Templates中添加要監控的mysql狀態:


 

在Create Graphs for this Host中選中剛才添加的模板,在點擊下方create建立映像:


 

5、最後在左上方的graphs選項卡,查看裝置映像,就可以查看到監控的mysql映像:

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在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.