Linux安装Cacti及搭建lmap环境

激活额外的yum源,安装lmap环境

#yum install yum-priorities

#yum �Cy install mysql mysql-server php-mysql httpd php

#yum �Cy install php-pdo lm_sensors net-snmp php-snmp

Net-snmp-utils net-snmp-libs net-snmp-devel net-snmp-perl

Perl-Net-Daemon perl-PIRPC perl-DBI Perl-DBD-MySQL



安装rrdtool ,进入rrdtool文件所在文件夹,

Yum install rrdtool* --nogpgcheck



检查rrdtool和net-snmp是否安装成功
#chkconfig mysqld on

#chkconfig httpd on

#service mysqld start

#service httpd start

#service snmpd start



#vi /var/www/html/php.php

内容如下:

<?php

Phpinfo();

?>

打开http://x.x.x.x/php.php,如果看到配置信息,则lmap配置成功。



1, 创建mysql数据库

#mysql �Curoot �Cp

mysql>create database cacti;

mysql>grant all privileges on cacti.* to cactiuser@localhost identified by ‘123456’;

mysql>grant all privileges on cacti.* to cactiuser@localhost identified by ‘123455’;

msyql>flush privileges;

mysql> \q





2, 安装cacti

#tar zxvf cacti-0.8.7g.tar.gz

#mv cacti-0.8.7g /var/www/html/cacti

#cd /var/www/html/cacti

#mysql �Curoot �Cp cacti < cacti.sql

Password:123456



修改配置文件

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



$database_type = “mysql”;

$database_default = “cacti”;

$database_hostname = “localhost”;

$database_username = “cactiuser”;

$database_password = “123456”;

$database_port = “3306”;





添加cacti用户

#useradd cacti �Cd /var/www/html/cacti �Cs /bin/false

#chown �CR cacti /var/www/html/cacti/rra

#chown �CR /var/www/html/cacti/log

或者

#chown �ChR cacti /var/www/html/cacti/rra

#chown �ChR cacti /var/www/html/cacti/log

#vi /etc/httpd/conf/httpd.conf

在#ServerName www.example.com:80下增加一行

ServerName 127.0.0.1:80



找到AddType application/x-gzip .gz .tgz

在下面添加

AddType application/x-httpd-php .php

AddType application/x-httpd-php-source .phps

重启httpd服务,让上面的修改生效

#service httpd restart

然后输入http://x.x.x.x/cacti,打开会看到设置界面,

安装完成,登录用户名为admin,密码为admin



#chmod �CR 755 /var/www/html/cacti/poller.php

#vi /etc/crontab 最后添加一行

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



#/var/www/html/cacti/poller.php

如果报错,在poller.php添加一行

#!/usr/bin/php �Cq

出现上面这样就OK了,

#service crond restart



修改目录的属主

#chown �CR cacti.cacti /var/www/html/cacti/rra /var/www/html/cacti/log

如果监控没有图和数据,执行

#chmod �CR 777 /var/www/html/cacti/rra

#chmod �CR 777 /var/www/html/cacti/log

你可能感兴趣的:(linux,安装,配置,cacti,lmap)