centos6.6 安装cacti监控服务器

整理一份cacti的安装步骤.留作笔记和以后参考用.

环境:

centos 6.6 -x64

cacti-0.8.8b-cn.tar.gz

mysql yum安装即可

yum服务使用centos自带的就行.如果是红帽请自行解决yum.本文不赘述.

**注意:同步好服务器的时间.免得后面加上监控服务器不出图.

1.安装基础服务(LAMP)

#yum -y install mysql-server

 Installed:
mysql-server.x86_64 :5.1.-.el6 Dependency Installed:
perl-DBD-MySQL.x86_64 :4.013-.el6 perl-DBI.x86_64 :1.609-.el6 Complete!

安装httpd服务

# yum -y install httpd
Installed:
httpd.x86_64 :2.2.-.el6.centos
Dependency Installed:
apr.x86_64 :1.3.-.el6_2 apr-util.x86_64 :1.3.-.el6_0. apr-util-ldap.x86_64 :1.3.-.el6_0.
httpd-tools.x86_64 :2.2.-.el6.centos mailcap.noarch :2.1.-.el6 Complete!

安装php服务

 yum -y install php php-mysql
Installed:
php.x86_64 :5.3.-.el6_8
php-mysql.x86_64 :5.3.-.el6_8 Dependency Installed:
php-cli.x86_64 :5.3.-.el6_8
php-common.x86_64 :5.3.-.el6_8
php-pdo.x86_64 :5.3.-.el6_8 Complete!

检查以上软件是否安装成功

 [root@monitor-cacti ~]# rpm -qa |egrep 'php|httpd|mysql'
mysql-5.1.-.el6.x86_64
php-common-5.3.-.el6_8.x86_64
php-pdo-5.3.-.el6_8.x86_64
php-5.3.-.el6_8.x86_64
mysql-libs-5.1.-.el6.x86_64
mysql-server-5.1.-.el6.x86_64
httpd-tools-2.2.-.el6.centos.x86_64
httpd-2.2.-.el6.centos.x86_64
php-cli-5.3.-.el6_8.x86_64
php-mysql-5.3.-.el6_8.x86_64
[root@monitor-cacti ~]#

安装需要的库文件

 yum -y install zlib freetype libjpeg fontconfig gd libxml2 zlib freetype libjpeg fontconfig gd libxml2 php-gd

 Installed:
fontconfig.x86_64 :2.8.-.el6 freetype.x86_64 :2.3.-.el6 gd.x86_64 :2.0.-.el6 libjpeg-turbo.x86_64 :1.2.-.el6_5
php-gd.x86_64 :5.3.-.el6_8 Dependency Installed:
libX11.x86_64 :1.6.-.el6 libX11-common.noarch :1.6.-.el6 libXau.x86_64 :1.0.-.el6 libXpm.x86_64 :3.5.-.el6
libpng.x86_64 :1.2.-.el6_7 libxcb.x86_64 :1.11-.el6 Updated:
libxml2.x86_64 :2.7.-.el6_8. Complete!

如果yum安装都出现了Complete! 说明安装的没有问题.

2.安装rrd工具

 yum -y install rrdtool rrdtool-devel
Installed:
rrdtool.x86_64 :1.3.-.el6 rrdtool-devel.x86_64 :1.3.-.el6 Dependency Installed:
cairo.x86_64 :1.8.-.el6_6 dejavu-fonts-common.noarch :2.33-.el6
dejavu-lgc-sans-mono-fonts.noarch :2.33-.el6 dejavu-sans-mono-fonts.noarch :2.33-.el6
fontpackages-filesystem.noarch :1.41-1.1.el6 libXft.x86_64 :2.3.-.el6
libXrender.x86_64 :0.9.-2.1.el6_8. libthai.x86_64 :0.1.-.el6
pango.x86_64 :1.28.-.el6 pixman.x86_64 :0.32.-.el6 Complete!

3.安装并配置监控需要的snmp工具

 #yum -y install net-snmp net-snmp-devel net-snmp-utils
Installed:
net-snmp.x86_64 :5.5-.el6_8. net-snmp-devel.x86_64 :5.5-.el6_8. net-snmp-utils.x86_64 :5.5-.el6_8. Dependency Installed:
elfutils-devel.x86_64 :0.164-.el6 elfutils-libelf-devel.x86_64 :0.164-.el6 file-devel.x86_64 :5.04-.el6
keyutils-libs-devel.x86_64 :1.4-.el6 krb5-devel.x86_64 :1.10.-.el6 libcom_err-devel.x86_64 :1.41.-.el6
libselinux-devel.x86_64 :2.0.-.el6 libsepol-devel.x86_64 :2.0.-.el6 lm_sensors-devel.x86_64 :3.1.-.el6
lm_sensors-libs.x86_64 :3.1.-.el6 net-snmp-libs.x86_64 :5.5-.el6_8. openssl-devel.x86_64 :1.0.1e-.el6_8.
popt-devel.x86_64 :1.13-.el6 rpm-devel.x86_64 :4.8.-.el6 tcp_wrappers-devel.x86_64 :7.6-.el6
zlib-devel.x86_64 :1.2.-.el6 Dependency Updated:
elfutils-libelf.x86_64 :0.164-.el6 elfutils-libs.x86_64 :0.164-.el6 file.x86_64 :5.04-.el6
file-libs.x86_64 :5.04-.el6 krb5-libs.x86_64 :1.10.-.el6 libselinux.x86_64 :2.0.-.el6
libselinux-python.x86_64 :2.0.-.el6 libselinux-utils.x86_64 :2.0.-.el6 openssl.x86_64 :1.0.1e-.el6_8.
rpm.x86_64 :4.8.-.el6 rpm-libs.x86_64 :4.8.-.el6 rpm-python.x86_64 :4.8.-.el6
tcp_wrappers-libs.x86_64 :7.6-.el6 Complete!

配置snmp

 vim /etc/snmp/snmpd.conf
com2sec notConfigUser default public
改为:com2sec notConfigUser 127.0.0.1 public
access notConfigGroup "" any noauth exact systemview none none
改为:access notConfigGroup "" any noauth exact all none none
#view all included . 去掉注释

启动服务并加如开机启动

 #service httpd start
# service mysqld start
# service snmpd start
#chkconfig httpd on
#chkconfig mysqld on
#chkconfig snmpd on

安装cacti

 wget http://www.cacti.net/downloads/cacti-0.8.7e.tar.gz
tar zxf cacti-0.8.8b-cn.tar.gz -C /var/www/html/
cd /var/www/html/
mv cacti-0.8.8b-cn/ cacti

初始化数据库

 # mysql -u root
mysql> create database cacti;
mysql> grant all on cacti.* to cacti@localhost identified by 'cacti';
mysql> grant all on cacti.* to cacti@'127.0.0.1' identified by 'cacti';
mysql> flush privileges;
mysql> use cacti;
mysql> source cacti.sql;
8 mysql> quit

配置cacti

 vim /var/www/html/cacti/include/config.php
$database_type = "mysql";
$database_default = "cacti";
$database_hostname = "localhost";
$database_username = "cacti";
$database_password = "cacti";
$database_port = ""; 把配置文件里改成和这里一样的就可以了.

设置相关权限和计划任务.

 useradd cacti -d /var/www/html/cacti -s /sbin/nologin
chown -R cacti /var/www/html/cacti/rra /var/www/html/cacti/log
3 echo '*/5 * * * * root /usr/bin/php /var/www/html/cacti/poller.php > /dev/null 2>&1' >> /etc/crontab

初始化cacti

访问你的cacti.地址如下.红色替换成你的服务器ip

http://192.168.0.13/cacti

centos6.6 安装cacti监控服务器

如果显示的页面和这个一样.说明你前面配置的没有问题了.

直接点击next>>

centos6.6 安装cacti监控服务器

如果都显示ok则可以点击finish.如果有not found 则要看看是哪个命令或者路径不对.

finsh之后就是登录界面了,用户名和密码都是admin.

centos6.6 安装cacti监控服务器

第一次登录需要修改密码.如下

centos6.6 安装cacti监控服务器

填入新密码保存即可.

这样cacti就安装完成了.

上一篇:30道四则运算<2>


下一篇:Unity3D脚本--经常使用代码集