简介:
cacti是用php语言实现的一个软件,它的主要功能是用snmp服务获取数据,然后用rrdtool(Round Robin Database,环形数据库),储存和更新数据,当用户需要查看数据的时候用rrdtool生成图表呈现给用户。
Mysql配合PHP程序存储一些变量数据并对变量数据进行调用,如:主机名、主机ip、snmp团体名、端口号、模板信息等变量。 snmp抓到数据不是存储在mysql中,而是存在rrdtool生成的rrd文件中(在cacti根目录的rra文件夹下)。rrdtool对数据的更新和存储就是对rrd文件的处理,rrd文件是大小固定的档案文件(Round Robin Archive),它能够存储的数据笔数在创建时就已经定义。
二.配置snmp
参考文档地址:http://www.cyberciti.biz/nixcraft/linux/docs/uniqlinuxfeatures/mrtg/
/etc/init.d/snmpd start
snmpwalk -v 1 -c public localhost IP-MIB::ipAdEntIfIndex
#若没有snmpwalk命令,则yum install net-snmp-utils
Timeout: No Response from localhost #若输出结果为此则对snmp进行配置
vim /etc/snmp/snmpd.conf
Find line:
com2sec notConfigUser default public替代为:
com2sec local localhost public
com2sec mynetwork 192.168.0.0/24 public
Find lines:
group notConfigGroup v1 notConfigUser
group notConfigGroup v2c notConfigUser
Replace with: group MyRWGroup v1 local group MyRWGroup v2c local group MyRWGroup usm local group MyROGroup v1 mynetwork group MyROGroup v2c mynetwork group MyROGroup usm mynetwork
Find line:
view systemview included system
Replace with: view all included .1 80
Find line:
access notConfigGroup "" any noauth exact systemview none none
Replace with: access MyROGroup "" any noauth exact all none none access MyRWGroup "" any noauth exact all all none
四.spine的安装
Spine is a very fast poller engine, written in C. It is an optional replacement for cmd.php. If you decide to use it, you will have to install it explicitely. It does not come with cacti itself.
The easiest way is to install Spine using rpm or ports. You will find packages for Spine at the main cacti site or from your distribution.To compile Spine, please download it to any location of your liking. Then, please issue from the downloaded directory following commands
点击左边栏的Graph Management即可浏览刚才所创建的图表。
勾选需要显示graphs的条目,在右下方chose an action:选择
place on a tree(physical host)这样就就能把该图表类似快捷方式的样子粘贴到Graphs,physical(被监控主机的描述)栏目中。