mysql模板下載地址:http://code.google.com/p/mysql-cacti-templates/downloads/list
>tar zxf better-cacti-templates-1.1.8.tar.gz
>cd better-cacti-templates-1.1.8/scripts/
>cp ss_get_mysql_stats.php /www/cacti/scripts/ 複製到你cacti目錄下面的scripts裏面
>chown -R cacti:cacti /www/cacti/scripts
>cd /www/cacti/scripts/
>vim vim ss_get_mysql_stats.php
$mysql_user = 'cactiuser';
$mysql_pass = 'cactiuser';
$cache_dir = '/tmp/cacti/cache'; 這個是你授權查詢數據的用戶和存放數據的目錄
>mkdir -p /tmp/cacti/cache
>mysql -uroot -p
mysql> grant process,super on *.* to 'cactiuser'@'192.168.3.159' identified by 'cactiuser';
授權這個用戶可以採集數據
在cacti監控頁面導入模板
選擇console--->import/export--->import templates--->選擇文件--->找到你自己解壓後的這個cacti_host_template_x_mysql_server_ht_0.8.6i-sver1.1.8.xml文件--->選擇右下角import
然後你就可以在console-->devices-->你的主機-->create graphs for this host選擇你需要的模板