Linux利用cacti监控memcache


我们在部署好memcache以后,并不意味着不管不顾,更多的我们应该监控memcahce的状态,内存使用情况,hit/miss值是多少,利用 cacti能够很形象的监控memcache的各个参数,接下来我们就来了解下如何利用cacti来监控我们的memcache!

  首先我们可以从官网上学习如何添加cacti和memcache监控!地址如下:

  http://dealnews.com/developers/cacti/memcached.html

  我们来详细说下操作步骤!

  1、Python Client API Installation

  下载Python Client API(在cacti服务器上下载)

  wget ftp://ftp.tummy.com/pub/python-memcached/python-memcached-1.45.tar.gz

  tar xzvf python-memcached-1.45.tar.gz

  python setup.py install

  我运行上面的命令的时候出现如下错误

  Traceback (most recent call last):

  File "setup.py", line 3, in ?

  from setuptools import setup

  ImportError: No module named setuptools

  解决办法:yum -y install python-setuptools

  安装成功后再次 python setup.py install 安装就可以成功了。

  2、Template Installation

  wget http://content.dealnews.com/dealnews/developers/cacti-memcached-1.0.tar.gz

  tar zxvf cacti-memcached-1.0.tar.gz

  cd cacti-memcached

  把memcached.py 拷贝到Cacti 的scripts目录下!

  3、设置cacti

  进入Cacti控制界面点击

  Import Templates --> Import Template from Local File

  在浏览里面选择 cacti_memcached_host_template.xml 这个文件,然后点击save就OK!

  剩下的就是添加新图片的事情了

  4、以上设置只是针对默认端口11211,但是当你的端口不是11211,而是其他的端口,比如我的是12000,这样的话你就要对你的cacti的data source做下小更改了,操作如下:

  Console---Data Input Methods--Memcached – Statistics

  找到Input String的值python <path_cacti>/scripts/memcached.py <hostname>

  更改成:python <path_cacti>/scripts/memcached.py –p 12000 <hostname>

  如果你是其他端口的,只要将端口号更改成其他的值就可以了!


« 
» 
快速导航

Copyright © 2016 phpStudy | 豫ICP备2021030365号-3