centos7安装配置cacti

第一步:(cacti的安装)

yum install net-snmp net-snmp-utils

yum install cacti

vi /etc/snmp/snmpd.conf

com2sec notConfigUser  default       public 

access  notConfigGroup ""      any       noauth    exact  systemview none none 

view all    included  .1           80

view    systemview    included   .1.3.6.1.2.1.1

view    systemview    included   .1.3.6.1.2.1.25.1.1

view    systemview    included   .1.3.6.1.2.1.2

systemctl start snmpd.service

netstat -tunlp

snmpwalk -v 2c -c public 127.0.0.1 if

whereis cacti

cacti: /etc/cacti /usr/share/cacti

find / -name cacti.sql

/usr/share/doc/cacti-0.8.8b/cacti.sql

create database cacti;

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

flush privileges;

use cacti;

source /usr/share/doc/cacti-0.8.8b/cacti.sql;

vi /usr/share/cacti/include/config.php

$database_type = "mysql";

$database_default = "cacti";

$database_hostname = "127.0.0.1";

$database_username = "cacti";

$database_password = "cacti";

$database_port = "3306";

第二步:(apache的配置)

因为是yum安装的,所以在/etc/httpd/conf.d/下自动生成了cacti.conf配置文件,默认如下:

Alias /cacti    /usr/share/cacti

<Directory /usr/share/cacti/>

        <IfModule mod_authz_core.c>

                # httpd 2.4

                Require host localhost

        </IfModule>

        <IfModule !mod_authz_core.c>

                # httpd 2.2

                Order deny,allow

                Deny from all

                Allow from localhost

        </IfModule>

</Directory>

<Directory /usr/share/cacti/install>

</Directory>

<Directory /usr/share/cacti/log>

        <IfModule mod_authz_core.c>

                Require all denied

        </IfModule>

        <IfModule !mod_authz_core.c>

                Order deny,allow

                Deny from all

        </IfModule>

</Directory>

<Directory /usr/share/cacti/rra>

        <IfModule mod_authz_core.c>

                Require all denied

        </IfModule>

        <IfModule !mod_authz_core.c>

                Order deny,allow

                Deny from all

        </IfModule>

</Directory>

第三步:(报错)

报错1:

[Mon Jan 18 11:56:36.849529 2016] [authz_host:error] [pid 13997] [client 110.110.110.110:61446] AH01753: access check of 'localhost' to /cacti failed, reason: unable to get the remote host name

[Mon Jan 18 11:56:36.849636 2016] [authz_core:error] [pid 13997] [client 110.110.110.110:61446] AH01630: client denied by server configuration: /usr/share/cacti

解决:(详解自己搜索apache2.2和2.4的区别)

apache-2.2的

Order deny,allow  

Allow from all  

Allow from host ip

更改为apache-2.4的

Require all granted  

Require host ip

报错2:

cacti第一次admin无法访问

解决:

cd /var/lib/php

chmod 777 session/即可

第四步:

crontab -e   #设置每隔5分钟Cacti采集一次数据

*/5 * * * * php   /usr/share/cacti/poller.php  &> /dev/null

service crond start #启动crond

/usr/bin/php  /usr/share/cacti/poller.php   #手动刷新数据

至此,Cacti监控服务器安装完成



本文转自 guowang327 51CTO博客,原文链接:http://blog.51cto.com/guowang327/1736067,如需转载请自行联系原作者

上一篇:eaacelerator配置样例


下一篇:Centos7配置.htaccess开启URL伪静态方法