分类: LINUX
2010-09-14 22:41:55
所需软件:
http
Php
Php-mysql
php-pdo
Php-snmp
Mysql
Mysql-server
Perl-DBD-MySQL
Php-pdo
Net-snmp
Net-snmp-libs
Net-snmp-utils
curl-7.15.0.tar.gz
freetype-2.1.9.tar.gz
gettext-0.16.1.tar.gz
gd-2.0.35.tar.gz
jpegsrc.v6b.tar.gz
libart_lgpl-2.3.17.tar.gz
libpng-1.2.18.tar.gz
libxml2-2.6.32.tar.gz
zlib-1.2.3.tar.gz
libxml2-2.6.32.tar.gz
编译安装libxml
[root@localhost ~]# tar zxvf libxml2-2.6.32.tar.gz
[root@localhost ~]# cd libxml2-2.6.32.tar.gz
[root@localhost ~]# ./configure --prefix=/usr/local/libxml2/
[root@localhost ~]#make && make install
编译安装zlib
[root@localhost ~]# tar zxvf zlib-1.2.3.tar.gz
[root@localhost ~]# cd zlib-1.2.3
[root@localhost ~]#./configure --prefix=/usr/local/zlib2/
[root@localhost ~]# make && make install
编译安装jpeg支持
[root@localhost ~]# tar -zxf jpegsrc.v6b.tar.gz
[root@localhost ~]# cd jpeg-6b/
[root@localhost ~]# mkdir /usr/local/jpeg6/include
[root@localhost ~]# mkdir /usr/local/jpeg6/bin
[root@localhost ~]# mkdir -p /usr/local/jpeg6/man/man1
[root@localhost ~]# mkdir /usr/local/jpeg6/lib
[root@localhost ~]# ./configure --prefix=/usr/local/jpeg6
[root@localhost ~]# make
[root@localhost ~]# make install-lib
[root@localhost ~]# make install
编译安装 libpng
[root@localhost ~]# tar zxvf libpng-1.2.18.tar.gz
[root@localhost ~]# cd libpng-1.2.18.tar.gz
[root@localhost ~]#cp scripts/makefile.gcmmx makefile
[root@localhost ~]# cp /usr/local/zlib2/include/* /usr/local/include/
[root@localhost ~]# cp /usr/local/zlib2/lib/* /usr/local/lib
[root@localhost ~]#./configure --disable-shared --prefix=/usr/local/libpng2/
[root@localhost ~]# make && make install
编译安装 freetype
[root@localhost ~]# tar zxvf freetype-2.1.9.tar.gz
[root@localhost ~]# cd freetype-2.1.9
[root@localhost ~]#./configure --disable-shared --prefix=/usr/local/freetype2/
[root@localhost ~]# make && make install
编译安装 libart_lgpl
[root@localhost ~]# tar zxvf libart_lgpl-2.3.17.tar.gz
[root@localhost ~]# cd ibart_lgpl-2.3.17
[root@localhost ~]#./configure --disable-shared --prefix=/usr/local/libart/
[root@localhost ~]# make && make install
编译安装 gettext
[root@localhost ~]#tar zxvf gettext-0.16.1.tar.gz
[root@localhost ~]#cd gettext-0.16.1
[root@localhost ~]# ./configure --prefix=/usr/local/gettext/
[root@localhost ~]# make && make install
编译安装 gd 库 :
[root@localhost ~]# tar zxvf gd-2.0.35.tar.gz
[root@localhost ~]# cd gd-2.0.35
[root@localhost ~]#cp /usr/lib/libattr.* /lib/
[root@localhost ~]# ./configure --prefix=/usr/local/gd2 --with-zlib=/usr/local/zlib2/ --with-png=/usr/local/libpng2/ --with-jpeg=/usr/local/jpeg6/--with-freetype=/usr/local/freetype2/--with-libart=/usr/local/libart/ --with-gettext=/usr/local/gettext/ --with-libxml=/usr/local/libxml2
[root@localhost ~]# make && make install
编译安装 Curl 支持
[root@localhost ~]# tar zxvf curl-7.15.0.tar.gz
[root@localhost ~]# cd curl-7.15.0
[root@localhost ~]# ./configure --prefix=/usr/local/curl
[root@localhost ~]# make && make install
编译安装 rrdtools
[root@localhost ~]# tar zxvf rrdtool-1.2.27.tar
[root@localhost ~]# cd rrdtool-1.2.27
[root@localhost ~]# ./configure --prefix=/usr/local/rrdtool
[root@localhost ~]# make && make install
如果 ./configure 时出现下面这个错误
configure: error: Please fix the library issues listed above and try again.
表明系统有功能缺失,需安装 libart_lgpl-devel.rpm 这个包
如果还是提示听样的错误,有可能是找不到 FreeType
把 /usr/local/freetype2/lib/pkgconfig 下的 .pc 文件拷贝到 /usr/lib/pkgconfig 下即可
把/usr/local/freetype2/bin/* 拷贝到/usr/bin/下
把/usr/local/freetype2/lib/* 拷贝到/usr/lib/下
把/usr/local/freetype2/include/* 拷贝到/usr/include/下
如果 make install 时出现 [tclrrd.o] 错误
就安装 tcl-8.4.7-2.i386.rpm 以及 tcl-devel-8.4.7-2.i386.rpm 这 2 个包
将cacti文件复制到/var/www/html/cacti
[root@localhost ~]#Chmod –R 777 /var/www/html/cacti
创建cacti所需数据库
Create database cacti;
导入cacti表到cacti数据库
Use cacti;
Source /var/www/html/cacti/cacti.sql;
创建数据库用户
GRANT ALL ON cacti.* TO cactiuser@localhost IDENTIFIED BY 'chenmincacti';
修改/var/www/html/cacti/include/config.php
[root@localhost ~]#Vim /var/www/html/cacti/include/config.php
$database_type = "mysql";
$database_default = "cacti";
$database_hostname = "localhost";
$database_username = "cactiuser";
$database_password = "chenmincactir";
$database_port = "3306";
添加任务计划
[root@localhost ~]#crontab –e
*/5 * * * * /usr/bin/php /var/www/html/cacti/poller.php > /dev/null 2>&1
每五分钟采集一次数据
安装cacti
安装完后设置rratool版本与与你所用的rratool一致
设置使用SNMP v2
稍微修改系统中 snmp 的配置
[root@localhost ~]# vi /etc/snmp/snmpd.conf
com2secnotConfigUser default public
改为:com2secnotConfigUser 127.0.0.1 public
access notConfigGroup "" any noauth exact systemview none none
改为:accessnotConfigGroup""anynoauthexact all none none
#view all included .1 80
将前面的 # 注释 去掉。
[root@localhost ~]# service snmpd restart
安装monitor thold
[root@localhost ~]#unzip cacti-plugin-0.8.7e-PA-v2.5.zip
[root@localhost ~]#cd cacti-plugin-0.8.7e-PA-v2.5
[root@localhost ~]#cp –a * /var/www/html/cacti/
[root@localhost ~]#mysql –u root –p123456 cactidb < pa.sql
[root@localhost ~]# patch -p1 -N < cacti-plugin-0.8.7e-PA-v2.5.diff
[root@localhost ~]# vi /var/www/html/cacti/include/global.php
$plugins = array();
//$plugins[] = 'thold';
$plugins[] = 'thold';
$plugins[] = 'monitor';
$plugins[] = 'settings'
$config['url_path'] = '/'; 改为 $config['url_path'] = '/cacti/';
[root@localhost ~]#tar xvf monitor-0.7.tar.gz -C /var/www/html/cacti/plugins
[root@localhost ~]#tar xvf settings-0.5.tar.gz -C /var/www/html/cacti/plugins/
[root@localhost ~]# tar xvf thold-0.4.1.tar.gz -C /var/www/html/cacti/plugins/
点User management
选中plugin management
点plugin management
找到Thresholds配置页面,点install和enable
完成!