linux cacti安装教程,cacti安装教程

CentOS 6.0

架设流量监控及集中日志系统

第一章、cacti的安装

1、 系统的基本设置

2、 设置主机名

3、 [root@localhost ~]# vi /etc/sysconfig/network

4、 [root@localhost ~]# exit

5、 重新登陆

6、 [root@GZ-Cacti ~]#

7、 安装screen后台运行程序

yum -y install screen

8、 安装优秀的编辑器vim

yum -y install vim

9、 执行screen -S cacti进程进行安装程序防止断开远程导致安装中断

10、              cacti所需组件

http

Mysql

mysql-server

Php

Php-mysql

Php-snmp

php-cli

php-common

Perl-DBD-MySQL

Php-pdo

rrdtool

Net-snmp

Net-snmp-libs

Net-snmp-utils

rrdtool

yum安装这些组件

yum -y install httpd php php-mysql php-snmp php-cli php-common mysql mysql-server net-snmp net-snmp-libs net-snmp-utils php-pdo perl-DBD-MySQL rrdtool

#下载cacti

[root@GZ-cacti ~]# cd /home/

[root@GZ-cacti home]# wget http://www.cacti.net/downloads/cacti-0.8.7g.tar.gz

#解压cacti

[root@GZ-cacti home]# tar xvf cacti-0.8.7g.tar.gz

#进入cacti文件夹,将里面的文件移动到/var/www/html/

[root@GZ-cacti home]# cd cacti-0.8.7g

[root@GZ-cacti cacti-0.8.7g]#

[root@GZ-cacti cacti-0.8.7g]# mv * /var/www/html/

#启动apache及mysql服务

[root@GZ-cacti cacti-0.8.7g]# /etc/init.d/httpd restart

Stopping httpd:                                            [ OK ]

Starting httpd: httpd: Could not reliably determine the server's fully qualified domain name, using 61.140.3.66 for ServerName

[ OK ]

[root@GZ-cacti cacti-0.8.7g]# /etc/init.d/mysqld restart

Stopping mysqld:                                           [ OK ]

Starting mysqld:                                           [ OK ]

[root@GZ-cacti cacti-0.8.7g]#

#并将apache、mysql及network加入自启动

# chkconfig --level 35 httpd on

# chkconfig --level 35 mysqld on

#chkconfig network on

建立数据库

mysql> create database cacti;

mysql> grant all privileges on cacti.* to cactiuser@localhost identified by 'cacti' with grant option;

mysql>flush privileges;

导入cacti数据库

[root@GZ-cacti cacti-0.8.7g]# mysql -h localhost -u cactiuser -p cacti

Enter password:

[root@GZ-cacti cacti-0.8.7g]#

修改cacti配置文件

/* make sure these values refect your actual database/host/user/password */

$database_type = "mysql";

$database_default = "cacti";

$database_hostname = "localhost";

$database_username = "cactiuser";

$database_password = "cacti";

$database_port = "3306";

/* Default session name - Session name must contain alpha characters */

#$cacti_session_name = "Cacti";

暂时关闭防火墙

/etc/init.d/iptables stop

检查SELinux现时况态

要知到你现在是否使用 SELinux:

# getenforce

enforcing

关闭selinux

修改档案/etc/sysconfig/selinux

# This file controls the state of SELinux on the system.

# SELINUX= can take one of these three values:

#       enforcing - SELinux security policy is enforced.

#       permissive - SELinux prints warnings instead of enforcing.

#       disabled - SELinux is fully disabled.

SELINUX=enforcing

# SELINUXTYPE= type of policy in use. Possible values are:

#       targeted - Only targeted.NETwork daemons are protected.

#       strict - Full SELinux protection.

SELINUXTYPE=targeted

把 SELINUX设定为disable, 下次启动系统后将会停止SElinux。

# getenforce

disable

进入安装界面

http://(cacti-ip)/install/index.php

确保每个路径都正确点击下一步完成安装

配置snmp

vi /etc/snmp/snmp.conf

(7)配置snmp

vi /etc/snmp/snmp.conf

#将下边这行中的default

com2secnotConfigUser default public

#改为127.0.0.1

com2secnotConfigUser 127.0.0.1 Cacti

#将下边这行中的systemview

access notConfigGroup "" any noauth exact systemview none none

#改为all

access notConfigGroup "" any noauth exact all none none

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

#view all included .1 80

#重启snmpd服务

service snmpd restart

用这个命令进行测试能抓取信息为配置正确

snmpwalk -v 1 localhost -c Cacti

安装ntpdate并且停用自动更新

yum -y install ntpdate

/etc/init.d/ntpdate stop

chkconfig ntpdate off

以cacituser用户增加入一个计划任务,使得 cacti 每五分钟生成一个监控图表。

crontab -e

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

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

时间同步命令,每十分钟跟因特网同步时钟

*/10 * * * * ntpdate 210.72.145.44 > /dev/null 2>&1

并将rra和log文件夹赋予cactiuser以读写权限,poller.php文件赋予cactiuser用户运行权限

[cactiuser@localhost html]$ chmod 777 rra

[cactiuser@localhost html]$ chmod 777 log

[cactiuser@localhost html]$ chmod 755 poller.php

至此cacti安装完成,稍等五分钟刷新一下就可以出图

11、报错处理

1)/usr/bin/ld: cannot find -lmysqlclient 解决方法

原因是GCC 的默认搜索没有包含 /usr/lib/mysql

解决方法:

执行   export LIBRARY_PATH=/usr/lib/mysql

2)# make

false // No help2man // --output=spine.1 --name='Data Collector for Cacti' --no-info --version-option='--version' ./spine

make: *** [spine.1] Error 1报错

解决办法

需安装help2man解决

#yum -y install help2man

3)ERROR: Your

Cacti database login account does not haveaccess to the MySQL TimeZone

database. Please provide the Cacti databaseaccount "select" access to

the "time_zone_name" table inthe "mysql" database, and populate MySQL's

TimeZone informationbefore proceeding

错误解决办法

# grant all privileges on *.* to cacti@localhost identified by 'cacti';

# flush privileges;

4)ERROR: Your MySQL TimeZone database is not populated.Please populate this database  before proceeding.

解决办法# mysql_tzinfo_to_sql /usr/share/zoneinfo | mysql -u root -p mysql

12、参考资料

Cacti官网:http://www.cacti.net/index.php

Cacti官网论坛:http://forums.cacti.net/

Cacti文档:http://docs.cacti.net/

Cacti插件:http://cactiusers.org/index.php

Network Weathermap:http://www.network-weathermap.com/

RRDTool官网:http://oss.oetiker.ch/rrdtool/

NET-SNMP官方网站:http://www.net-snmp.org/

Apache官网:http://httpd.apache.org/

MySQL官网:http://www.mysql.com/

PHP官网:http://www.php.net/

  • 0
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
安装cacti需要以下步骤: 1.安装LAMP环境,即Linux、Apache、MySQL和PHP。 2.安装SNMP服务。 3.下载cacti软件包。 4.将cacti软件包解压缩到/var/www/html目录下。 5.创建cacti数据库。 6.将MySQL数据库中的cacti.sql导入到cacti数据库中。 7.配置cacti。 8.在Web浏览器中访问cacti。 具体步骤如下: 1.安装LAMP环境: # yum install httpd mariadb-server mariadb php php-mysql php-snmp net-snmp-utils -y # systemctl start httpd # systemctl start mariadb # systemctl enable httpd # systemctl enable mariadb 2.安装SNMP服务: # yum install net-snmp net-snmp-utils -y # systemctl start snmpd # systemctl enable snmpd 3.下载cacti软件包: # wget http://www.cacti.net/downloads/cacti-1.2.12.tar.gz 4.将cacti软件包解压缩到/var/www/html目录下: # tar -zxvf cacti-1.2.12.tar.gz -C /var/www/html/ # mv /var/www/html/cacti-1.2.12 /var/www/html/cacti 5.创建cacti数据库: # mysql -u root -p mysql> create database cacti; mysql> grant all privileges on cacti.* to cacti@localhost identified by 'password'; mysql> flush privileges; mysql> exit; 6.将MySQL数据库中的cacti.sql导入到cacti数据库中: # mysql -u cacti -p cacti < /var/www/html/cacti/cacti.sql 7.配置cacti: # cd /var/www/html/cacti/include/ # cp config.php.dist config.php # vi config.php 修改以下内容: $database_type = "mysql"; $database_default = "cacti"; $database_hostname = "localhost"; $database_username = "cacti"; $database_password = "password"; 8.在Web浏览器中访问cacti: 在浏览器中输入http://服务器IP地址/cacti/,进入cacti的安装向导,按照提示进行安装即可。

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值