设为首页 收藏本站
查看: 1393|回复: 0

[经验分享] Linux下使用Cacti监控流量状况

[复制链接]
累计签到:1 天
连续签到:1 天
发表于 2014-11-17 13:54:14 | 显示全部楼层 |阅读模式
    Cacti 在英文中的意思是仙人掌的意思,Cacti是一套基于PHP,MySQL,SNMP及RRDTool开发的网络流量监测图形分析工具,使用PHP开发,它是由一些PHP页面组成软件,主要针对企业的大量网络设备、服务器主机***能监测服务,可提供对CPU负载、内存占用、运行进程数、磁盘空间、网卡流量等各种数据信息的监测,cacti注重的是状态监控,报警和服务恢复功能比较差。
官方站点:
http://www.cacti.net
下载页面:
http://www.cacti.net/downloads/cacti-0.8.8b.tar.gz

wKiom1RXnxPRRpLMAAT4JaswXNQ738.jpg

开始Cacti安装部署
机器IP地址:192.168.1219.129

软件下载:
[iyunv@rhel64 ~]# wget http://www.cacti.net/downloads/cacti-0.8.8a.tar.gz
[iyunv@rhel64 ~]# wget http://oss.oetiker.ch/rrdtool/pub/rrdtool-1.4.5.tar.gz
[iyunv@rhel64 ~]# wget http://www.cacti.net/downloads/spine/cacti-spine-0.8.8a.tar.gz

安装lamp环境:
[iyunv@rhel64 ~]# yum install -y httpd mysql  mysql-server php php-mysql php-json php-pdo

安装相关的lib库:
[iyunv@rhel64 ~]# yum install -y cairo-devel libxml2-devel pango pango-devel

安装编译器:
[iyunv@rhel64 ~]# yum -y install gcc make gcc-c++

解压编译软件:
[iyunv@rhel64 ~]# tar -xzf rrdtool-1.4.5.tar.gz
[iyunv@rhel64 ~]# cd rrdtool-1.4.5
[iyunv@rhel64 rrdtool-1.4.5]# ./configure --prefix=/usr/local/rrdtool/
[iyunv@rhel64 rrdtool-1.4.5]# make && make install
[iyunv@rhel64 rrdtool-1.4.5]# ln -s /usr/local/rrdtool/bin/* /usr/local/bin/

安装snmp服务:
[iyunv@rhel64 rrdtool-1.4.5]# yum -y install net-snmp net-snmp-utils

安装Cacti主程序:
[iyunv@rhel64 ~]# tar xzf cacti-0.8.8a.tar.gz && mv cacti-0.8.8a /var/www/html/cacti

创建Cacti数据库:
[iyunv@rhel64 ~]# service mysqld start
[iyunv@rhel64 ~]# /usr/bin/mysqladmin -u root -h rhel64 password '123456'
[iyunv@rhel64 ~]# /usr/bin/mysqladmin -u root password '123456'
[iyunv@rhel64 ~]# mysql -uroot -p
mysql> create database cacti;
Query OK, 1 row affected (0.00 sec)
mysql> grant all on cacti.* to cacti@'localhost' identified by "123456";
Query OK, 0 rows affected (0.00 sec)
mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec)
mysql>


把Cacti数据导入Cacti数据库:
[iyunv@rhel64 ~]# mysql -ucacti -p123456 cacti[iyunv@rhel64 ~]# chmod -R 777 /var/www/html/cacti/rra
[iyunv@rhel64 ~]# chmod -R 777 /var/www/html/cacti/log
[iyunv@rhel64 ~]# vi /var/www/html/cacti/include/config.php
/*
+-------------------------------------------------------------------------+
| Copyright (C) 2004-2012 The Cacti Group                                 |
|                                                                         |
| This program is free software; you can redistribute it and/or           |
| modify it under the terms of the GNU General Public License             |
| as published by the Free Software Foundation; either version 2          |
| of the License, or (at your option) any later version.                  |
|                                                                         |
| This program is distributed in the hope that it will be useful,         |
| but WITHOUT ANY WARRANTY; without even the implied warranty of          |
| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the           |
| GNU General Public License for more details.                            |
+-------------------------------------------------------------------------+
| Cacti: The Complete RRDTool-based Graphing Solution                     |
+-------------------------------------------------------------------------+
| This code is designed, written, and maintained by the Cacti Group. See  |
| about.php and/or the AUTHORS file for specific developer information.   |
+-------------------------------------------------------------------------+
| http://www.cacti.net/                                                   |
+-------------------------------------------------------------------------+
*/

/* make sure these values refect your actual database/host/user/password */
$database_type = "mysql";
$database_default = "cacti";
$database_hostname = "localhost";
$database_username = "cacti";
$database_password = "123456";
$database_port = "3306";
$database_ssl = false;

/*
   Edit this to point to the default URL of your Cacti install
   ex: if your cacti install as at http://serverip/cacti/ this
   would be set to /cacti/
*/
//$url_path = "/cacti/";

/* Default session name - Session name must contain alpha characters */
//$cacti_session_name = "Cacti";

?>

[iyunv@rhel64 ~]# setenforce 0
[iyunv@rhel64 ~]# crontab -e
*/5  * * * * /usr/bin/php /var/www/html/cacti/poller.php >>/tmp/cacti_rrdtool.log 2>&1

http://192.168.1219.129/cacti/

一直点击next下去即可,用户名和密码默认是admin.admin,第一次登陆需要修改密码。

wKiom1RoC_OS2okFAAH3sVv6v2E614.jpg

wKioL1RoDInCSq8YAADMxZAAmtg434.jpg

wKiom1RoDDfQKYlFAAGOu2xxR-I955.jpg


wKioL1RoDPjxtdaBAAC7LAGaJVE970.jpg

wKioL1RoDR6BI7HpAADm5H-QcHo223.jpg


wKiom1RoDMzixi0MAAMjWrGAzGM275.jpg


定义监控哪些设备:
控制面版-->建立设备-->定义设备-->为设备生成图像-->在图像树中添加新设备
console-->Devices-->add(左上角)-->define devices-->Create Graphs for this Host-->create
在被监控客户机上要安装net-snmp,41行那里要填写监控端的IP地址。
[iyunv@rhel64 ~]# yum -y install net-snmp
[iyunv@rhel64 ~]# vim /etc/snmp/snmpd.conf
62 access  notConfigGroup ""      any       noauth    exact  all none none
41 com2sec notConfigUser  192.168.1219.129       public
85 view all    included  .1                               80

[iyunv@rhel64 ~]# service snmpd start



运维网声明 1、欢迎大家加入本站运维交流群:群②:261659950 群⑤:202807635 群⑦870801961 群⑧679858003
2、本站所有主题由该帖子作者发表,该帖子作者与运维网享有帖子相关版权
3、所有作品的著作权均归原作者享有,请您和我们一样尊重他人的著作权等合法权益。如果您对作品感到满意,请购买正版
4、禁止制作、复制、发布和传播具有反动、淫秽、色情、暴力、凶杀等内容的信息,一经发现立即删除。若您因此触犯法律,一切后果自负,我们对此不承担任何责任
5、所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其内容的准确性、可靠性、正当性、安全性、合法性等负责,亦不承担任何法律责任
6、所有作品仅供您个人学习、研究或欣赏,不得用于商业或者其他用途,否则,一切后果均由您自己承担,我们对此不承担任何法律责任
7、如涉及侵犯版权等问题,请您及时通知我们,我们将立即采取措施予以解决
8、联系人Email:admin@iyunv.com 网址:www.yunweiku.com

所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其承担任何法律责任,如涉及侵犯版权等问题,请您及时通知我们,我们将立即处理,联系人Email:kefu@iyunv.com,QQ:1061981298 本贴地址:https://www.yunweiku.com/thread-30451-1-1.html 上篇帖子: 开源监控软件-Cacti-rhel5.9安装手册 下篇帖子: 关于cacti和nagios两款开源监控软件的一些比较 Linux 监控 流量
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

扫码加入运维网微信交流群X

扫码加入运维网微信交流群

扫描二维码加入运维网微信交流群,最新一手资源尽在官方微信交流群!快快加入我们吧...

扫描微信二维码查看详情

客服E-mail:kefu@iyunv.com 客服QQ:1061981298


QQ群⑦:运维网交流群⑦ QQ群⑧:运维网交流群⑧ k8s群:运维网kubernetes交流群


提醒:禁止发布任何违反国家法律、法规的言论与图片等内容;本站内容均来自个人观点与网络等信息,非本站认同之观点.


本站大部分资源是网友从网上搜集分享而来,其版权均归原作者及其网站所有,我们尊重他人的合法权益,如有内容侵犯您的合法权益,请及时与我们联系进行核实删除!



合作伙伴: 青云cloud

快速回复 返回顶部 返回列表