安装配置cacti

1. 安装rrdtool
yum install rrdtool

2. 安装snmp
yum install net-snmp net-snmp-libs net-snmp-utils

3. 安装apache、php、mysql
yum install httpd php php - mysqlphp - snmpphp - xml php - gdmysql mysql-server mysql-devel
chkconfig httpd --level 35 on
chkconfig mysqld --level 35 on
chkconfig snmpd --level 35 on
service httpd start
service mysqld start
service snmpd start

4. 创建mysql用户并授权
create database cacti;
CREATE USER 'cacti'@'localhost' IDENTIFIED BY '123456';
grant all privileges on cacti.* to 'cacti'@'localhost';
FLUSH PRIVILEGES;

5. 导入数据库表
mysql
use cacti;
source /var/www/cacti/cacti.sql;

6. 下载cacti最新版本
http://www.cacti.net/download_cacti.php

解压缩
tar zxvf cacti-0.8.8b.tar.gz

移动到web目录
cd ..
mv cacti-0.8.8b /var/www/cacti

修改web配置文件
vim /var/www/cacti/include/config.php
$database_type = "mysql";
$database_default = "cacti";
$database_hostname = "localhost";
$database_username = "cacti";
$database_password = "123456";
$database_port = "3306";
$database_ssl = false;


//$url_path = "/cacti/";
$url_path = "/";


7. 导入数据库表
mysql
use cacti;
source /var/www/cacti/cacti.sql;

8. 修改snmp配置

vim /etc/snmp/snmpd.conf

#将下边这行中的default
com2sec notConfigUser default public
#改为127.0.0.1
com2secnotConfigUser 127.0.0.1 public

#将下边这行中的systemview
access notConfigGroup "" any noauth exact systemview nonenone
#改为all
access notConfigGroup "" any noauth exact all none none

#将下边这行的注释“#”号去掉
#view all included .1 80

重启snmp服务 
/etc/init.d/snmpd restart

9. 设置定时任务
修改php时区
vim /etc/php.ini
display_errors = On
date.timezone = Asia/Shanghai

crontab -e
*/5 * * * * /usr/bin/php /var/www/cacti/poller.php > /dev/null2>&1

10. 配置httpd
编辑httpd配置文件
vim /etc/httpd/conf/httpd.conf
Listen 81

VirtualHost *:81
      DocumentRoot/var/www/cacti
      ServerNamecacti.5lejob.com
      ErrorLoglogs/error_log-cacti.5lejob.com
      CustomLoglogs/access_log-cacti.5lejob.com common
/VirtualHost

/etc/init.d/httpd restart

访问地址
http://10.10.10.10:81

客户端配置
#在被监控的linux主机上安装net-snmp
yum install net-snmp

vim /etc/snmp/snmpd.conf

#更改以下部分
#将下边这行中的default
com2sec notConfigUser default public
#改为cacti服务器的地址
com2sec notConfigUser server_ip public

#将下边这行中的systemview
access notConfigGroup "" any noauth exact systemview nonenone
#改为all
access notConfigGroup "" any noauth exact all none none

#将下边这行的注释“#”号去掉
#view all included .1 80

重启 snmp 服务
chkconfig snmpd --level 35 on
/etc/init.d/snmpd restart

如果客户端开启了iptables,需要增加规则
vim /etc/sysconfig/iptables
-A INPUT -p udp -m udp --dport 161 -j ACCEPT
重启iptables
/etc/init.d/iptables restart

然后再服务器上测试一下
snmpwalk -c public -v 2c 被监控主机ip
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值