一、 环境介绍
1、 系统环境:(最小化安装)
[root@cacti ~]# cat /etc/redhat-release
CentOS release 6.8 (Final)
2、 cacti版本:0.8.8d
原因:因为要安装weathermap插件,在weathermap官网上查询weathermap最新版0.98 是不支持cacti1的。所以选择cacti0.8.8d

3、 关闭selinux和防火墙iptables
[root@cacti ~]# service iptables stop
[root@cacti ~]# chkconfig iptables off
[root@cacti ~]# setenforce 0
[root@cacti ~]# vim /etc/selinux/config
SELINUX=disabled
4、 注意:时间一定要正确
5、cacti官网:https://www.cacti.net/
二、安装 cacti0.8.8d
1、安装基础环境(LAMP)
①安装mysql
[root@cacti ~]# yum -y install mysql-server
②安装httpd
[root@cacti ~]# yum -y install httpd
修改httpd配置文件(防止启动时候报错)
[root@cacti ~]# vim /etc/httpd/conf/httpd.conf
第276行 找到#ServerName [www.example.com:80](http://www.example.com/) 把#号注释拿掉,将 [www.example.com:80](http://www.example.com/) 改为 localhost:80
③安装php
[root@cacti ~]# yum -y install php php-mysql
2、安装cacti所需要的库文件
[root@cacti ~]# yum -y install zlib freetype libjpeg fontconfig gd libxml2 zlib freetype libjpeg fontconfig gd libxml2 php-gd
3、安装rrd工具
[root@cacti ~]# yum -y install rrdtool rrdtool-devel
4、安装并配置snmp
[root@cacti ~]# yum -y install net-snmp net-snmp-devel net-snmp-utils
[root@cacti ~]# vim /etc/snmp/snmpd.conf
第41行:将 com2sec notConfigUser default public 中的 "default" 改为 "127.0.0.1" 第62行:将 access notConfigGroup "" any noauth exact systemview none none 中的 "systemview" 改为 "all" 第85行:将 #view all include .1 80 这一行前面的 # 号去掉
3、 启动服务并设置开机自启动
[root@cacti ~]# service httpd start
[root@cacti ~]# service mysqld start
[root@cacti ~]# service snmpd start
[root@cacti ~]# chkconfig httpd on
[root@cacti ~]# chkconfig mysqld on
[root@cacti ~]# chkconfig snmpd on
6、安装cacti
[root@cacti ~]# wget [http://www.cacti.net/downloads/cacti-0.8.8d.tar.gz](http://www.cacti.net/downloads/cacti-0.8.8d.tar.gz)
[root@cacti ~]# tar -xvf cacti-0.8.8d.tar.gz
[root@cacti ~]# mv cacti-0.8.8d /var/www/html/cacti
7、设置mysql数据库(开始数据库是没有密码的,安全起见要设置数据库密码)
[root@cacti ~]# mysql_secure_installation
[root@cacti ~]# mysql -uroot -p
Enter password:
mysql> create database cacti;
mysql> grant all privileges on cacti.* to cacti@localhost identified by 'cacti' with grant option;
mysql> flush privileges;
mysql> use cacti;
mysql> source /var/www/html/cacti/cacti.sql;
mysql> exit
8、配置cacti
[root@cacti ~]# vim /var/www/html/cacti/include/config.php
$database_type = "mysql"; #数据库类型
$database_default = "cacti"; #数据库名
$database_hostname = "localhost"; #数据库位置(我们的在本机上)
$database_username = "cacti"; #数据库用户名
$database_password = "cacti"; #数据库密码
$database_port = "3306"; #端口
9、创建用户、配置相关权限、计划任务
[root@cacti ~]# useradd cacti -d /var/www/html/cacti -s /sbin/nologin
useradd: warning: the home directory already exists.
Not copying any file from skel directory into it.
###报错无所谓
[root@cacti ~]# chown -R cacti /var/www/html/cacti/rra /var/www/html/cacti/log
[root@cacti ~]# echo '*/5 * * * * root /usr/bin/php /var/www/html/cacti/poller.php > /dev/null 2>&1' >> /etc/crontab
三、初始化 cacti
1、访问你的cacti
http://your IP/cacti
如果显示的页面和这个一样.说明你前面配置的没有问题了。直接按next


2、看路径是否都能找到
都显示OK证明路径都找到

3、登入.

4、第一次登陆后要修改密码(修改成自己的密码)

5、完成安装

四、配置客户端
[root@cacti ~]# yum -y install net-snmp net-snmp-utils
[root@cxm2 ~]# vim /etc/snmp/snmpd.conf



开启服务
[root@cxm2 ~]# service snmpd restart


客户端地址




加图像树




网友评论