- 所需软件
RRDTool 1.0.49 or 1.2.x or greater
MySQL 4.1.x or 5.x or greater
PHP 4.3.6 or greater, 5.x greater highly recommended for advanced features
A Web Server e.g. Apache or IIS
- 安装MySQL及php
yum install mysql mysql-server mysql-devel
yum install httpd php php-mysql php-snmp
yum install net-snmp net-snmp-utils net-snmp-devel(需要在被监控的服务器安装并启动)
- 测试SNMP协议
编辑SNMP配置文件
vim /etc/snmp/snmpd.conf
添加
com2sec notConfigUser localhost public
测试命令
snmpwalk -v 2c -c public localhost if
- 安装cacti
cacti-0.8.7g
cacti-plugin-0.8.7g-PA-v2.8.tar.gz(插件扩展暂时未装)
cacti-spine-0.8.7g.tar.gz
useradd cacti
tar xzvf cacti-0.8.7g.tar.gz
mv cacti-0.8.7g /var/www/html/cacti
chown -R cacti.cacti /var/www/html/cacti
mysqladmin --user=root create cacti
mysql cacti < cacti.sql
在MySQL中创建用户cacti
mysql> GRANT ALL ON cacti.* TO cactiuser@localhost IDENTIFIED BY 'cacti';
mysql> flush privileges;
- 修改配置文件include/config.php和include/global.php
$database_type = "mysql";
$database_default = "cacti";
$database_hostname = "localhost";
$database_username = "cacti";
$database_password = "cacti";
$database_port = "3306";
- 定时任务(crontab -u cacti -e)
*/5 * * * * /usr/bin/php /var/www/html/cacti/poller.php > /dev/null 2>&1
- 安装spine
版本 cacti-spine-0.8.7g.tar.gz
yum install net-snmp net-snmp-utils net-snmp-devel
./configure
make
make install
测试可用性
# /usr/local/spine/bin/spine
SPINE: Using spine config file [../etc/spine.conf]
SPINE: Version 0.8.7g starting
SPINE: Time: 0.1286 s, Threads: 1, Hosts: 3
不指定路径安装后在/usr/local/spine目录下
- 重构rra文件的目录结构(优化部分)
- 在crontab里暂停poller.php
- 然后执行cli目录下的structure_rra_paths.php
/usr/bin/php structure_rra_paths.php --proceed
它会将所有的RRD文件按照device重新分配目录
- 修改数据库中的RRD路径
Settings—>Paths
- 恢复poller.php的crontab
- 参考
