天天看點

cacti監控mysql

第一

2 解壓模闆

   #tar xvf  better-cacti-templates-1.1.7.tar

3 把相應的php腳本拷貝到cacti的家目錄下面scripts/目錄下面

   #cd  better-cacti-templates-1.1.7/scripts

   #cp  ss_get_mysql_stats.php   ss_get_by_ssh.php  /var/www/html/cacti/scripts

4 修改關于監控mysql 相應的php腳本

#cd /var/www/html/cacti/scripts

#   vim  ss_get_mysql_stats.php

      $mysql_user = 'cacti'; 

      $mysql_pass = 'cacti';

   注:上面mysql_user  mysql_pass 對應的是cacti能夠通路所有被監控mysql的共同的使用者和密碼,并且該使用者是在别監控mysql伺服器上是授權使用者

      $mysql_port = 3306;

      $cache_dir  = '/var/www/html/cacti/cache';預設情況下是儲存在/tmp下面

5 建立cache目錄

6 導入監控mysql的模闆

        通過web通路cacti并且點選 console à Import Templates  à Browse

          選擇您要導入的模闆cacti_host_template_x_mysql_server_ht_0.8.6i-sver1.1.7.xml  à Save (儲存)

7   在被監控mysql伺服器上授權使用者

    配置MySQL伺服器,讓cacti所在機器能夠通路MySQL伺服器的狀态資訊,必須擁有”process”權限。如果要監控InnoDB狀态,還必須有”SUPER”權限

       #mysql –uroot –p

       # mysql> grant process,super on *.* to 'cacti'@'IP’' identified by 'cacti'; 

                   注:IP 是對應cacti伺服器的IP位址;在監控mysql的一些對象時需要mysql使用者名和密碼

8 如圖所示

第二

     ApacheStats_0.8.2.tar

   2  解壓該模闆,并把對應的php腳本拷貝到cacti家目錄下面的scripts 目錄下面

      #tar xvf ApacheStats_0.8.2.tar

      #cd  ApacheStats_0.8.2

      #cp   mysql_stats.php  dumpMemcachedStats.php  /var/www/html/cacti/scripts

   3 導入模闆檔案

               cacti_host_template_temysql_host.xml

   4 當然同樣也要為使用者授權,

        # mysql> grant process,super on *.* to 'cacti'@'IP’' identified by 'cacti'; 

本文轉自 freehat08 51CTO部落格,原文連結:http://blog.51cto.com/freehat/389704,如需轉載請自行聯系原作者