1、下载percona模板,解压
2、在redis的默认模板配置文件的基础上增加选项port2,用户在新建redis监控图像时要求填写redis端口号,不填的话就是默认的6379,ss_get_by_ssh.php脚本通过port2选项连接指定端口的redis实例:
[[email protected]] cd percona-monitoring-plugins-1.0.1/cacti/bin
[[email protected]] ./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.xml
3、将新创建的redis模板下载到本地电脑cacti_host_template_percona_redis_server_ht_for_multi_instance.xml
4、在cacti的web管理页面导入新创建的redis模板cacti_host_template_percona_redis_server_ht_for_multi_instance.xml
console->Import/Export->Import Templates->choose file->import
5、修改redis模板中图像的title,以便区分图像属于那个实例,本例使用用户在创建图像时输入的端口号区分,在cacti中变量使用||引用
console->Templates->Graph Templates->search ‘redis‘ and select a redis template->in Graph Template title->|host_description| - Redis Commands - |input_port2|->save
6、新建redis的监控图像,记得填写端口号
7、如果在导入新模板之前已经有对redis 6379的监控,这时图像显示名字会不正常,需要修改之前的datasource
console->Create->Data Sources->search ‘redis‘ and select a data source->in the Custom Data,let port2=6379->save
7、脚本刷新图像显示名字
在cacti服务器的脚本目录下:
[[email protected]] cd /var/www/html/cacti/cli
[[email protected]] php -q poller_graphs_reapply_names.php -id=All -d -s=Redis