xsw222 发表于 2015-11-22 14:40:06

Cacti部署文档

  一、Cacti简介
  Cacti是一个完整的网络图形解决方案,利用了RRDTool的数据存储和绘图的强大功能。Cacti提供了一个快速轮询,先进的图形模板,多种数据采集方法,分组的功能,用户管理。所有这一切都被包括在一个直观的,易于使用的界面,使安装了数百台服务器和设备的中小型网络或者复杂的网络可以轻松的监控其运行状态及历史情况。
  二、Cacti的安装
  1、安装环境需求
  基本环境需求为LAMP;
  其他
  RRDTool
  Net-snmp
  Cacti
  2、安装RRDTool
  RRDTool是由Tobias Oetiker开发的自由软件,它使用RRD(Round Robin Database)作为存储格式,Round robin是一种处理定量数据、以及当前元素指针的技术。RRDTool主要用来跟踪对象的变化情况,生成这些变化的走势图。
  本次准备安装的cacti-0.8.8a.tar.gz已经可以支持rrdtool-1.4.x,因此本文档采用的rrdtool为最新稳定版rrdtool-1.4.7.tar.gz。
  先使用yum进行安装支持的库文件,其中有一大部分在安装PHP时都已经安装过了,在这里列出几个特殊的。
  pango pango-devel
  cairo cairo-devel
  yum安装相关环境

# yum -y install zlib libpng freetype libart_lgpl libart_lgpl-devel libxml* pango*

  安装RRDTool

# ./configure --prefix=/usr/local/rrdtool
# make && make install
# ln -s /usr/local/rrdtool/bin/* /usr/local/bin/
  创建了了rrdtool可执行文件的软连接。
  3、安装Net-snmp

# ./configure --prefix=/usr/local/net-snmp
# make && make install
# cp EXAMPLE.conf /etc/snmp.conf
# ln -s /usr/local/net-snmp/bin/* /usr/local/bin/
# /usr/local/net-snmp/sbin/snmpd -c /etc/snmp.conf
# echo "/usr/local/net-snmp/sbin/snmpd -c /etc/snmp.conf" >>/etc/rc.local

  4、安装Cacti



# mkdir /usr/local/apache2/htdocs/cacti
# mv cacti-0.8.8a/* /usr/local/apache2/htdocs/cacti/

  创建数据库

# /usr/local/mysql/bin/mysql -u root -p
mysql> create database cacti;
Query OK, 1 row affected (0.00 sec)
mysql> insert into mysql.user(host,user,password) values('localhost','cacti',password('cacti'));
Query OK, 1 row affected, 3 warnings (0.01 sec)
mysql> flush privileges;
Query OK, 0 rows affected (0.01 sec)
mysql> grant all on cacti.* to cacti@'localhost' identified by 'cacti';
Query OK, 0 rows affected (0.00 sec)
mysql> exit
Bye
  将cacti数据库导入

# mysql -u cacti -pcacti cacti<cacti.sql
  增加定时采集任务;

*/5 * * * * /usr/local/bin/php /usr/local/apache2/htdocs/cacti/poller.php >/dev/null 2>&1

  出现以下错误

PHP Warning:date(): It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected the timezone 'UTC' for now, but please set date.timezone to select your timezone. in /usr/local/apache2/htdocs/cacti/cmd.php on line 61
  是因为PHP所取的时间是格林威治标准时间,所以和你当地的时间会有出入格林威治标准时间和北京时间大概差8个小时左右,我们可以按照下面的方法解决:
  1、编辑/usr/local/apache2/htdocs/index.php,在页头使用date_default_timezone_set()设置我的默认时区为北京时间,即<?phpdate_default_timezone_set(&quot;PRC&quot;);?>就可以了。
  2、在php.ini(/usr/local/lib/php.ini)中设置date.timezone的值为PRC,设置好以后的为:date.timezone=PRC,同时取消这一行代码的注释,即去掉前面的分号就可以了。
页: [1]
查看完整版本: Cacti部署文档