cisco+++mysql_搭建cacti监控linux服务器,cisco,华为,mysql,

首先先安装cacti的依赖包:

/etc/init.d/iptables stop  先将防火墙关闭,不然后面会报各种的错误。

yum install  http php php-mysql php-snmp mysql mysql-server net-snmp net-snmp-libs net-snmp-utils php-pdo perl-DBD-MySQL -y

yum install  rrdtool rrdtool-devel rrdtool-php -y  (安装cacti绘图软件)

cd /usr/local/src/

wget http://www.cacti.net/downloads/cacti-0.8.8b.tar.gz     (下载cacti软件)

以上软件大家没有的话去我的网盘下去下载,因为每个人的系统都不一样,我使用的是centos。

tar xvf cacti-0.8.8b.tar.gz

mv cacti-0.8.8b /var/www/html/cacti

/etc/init.d/mysqld restart     (启动mysqld数据库)

mysqladmin -u root -p password "mysql"  (设置mysql密码为“mysql”)

mysql -p  (进入mysql)

Enter password: (输入你的密码)

mysql> create database cacti;   (创建cacti用户)

mysql> grant all privileges on cacti.* to cacti@localhost identified by 'cacti' with grant option;  (授权cacti用户)

mysql> grant all privileges on cacti.* to cacti@127.0.0.1 identified by 'cacti' with grant option; (授权cacti用户)

我这里主机名是localhost 大家要看自己的主机名

查看主机名方法:

[root@localhost ~]# hostname

localhost

mysql> use cacti; (进入cacti用户)

mysql> source /var/www/html/cacti/cacti.sql;  (导入数据)

配置cacti以连接数据库

vi /var/www/html/cacti/include/config.php

修改cacti连接数据库的用户和密码

---------------------------------------------------

$database_username = "cacti";

$database_password = "cacti";

----------------------------------------------------

/etc/init.d/httpd restart  (启动http服务)

到现在为止离成功一半了。

用浏览器打开 http://192.168.0.20/cacti ,会显示 cacti的安装指南,设置下就ok了。

434405

选择next

434405

点击next

434405

点击finish 完成

然后输入用户名密码

默认用户:admin

密码:cacti

-------------------------------------------------------------------------------------------------------------------------------------

接下来就是讲解cacti如何使用

配置snmp

vi /etc/snmp/snmp.conf

#将下边这行中的default

com2secnotConfigUser default public

#改为127.0.0.1

com2secnotConfigUser 127.0.0.1 public

#将下边这行中的systemview

access notConfigGroup "" any noauth exact systemview none none

#改为all

access notConfigGroup "" any noauth exact all none none

#将下边这行的注释“#”号去掉

#view all included .1 80

service snmpd restart增加入一个计划任务,使得 cacti 每五分钟生成一个监控图表。

crontab -e

#加入如下内容。注意poller.php的路径

*/5 * * * * php /var/www/html/cacti/poller.php > /dev/null 2>&1

确保 /var/www/html/cacti/rra/目录存在

如果暂时未看到图表,可以手工执行,生成图表

php /var/www/html/cacti/poller.php > /dev/null 2>&1

--------------------------------------------------------------------------------

接下来就是设置你要监控的服务器

yum install net-snmp

---------------------------------------------------------------------------------

vi /etc/snmp/snmp.conf

#将下边这行中的default

com2secnotConfigUser default public

#改为服务器地址

com2secnotConfigUser 192.168.0.20 public

#将下边这行中的systemview

access notConfigGroup "" any noauth exact systemview none none

#改为all

access notConfigGroup "" any noauth exact all none none

#将下边这行的注释“#”号去掉

#view all included .1 80

service snmpd restart

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值