Cacti检测系统快速部署 试验环境: 本机 IP:192.168.1.3 同时安装被检测端和检测端,检测端和被检测端可以分开进行安装,但是我为了方便起见同时都安装在了一台机器上 配置被检测端(snmpd) [root@localhost ~]# cd /media/RHEL_5.5\ i386\ DVD/Server/ [root@localhost Server]# pwd /media/RHEL_5.5 i386 DVD/Server [root@localhost Server]# rpm -ivh lm_sensors-2.10.7-9.el5.i386.rpm [root@localhost Server]# rpm -ivh net-snmp-5.3.2.2-9.el5.i386.rpm [root@localhost Server]# [root@localhost Server]# vim /etc/snmp/snmpd.conf 41 com2sec notConfigUser 192.168.1.3 publicsvr 62 access notConfigGroup "" any noauth exact all none none 85 view all included .1 80 [root@localhost Server]# service snmpd start 启动 snmpd: [确定] [root@localhost ~]# chkconfig snmpd on [root@localhost ~]# -------------------------- 配置检测服务器(Cacti) 安装 web 平台及数据库系统、安装 net-snmp-util 软件包: [root@localhost ~]# yum install httpd.i386 [root@localhost ~]# yum install mysql.i386 mysql-server.i386 mysql-connector-odbc.i386 [root@localhost ~]# yum install php.i386 php-mysql.i386 php-common.i386 php-pdo.i386 [root@localhost ~]# yum install net-snmp-utils [root@localhost ~]# [root@localhost ~]# service httpd start [root@localhost ~]# service mysqld start [root@localhost ~]# chkconfig httpd on [root@localhost ~]# chkconfig mysqld on [root@localhost ~]# 安装 rrdtool 软件包: [root@localhost tom]# tar xzvf rrdtool-1.2.27.tar.gz [root@localhost tom]# cd rrdtool-1.2.27 [root@localhost tom]# [root@localhost rrdtool-1.2.27]# ./configure --prefix=/usr/local/ [root@localhost rrdtool-1.2.27]# make [root@localhost rrdtool-1.2.27]# make install [root@localhost rrdtool-1.2.27]# 安装 Cacti 服务器套件: [root@localhost ~]# cd /var/www/html/ [root@localhost html]# tar xzvf /home/tom/cacti-0.8.7b-cn-utf8.tar.gz [root@localhost html]# [root@localhost html]# mv cacti-0.8.7b-cn-utf8 cacti [root@localhost html]# useradd cactiuser [root@localhost html]# chown -R cactiuser:cactiuser cacti/rra/ cacti/log/ [root@localhost html]# 设置检测数据库: [root@localhost html]# mysqladmin -u root password "123456" [root@localhost html]# mysql -u root -p mysql> CREATE DATABASE cactidb DEFAULT CHARACTER SET utf8; Query OK, 1 row affected (0.00 sec) mysql> GRANT all ON cactidb.* TO cactiuser@localhost IDENTIFIED BY '123456'; Query OK, 0 rows affected (0.00 sec) mysql> quit [root@localhost html]# mysql -u cactiuser -p cactidb < cacti/cacti.sql
注:cacti.sql 数据文件在cacti解压的包中,请注意路径! Enter password: 调整 Cacti 配置文件: [root@localhost ~]# cd /var/www/html/cacti/ [root@localhost cacti]# vim include/config.php $database_type = "mysql"; $database_default = "cactidb"; $database_hostname = "localhost"; $database_username = "cactiuser"; $database_password = "123456"; $database_port = "3306"; $config['url_path'] = "/"; [root@localhost cacti]# 调整httpd服务并重启服务: [root@localhost ~]# vim /etc/httpd/conf/httpd.conf DocumentRoot "/var/www/html/cacti" DirectoryIndex index.html index.html.var index.php <Directory "/var/www/html/cacti"> Options None AllowOverride None Order allow,deny Allow from all </Directory> [root@localhost ~]# service httpd restart [root@localhost ~]# ----------------------- 打开http://192.168.1.3 初始化后,默认登录名:admin,密码:admin(初次登录要改密码, 例如可以修改为 123456) 设置版本和字体路径: RRDTool默认字体路径 rrdtool v1.2以上版本所使用的Truetype字体路径. /usr/share/fonts/chinese/TrueType/ukai.ttf 添加被监测的设备或主机: 指定被监测的主机地址等连接参数 指定需要监测的具体项目(CPU占用、内存使用等) 生成监测图像: 根据设置的监测项目创建图像 将图像添加到监测树以方便查看 添加 cron计划任务,以定期采集数据: 以cactiuser 用户身份采集数据 执行命令:php /var/www/html/cacti/poller.php 通过crontab设置每 5分钟采集一次监测数据 查看图形化监测结果: 按日、周、月、年等分别查看监测图像曲线 可以指定时间进行查询