• 安装LAMP    参考:lamp的安装及安全设置
  • 安装并配置net-snmp  参考:  centos配置net-snmp 
  • 下载CACTI源文件  Cacti for Linux/Unix
  • 解开源包、改权限,打补丁
  • 设置数据库,并导入数据
  • 设置crontab
  • 通过ui 进行必要的安装后设置

 

1、解开源包并打补丁

wget -P /root/tools/cacti/ http://www.cacti.net/downloads/cacti-0.8.7e.tar.gz
cd /usr/local/apache2/htdocs
tar zxvf /root/tools/cacti/cacti-0.8.7e.tar.gz
cd cacti-0.8.7e/
useradd cactiuser -s /sbin/nologin
chown -R cactiuser ./rra ./log
wget http://www.cacti.net/downloads/patches/0.8.7e/cli_add_graph.patch
wget http://www.cacti.net/downloads/patches/0.8.7e/snmp_invalid_response.patch
wget http://www.cacti.net/downloads/patches/0.8.7e/template_duplication.patch
patch -p1 -N < cli_add_graph.patch
patch -p1 -N < snmp_invalid_response.patch
patch -p1 -N < template_duplication.patch

2、创建并导入cacti的数据库

mysql -e 'create database cacti7e' -p
mysql cacti7e < /usr/local/apache2/htdocs/cacti-0.8.7e/cacti.sql  -p
mysql -e "grant all on cacti7e.* to cactiuser@localhost identified by 'cactiuser';" -p

3、更改 cacti-0.8.7e/include/config.php 相关数据库连接参数

$database_type = "mysql";
$database_default = "cacti7e";
$database_hostname = "localhost";
$database_username = "cactiuser";
$database_password = "cactiuser";

4、添加crontab

echo  "*/1  * * * *  /usr/local/php/bin/php  /usr/local/apache2/htdocs/cacti-0.8.7e/poller.php" >/tmp/cron.tmp

crontab  -u cactiuser  /tmp/cron.tmp

5、用ie打开http://server ip/cacti-0.8.7e进入cacti的web安装界面

     1、用admin admin 登入后,修改ADMIN为你自己密码

    2、进入settings ->gernerl -web-Events 勾选所有项,如下:  

 

Web Events
What Cacti website messages should be placed in the log.

  3、进入settings ->Poller ->Poller Interval 设置为一分钟,如下:

Poller Interval
The polling interval in use. This setting will effect how often rrd's are checked and updated. NOTE: If you change this value, you must re-populate the poller cache. Failure to do so, may result in lost data.
Cron Interval
The cron interval in use. You need to set this setting to the interval that your cron or scheduled task is currently running.

   4、进入settings ->visual ->Default RRDtool 1.2 Fonts 设置如下

Default RRDtool 1.2 Fonts
Title Font Size
The size of the font used for Graph Titles
Title Font File
The font file to use for Graph Titles
Legend Font Size
The size of the font used for Graph Legend items
Legend Font File
The font file to be used for Graph Legend items
Axis Font Size
The size of the font used for Graph Axis
Axis Font File
The font file to be used for Graph Axis items
Unit Font Size
The size of the font used for Graph Units
Unit Font File
The font file to be used for Graph Unit items