关于如何安装配置cacti可以参考本人另外一篇博客,这里不在给出,先说明下环境:

系统:Centos_x86_64

cacti版本:0.8.8a

一、安装memcache客户端API

1、解决依赖关系

python

python-setuptools

可以使用yum来安装

2、下载安装

可以在ftp://ftp.tummy.com/pub/python-memcached/下载最新版本

[root@localhost ~]# tar xf python-memcached-1.48.tar.gz
[root@localhost ~]# cd python-memcached-1.48
[root@localhost python-memcached-1.48]# python setup.py install

 

二、下载安装数据收集脚本和模板

可以在http://dealnews.com/developers/cacti/memcached.html下载最新版本

1、复制数据收集脚本文件

配置Cacti监控Memcache_cacti监控memcache

解压缩后可以看到主要就两个文件,把memcached.py的脚本放到cacti的scripts目录,例如我这里是/usr/local/www/cacti/scripts/

2、通过浏览器访问cacti导入cacti_memcached_host_template.xml文件

注意:如果你的memcache的端口不是默认的11211端口则需要修改执行脚本的命令,如图

配置Cacti监控Memcache_cacti监控memcache_02

点击Data Input Methods 选择导入的Memcached – Statistics

配置Cacti监控Memcache_cacti监控memcache_03

在执行的脚本后边通过添加 –p 选项来指定你的memcache端口即可,例如我这里指定的60000端口

 

至此cacti已经可以监控memcache服务,效果如下

 

配置Cacti监控Memcache_cacti监控memcache_04 配置Cacti监控Memcache_cacti监控memcache_05 配置Cacti监控Memcache_cacti监控memcache_06