安装配置
cacti
web
根目录:
/usr/local/nginx/html/
2.1
安装本机
snmp
相关服务
[root@cacti ~]# yum install net-snmp net-snmp-devel net-snmp-libs net-snmp-utils
[root@cacti html]# chkconfig --level 35 snmpd on
[root@cacti html]# service snmpd start
Starting snmpd: [ OK ]
[root@cacti html]#
vim /etc/snmp/snmpd.conf
将
default
修改为
127.0.0.1
com2sec notConfigUser 127.0.0.1 public
将其中
62
行的
systemview
改为
all
即可
access notConfigGroup "" any noauth exact all none none
启用
85
行:
view all included .1 80
2.2
、安装
rrdtool
(
1
)检查并安装相关依赖包
[root@cacti html]# yum -y install cairo-devel libxml2-devel pango-devel pango libpng-devel freetype freetype-devel libart_lgpl-devel pear pear-devel zlib libpng freetype libart_lgpl libart_lgpl-devel libxml* pango*
(
2
)源码安装
rrdtool
[root@cacti ~]# tar -zxvf rrdtool-1.4.7.tar.gz
[root@cacti ~]# cd rrdtool-1.4.7
[root@cacti rrdtool-1.4.7]# ./configure --prefix=/usr/local/rrdtool
[root@cacti rrdtool-1.4.7]# make && make install
2.3
、解压
cacti
,并移动到
web
目录下
[root@cacti ~]# tar zxvf cacti-0.8.8a.tar.gz
[root@cacti ~]# mv cacti-0.8.8a /usr/local/nginx/html/cacti
2.4
、在
MySQL
中创建数据库
cacti
建立数据库
cacti
,并增加对该数据库拥有所有权限的用户名
cacti
,该用户密码为:
cacti
。
[root@cacti ~]#
/usr/local/mysql/bin/mysqladmin -u root password 123456
[root@cacti ~]# /usr/local/mysql/bin/mysql -uroot -p123456
mysql> create database cacti;
Query OK, 1 row affected (0.02 sec)
mysql> grant all on cacti.* to cacti@localhost identified by 'cacti';
Query OK, 0 rows affected (0.02 sec)
Query OK, 0 rows affected (0.00 sec)
mysql> flush privileges;
Query OK, 0 rows affected (0.03 sec)
2.5
、创建系统用户
cacti
(根据情况决定是否创建用户)
[root@cacti ~]# useradd cacti
[root@cacti ~]# echo "cacti" | passwd --stdin cacti
Changing password for user cacti.
passwd: all authentication tokens updated successfully.
2.6
、例行性排程设置
[root@cacti ~]# crontab -e
*/1 * * * * /usr/local/php/bin/php /usr/local/nginx/html/cacti/poller.php > /dev/null
2.7
、修改
cacti
目录权限
[root@cacti html]# chown -R nginx:nginx cacti/
[root@cacti html]# chmod 777 cacti/rra -R
[root@cacti html]# chmod 777 cacti/log -R
2.8
、导入数据库到
MySQL
[root@cacti html]# mysql -ucacti -pcacti cacti </usr/local/nginx/html/cacti/cacti.sql
2.9
、修改
cacti
的配置脚本
[root@cacti html]# vim cacti/include/config.php
$database_type = "mysql";
$database_default = "cacti";
$database_hostname = "localhost";
$database_username = "cacti";
$database_password = "cacti";
$database_port = "3306";
$database_ssl = false;
2.10
、
cacti
初始化配置
(
1
)初始化
cacti
在客户端
IE
浏览器中输入网址:
http://192.168.30.100/cacti/
;回车即可以看到
cacti
初始化界面。
点击
next
选择全新安装,点击 next
注意:上面红色字体提示找不到相应路径,需要手动修改为正确的路径
手工填写正确的路径。点击
“Finish
(结束)
”
。
Cacti
的默认管理用户是:
admin
,密码是:
admin
admin
用户初次登陆,会被要求强制修改密码,这里我修改密码为:123456
,点击“Save
(保存)”
第一次登录
cacti
的管理界面如上图,所示!
(2)
、
cacti
全局配置
修改
poller
时间,以便于快速看到效果。这里设置为一分钟,实际环境中五分钟最为合适。
注意到了这一步遇到一个问题:
cacti
没办法显示图表,如下所示:
原因:
rra
目录里没有相应监控的文件。
解决办法:
Console -> Data Source ->
选择没有图像的数据源
-> Turn On Data Source Debug MTurnode
复制调试命令到监控端以
cacti
用户执行
执行后会生成
rrd
文件
[root@cacti rra]# ls
localhost_load_1min_5.rrd localhost_mem_swap_4.rrd localhost_users_6.rrd
localhost_mem_buffers_3.rrd localhost_proc_7.rrd
p>
解决办法:
Console -> Data Source ->
选择没有图像的数据源
-> Turn On Data Source Debug MTurnode
复制调试命令到监控端以
cacti
用户执行
执行后会生成
rrd
文件
[root@cacti rra]# ls
localhost_load_1min_5.rrd localhost_mem_swap_4.rrd localhost_users_6.rrd
localhost_mem_buffers_3.rrd localhost_proc_7.rrd
选择
Turn Off Data Source Debug MTurnode
随后查看监控界面,就会发现已生成图像:
默认情况下,
cacti
只监控本机,即
cacti
服务器,如上图所示!
至此,
cacti
已经安装完成!