您的位置:首页 > 运维架构 > Linux

linux 监控之CACTI

2016-07-30 14:03 417 查看
           Cacti 是一套基于php,mysql,snmp以及rrdtool开发的网络流量监测图形分析工具。主要功能是用snmp服务获取数据,然后用rrdtool储存和更新数据,数据会存在rrdtool生成的rrd文件中,rrd文件能够存储文件的大小在创建的时候就已经定义好。

1.Eviroment

操作系统:红帽企业6.5 

虚拟机server1:172.25.193.1(2048/2/8)

真机   instructor:172.25.193.100(2048/2/8)

检查火墙(off)与selinux(disabled)

2.Cacti需要lamp环境以及相关包

yum install -y httpd php php-mysql mysql mysql-server net-snmp

cacti-0.8.8h.tar.gz 

cacti-spine-0.8.8h.tar.gz 

php-snmp-5.3.3-26.el6.x86_64.rpm

rrdtool mysql net-snmp-utils 

3.配置 Mysql

shell> mysql_secure_installation

shell> mysql -pcacti

shell> mysqladmin -pcacti create cacti

shell> mysql -pcacti cacti < cacti.sql

shell> mysql -pcacti -e "grant all on cacti.* to yedda@localhost identified by 'yedda';"

shell> vim /var/www/html/cacti/include/config.php

   29 $database_username = "yedda";

     30 $database_password = "yedda";

     39 $url_path = "/cacti/";

     42 cacti_session_name = "Cacti";

shell>su cacti

bash-4.1$ crontab -e 

*/5 * * * * php /var/www/html/cacti/poller.php > /dev/null 2>&1

http://172.25.193.1/cacti首次登陆用户名与密码均为admin更改密码可登陆查看

真机:172.25.193.100

shell> yum install -y net-snmp net-snmp-utils

shell> cd /etc/snmp

shell> vim snmp.conf


 

 

shell> systemctl start snmp

 




 

在虚拟机上将localhost改为172.25.193.100.得到结果相同则测试成功。

 


选择New Graphs->Create New Host->

Description        server

Hostname          172.25.193.100

Host Template      ucd/net SNMP Host

Downed Device Detection SNMP  Uptime

SNMP Version  Version1

->Create Graphs for this Host

->Graph Trees Add Save

shell> tar zxf cacti-spine-0.8.8h.tar.gz

shell> ./configure

shell> yum install -y net-snmp-devel mysql-devel openssl-devel

shell> yum install -y dos2unix autoconf automake binutils libtool gcc cpp glibc-headers kernel-headers glibc-devel 

shell> ./configure

shell> sh bootstrap

shell> ./configure

shell> make && make install

#############Configure Spine#########

shell> cd /usr/local/spine/etc/

shell> cp spine.conf.dist /etc/spine.conf

shell> vim /etc/spine.conf

DB_User yedda

DB_Pass yedda

shell> su cacti

      /usr/local/spine/bin/spine 

(在cacti的Settings中设置路径/usr/local/spine/bin/spine)

测试:

shell> cd /var/www/html/cacti/log 

shell> cat cacti.log

############# Add Monitor#############

shell> tar zxf  monitor-v1.3-1.tgz -C /var/www/html/cacti/plugins

 

                                                                                                                                                                                                                                                             
                                 By Yedda.

 
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  cacti linux snmp