一、下載percona模板,解壓php
二、在redis的默認模板配置文件的基礎上增長選項port2,用戶在新建redis監控圖像時要求填寫redis端口號,不填的話就是默認的6379,ss_get_by_ssh.php腳本經過port2選項鍊接指定端口的redis實例: web
[root@coocaa-centos] cd percona-monitoring-plugins-1.0.1/cacti/binredis
[root@coocaa-centos] ./pmp-cacti-template --script /home/packages/percona-monitoring-plugins-1.0.1/cacti/scripts/ss_get_by_ssh.php /home/packages/percona-monitoring-plugins-1.0.1/cacti/definitions/redis.def --mpds port2 >/home/packages/percona-monitoring-plugins-1.0.1/cacti/templates/cacti_host_template_percona_redis_server_ht_for_multi_instance.xmlcentos
三、將新建立的redis模板下載到本地電腦cacti_host_template_percona_redis_server_ht_for_multi_instance.xml服務器
四、在cacti的web管理頁面導入新建立的redis模板cacti_host_template_percona_redis_server_ht_for_multi_instance.xmlapp
console->Import/Export->Import Templates->choose file->importssh
五、修改redis模板中圖像的title,以便區分圖像屬於那個實例,本例使用用戶在建立圖像時輸入的端口號區分,在cacti中變量使用||引用ide
console->Templates->Graph Templates->search 'redis' and select a redis template->in Graph Template title->|host_description| - Redis Commands - |input_port2|->saveserver
六、新建redis的監控圖像,記得填寫端口號
七、若是在導入新模板以前已經有對redis 6379的監控,這時圖像顯示名字會不正常,須要修改以前的datasource
console->Create->Data Sources->search 'redis' and select a data source->in the Custom Data,let port2=6379->save
七、腳本刷新圖像顯示名字
在cacti服務器的腳本目錄下:
[root@coocaa-centos] cd /var/www/html/cacti/cli
[root@coocaa-centos] php -q poller_graphs_reapply_names.php -id=All -d -s=Redis