Centos7部署cacti


 1.安装LAMP环境

# yum install httpd* php* mariadb* net-snmp* rrdtool rrdtool-php rrdtool-perl rrdtool-devel gd gd-devel php-gd
2.配置snmp
# vi /etc/snm/snmpd.conf
41 default >   127.0.0.1
62 systemview >   all
85  #    删掉
3.Mariadb配置
1)启动
# systemctl start mariadb.service 
2)为root设置密码
# mysql -uroot -p(密码)  没有密码去掉-p直接回车
# use mysql;
# update user set password=password(新密码) where user='root' 
# grant all privileges on *.* to root@localhost identified by '123.org' with grant option;
# flush privilegs; //立即生效
3)创建cacti数据库并创建用户
# create database cacti default character set utf8; //创建cacti数据库
# flush privilegs; //立即生效
# grant all privileges on cacti.* to cacti@localhost identified by '123.org' with grant option; //创建cacti用户并授权
# flush privilegs;
4.cacti配置
1)下载
# wget http://www.cacti.net/downloads/cacti-0.8.8f.tar.gz  
2)配置
# tar zxvf cacti-0.8.8f.tar.gz
# mv cacti-0.8.8f /var/www/html/cacti    //移动
# mysql -urcacti -p123.org cacti < /var/www/html/cacti/cacti.sql  //导入数据库
# vi /var/www/html/cacti/include/config.php
# vi /var/www/html/cacti/include/global.php //修改两个文件,一样,如下
$database_type = "mysql";
$database_default = "cacti";
$database_hostname = "localhost";
$database_username = " cacti";
$database_password = " 123.org";
$database_port = "3306";
$database_ssl = false;
# useradd -r -M cacti
# chown -R cacti /var/www/html/cacti/rra/
# chown -R cacti /var/www/html/cacti/log/ //修改这两个文件属性
5.创建计划任务
# crontab -e
*/5 * * * * php /var/www/html/cacti/poller.php > dev/null 2>&1
6.调试
1)启动服务
# systemlctl stat httpd.service //启动http服务
若无法访问修改firewalld
# friewall-cmd --permanent --zone=public --add-port=80/tcp
# friewall-cmd --permanent --zone=public --add-port=3306/tcp
# friewall-cmd --permanent --zone=public --add-port=161/udp
再次访问
# vi /var/www/html/index.php     //编辑一个php测试文档
<?php
phpinfo();
?>
2)修改服务属性
# systemctl enable snmpd
# systemctl enable mariadb
# systemctl enable httpd
# systemctl enable crond
# systemctl start crond
# systemctl start snmpd
7.安装
web访问127.0.0.1/cacti安装
8.安装spine
因cacti自带cmd.php轮询数据较慢,可以安装spine。
1)下载
# wget http://www.cacti.net/downloads/spine/cacti-spine-0.8.8f.tar.gz
2)安装
# tar zxvf cacti-spine-0.8.8f.tar.gz
# cd cacti-spine-0.8.8f
# ./configure
# make && make install
3)配置
# cp /usr/local/spine/etc/spine.conf.dist /etc/spine.conf
4)测试
# /usr/local/spine/bin/spine
6)cacti设置
进入cacti页面设置spine路径
Console -> Configuration -> Settings -> Paths -> Alternate Poller Path -> Spine Poller File Path/usr/local/spine/bin/spine
修改Cacti使用的Poller TypeConsole -> Cacti Settings->Poller->Poller Type在下拉中选择spine
修改计划任务
# crontab -e
*/1 * * * * php /var/www/html/cacti/poller.php > /dev/null 2>&1
查看
 

转载于:https://www.cnblogs.com/wazy/p/7717374.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值