CACTI 安装方法
基础环境安装
一。安装mysql
tar xzvf mysql-5.0.33.tar.gz
cd mysql-5.0.33
shell> groupadd mysql
shell> useradd -g mysql mysql
shell> gunzip < mysql-VERSION.tar.gz | tar -xvf -
shell> cd mysql-VERSION
shell> ./configure --prefix=/usr/local/mysql
shell> make
shell> make install
shell> cp support-files/my-medium.cnf /etc/my.cnf
shell> cd /usr/local/mysql
shell> bin/mysql_install_db --user=mysql
shell> chown -R root .
shell> chown -R mysql var
shell> chgrp -R mysql .
shell> bin/mysqld_safe --user=mysql &
二。APACHE安装
tar xzvf httpd-2.0.58.tar.gz
./configure --prefix=/usr/local/apache2 --enable-mods-shared=all --enable-so --enable-proxy --enable-proxy_http=shared --enable-module=so --enable-mods-shared=all
make
make install
三。PHP安装
软件名称: zlib-1.2.3.tar.gz
安装路径:zlib-1.2.3.tar.gz
安装过程:/usr/local
tar xzf zlib-1.2.3.tar.gz
cd zlib-1.2.3
./configure
make
make install
软件名称:libpng-1.2.20.tar.gz
安装路径:/usr/local
安装过程:
tar xjf libpng-1.2.20.tar.gz
cd libpng-1.2.10
./configure
make
make check
make install
软件名称: gd-2.0.35.tar.gz
安装路径:/usr/local/
安装过程:
tar xzf gd-2.0.35.tar.gz
cd gd-2.0.32
./configure
make
make install
tar xzvf php-5.2.4.tar.gz
cd php-5.2.4
./configure --prefix=/usr/local/php --with-apxs2=/usr/local/apache2/bin/apxs --with-mysql=/usr/local/mysql --with-gd --with-zlib --enable-versioning --enable-mbstring --with-zlib-dir=/usr/local/lib --enable-sockets
如果你的机器是64位,并且在安装php时候出现下面错误:
/usr/bin/ld: /usr/local/lib/libz.a(compress.o): relocation R_X86_64_32 can not be used when making a shared object; recompile with -fPIC
/usr/local/lib/libz.a: could not read symbols: Bad value
collect2: ld returned 1 exit status
以上错误是由于zlib编译的问题
需要更改zlib Makefile文件
vi Makefile
找到 CFLAGS=-O3 -DUSE_MMAP 在后面加入-fPIC,即变成CFLAGS=-O3 -DUSE_MMAP -fPIC
cp php.ini-recommended /usr/local/php/lib/ 并注意以下内容 “mysql.default_socket = /var/lib/mysql/mysql.sock”
在/usr/local/apache2/conf/httpd.conf 中添加以下两行:
AddType application/x-httpd-php .php .phtml .html .htm
AddType application/x-httpd-php-source .phps
安装CACTI:
tar zxvf rrdtool.tar.gz
cd rrdtool-1.2.23
./configure
make && make install
注意:
rrdtool需要tcl开发库的支持,否则会出现编译错误,请安装
tcl-devel-8.4.7-2.i386.rpm
tcl-html-8.4.7-2.i386.rpm
tclx-devel-8.3.5-4.i386.rpm
tclx-doc-8.3.5-4.i386.rpm
修改:进入 /rrdtool-1.2.12/bindings/perl-shared,编辑Makefile
删除 OPTIMIZE = -O2 -g -pipe -m32 -march=i386 -mtune=pentium4 中的 -mtune=pentium4
---这个可能和gcc版本有关
Rrdtool安装完毕
mysql 相关设置:
# /usr/local/mysql/bin/mysql -u root
mysql> create database cactidb;
mysql> grant all on cactidb.* to root;
mysql> grant all on cactidb.* to root@localhost;
mysql> grant all on cactidb.* to cactiuser;
mysql> grant all on cactidb.* to cactiuser@localhost;
mysql> set password for cactiuser@localhost=password('XXX');
注:以上语句输出 Query OK, 0 rows affected (0.01 sec) 表示成功
mysql> flush privileges;
mysql> exit
Mysql设置完毕
安装/ 配置cacti
# useradd cactiuser -g users
# passwd cactiuser (pwd:cactipw)
# cp cacti-0.8.6j.tar.gz /www/htdocs/
# cd /www/htdocs/
# tar zxvf cacti-0.8.6j.tar.gz
# mv cacti-0.8.6j cacti
# cd cacti
# /usr/local/mysql/bin/mysql -u root -pmysql cactidb < cacti.sql
# chown -R cactiuser rra/
# chown -R cactiuser log/
# cd scripts
# chown cactiuser:users *make
# vi /www/htdocs/cacti/include/config.php
$database_type = “mysql”;
$database_default = “cactidb”;
$database_hostname = “localhost”;
$database_username = “cactiuser”;
$database_password = “XXX”;
更改用户、密码 等项 与上面给出的对应 保存退出
全部设置完毕。
设置APACHE 访问权限:
Alias /cacti "/usr/local/apache2/htdocs/cacti/"
Options Indexes FollowSymLinks
AllowOverride None
Order allow,deny
Allow from all
# crontab -u cactiuser -e
加入
*/5 * * * * /www/php/bin/php /www/htdocs/cacti/poller.php > /dev/null 2>&1
保存退出:wq
打开浏览器 进入cacti的初始设置页面
apache将以目录形式显示内容,点击index.php
确保以下目录正确:
snmpwalk Binary Path : /usr/bin/snmpwalk
snmpget Binary Path: /usr/bin/snmpget
snmpbulkwalk Binary Path: /usr/bin/snmpbulkwalk
snmpgetnext Binary Path: /usr/bin/snmpgetnext
RRDTool Binary Path: /usr/local/rrdtool-1.2.23/bin/rrdtool
PHP Binary Path: /usr/local/php/bin//php
Cacti Log File Path: /usr/local/apache2/htdocs/cacti/log/cacti.log
Cactid Poller File Path: /usr/local/apache2/htdocs/cacti/poller.php
如果目录不正确指定到正确的目录。
第一次默认登陆账号:admin 密码 admin
登陆后在新改个密码就OK
确保php及/etc/mysql.cnf 指定同一个SOCKET文件
变更snmpd.conf
添加以下内容:
view systemview included .1
disk /
disk /boot
重新启动snmp:
/etc/init.d/snmpd restart
到此安装过程全部完成。使用方法请参见其他文档
阅读(1179) | 评论(0) | 转发(0) |