最新消息:

中文cacti服务器安装配置

未分类 admin 1300浏览 0评论

1.获取软件

2.安装Apache软件

# cd /home/softeare/apache
# tar zxvf httpd-2.0.52.tar.gz
# cd httpd-2.0.52
# ./configure
–prefix=/usr/local/apache2
–enable-so
-enable-mods-shared=most
–with-mpm=worker
–enable-cache
–enable-disk-cache
–enable-mem-cache
# make
# make install

3.安装Mysql软件

shell> groupadd mysql
shell> useradd -g mysql mysql
shell> cd /usr/local
shell> tar zxvf mysql-5.0.45-linux-i686-glibc23.tar.gz
shell> mv mysql-5.0.45-linux-i686-glibc23 mysql
shell> cd mysql
shell> chown -R mysql .
shell> chgrp -R mysql .
shell> scripts/mysql_install_db –user=mysql
shell> chown -R root .
shell> chown -R mysql data
shell> bin/mysqld_safe –user=mysql
shell> cp /usr/local/mysql/share/mysql/my-medium.cnf
/usr/local/mysql/my.cnf
shell> vi /usr/local/mysql/my.cnf
shell> /usr/local/mysql/bin/mysqladmin -u root password 你的密码
shell> ln -s /usr/local/mysql/bin/mysql /sbin/mysql
shell> ln -s /usr/local/mysql/bin/mysqldump /sbin/mysqldump
shell> ln -s /usr/local/mysql/bin/mysqladmin /sbin/mysqladmin

shell> mysql -uroot -p你的密码
mysql> use mysql;
mysql> delete from user where password=”";
mysql> grant all on *.* to cactiuser@’%’
identified by ‘cactipasswd’;
mysql> flush privileges;
mysql> quit

为了能让系统找到mysql,请运行如下命令
# PATH=$PATH:/usr/local/mysql/bin
# export PATH
# echo “/usr/local/mysql/lib/mysql” >> /etc/ld.so.conf
# ldconfig

4.安装PHP软件

安装 jpeg6
建立目录
# mkdir /usr/local/jpeg6
# mkdir /usr/local/jpeg6/bin
# mkdir /usr/local/jpeg6/lib
# mkdir /usr/local/jpeg6/include
# mkdir /usr/local/jpeg6/man
# mkdir /usr/local/jpeg6/man/man1
# cd /root/soft
# tar -zxf jpegsrc.v6b.tar.gz
# cd jpeg-6b
#./configure
–prefix=/usr/local/jpeg6/
–enable-shared
–enable-static
# make; make install

安装libpng
# cd /root/soft
# tar -zxf libpng-1.2.8.tar.gz
# cd libpng-1.2.8
# cp scripts/makefile.std makefile
# make; make install

安装 freetype
# cd /root/soft
# tar -zxf freetype-2.1.10.tar.gz
# cd freetype-2.1.10
# ./configure –prefix=/usr/local/freetype
# make;make install

安装 zlib
# cd /root/soft
# tar -zxf zlib-1.2.3.tar.gz
# cd zlib-1.2.3
# ./configure –prefix=/usr/local/zlib
# make;make install

安装最新的GD库
# cd /root/soft
# tar -zxf gd-2.0.33.tar.gz
# cd gd-2.0.33
# ./configure
–prefix=/usr/local/gd2
–with-jpeg=/usr/local/jpeg6/
–with-png
–with-zlib=/usr/local/zlib
–with-freetype=/usr/local/freetype/
# make; make install

由于php5需libxml2的支持, 所以先安装libxml2
# cd /root/soft
# tar -zxf libxml2-2.6.19.tar.gz
# cd libxml2-2.6.19
# ./configure –prefix=/usr/local/libxml2
# make; make install

安装 libxslt
# cd /root/soft
# tar -zxf libxslt-1.1.15.tar.gz
# cd libxslt-1.1.15
#./configur –prefix=/usr/local/libxslt –with-libxml-prefix=/usr/local/libxml2
# make; make install

安装PHP
# ./configure
–prefix=/usr/local/php
–with-apxs2=/usr/local/apache/bin/apxs
–with-mysql=/usr/local/mysql
–with-gd=/usr/local/gd2
–enable-gd-native-ttf
–with-ttf
–with-freetype-dir=/usr/local/freetype
–with-jpeg-dir=/usr/local/libjpeg
–with-png
–with-zlib=/usr/local/zlib
–with-iconv
–enable-mbstring
–enable-xml
–enable-sockets

# make
# make install

#cp php.ini-dist /usr/local/php/lib/php.ini
#vi /usr/local/lib/php.ini
将register_globals = Off改为register_globals = On

5.修改Apache配置文件

寻找Add Type application/x-gzip .gz .tgz 在下面添加
Add Type application/x-tar .tgz
AddType application/x-httpd-php .php
AddType application/x-httpd-php-source .phps
AddType image/x-icon .ico

DirectoryIndex index.php index.html index.html.var

6.rrd 安装
安装cgilib
# cd /root/soft
# tar -zxvf cgilib-0.5.tar.gz
# cd cgilib-0.5
# make CC=gcc CFLAGS=”-O3 –fPIC –I .”
# mkdir –p /usr/local/cgilib/include
# cp *.h /usr/local/cgilib/include
# mkdir –p /usr/local/cgilib/lib
# cp libcgi* /usr/local/cgilib/lib

安装libart_lgpl
# cd /root/soft
# tar -zxvf libart_lgpl-2.3.17.tar.gz
# cd libart_lgpl-2.3.17.
# ./configure –disable-shared –-prefix=/usr/local/libart_lgpl
# make; make install

编辑/etc/ld.so.conf添加一下几行到文件中
/usr/local/zlib/lib
/usr/local/freetype/lib
/usr/local/libjpeg/lib
/usr/local/cgilib/lib
/usr/local/libart_lgpl/lib

执行ldconfig命令,使用动态装入器装载到共享库。

安装rrdtool
# cd /root/soft
# tar -zxvf rrdtool-1.2.23.tar.gz
# cd zrrdtool-1.2.23
# ./configure –prefix=/usr/local/rrdtool
–disable-python
–disable-tcl
# make; make install

7.安装net-snmp
# tar zxvf net-snmp-5.2.4.tar.gz
# cd net-snmp-5.2.4
# ./configure –prefix=/usr/local/net-snmp –enable-developer
# make ;make install
# ln –s /usr/local/net-snmp/bin/* /usr/local/bin
修改/usr/local/net-snmp/share/snmp/snmpd.conf
# vi /etc/snmp/snmpd.conf
com2sec notConfigUser 11.168.0.102(cacti服务器IP) public
group notConfigGroup notConfigUser
access notConfigGroup “” any noauth exact all none none
view all included .1 80

启动snmpd(可以把启动命令加到/etc/rc.local中实现随服务器启动)
# /usr/local/net-snmp/sbin/snmpd

8.安装配置cacti

# useradd cactiuser -g users
# passwd cactiuser (pwd:cactipsswd)
# cp cacti-0.8.7b-cn-utf8.tar.gz /usr/local/apache2/htdocs/
# /usr/local/apache2/htdocs/
# tar zxvf cacti-0.8.7b-cn-utf8.tar.gz
# mv cacti-0.8.7b-cn-utf8 cacti
# cd cacti
#patch -p1 < /home/wgdzh/cacti-plugin-0.8.7b-PA-v2.0-cn-utf8.diff
# mysql -uroot –p你的密码 -e
” create database cacti default character set utf8 ”
# mysql -u root -p你的密码 cacti < cacti.sql # chown -R cactiuser /usr/local/apache/htdocs/Cacti/rra/ # chown -R cactiuser /usr/local/apache/htdocs/Cacti/log/ # cd scripts # chown cactiuser:users * # vi /usr/local/apache/htdocs/cacti/include/config.php $database_type = “mysql”; $database_default = “cacti”; $database_hostname = “localhost”; $database_username = “cactiuser”; $database_password = “cactipasswd”; 9.安装配置cactid 安装完成后注意在”设置”中更改下面两个必改项. 常规->RRDTool应用程序版本改为1.2.x,默认为1.0.x.不改可能图像不能正常显示出来.
路径->RRDTool默认字体路径改为上面安装的ukai.ttf的文件路径,如/usr/share/fonts/ukai.ttf

更改用户、密码 等项 与上面给出的对应 保存退出
[root@Bleach scripts]# crontab -u cactiuser -e
加入
*/5 * * * * /usr/local/php/bin/php /usr/local/apache2/htdocs/cacti/poller.php > /dev/null 2>&1
保存退出:wq

10.安装spine
执行下面的命令(为什么要执行?上面去看INSTALL文档)
aclocal
libtoolize –force
autoconf
autoheader
automake
chmod u+x configure
./configure –prefix=/usr/local/spine –with-mysql=/usr/local/mysql –with-snmp=/usr/local/net-snmp
make;make install
cd /usr/local/spine/etc
cp spine.conf.dist spine.conf
修改spine.conf里关于数据库连接的配置

执行 aclocal报错
/usr/share/aclocal/libgcrypt.m4:23: warning: underquoted definition of AM_PATH_LIBGCRYPT
run info ‘(automake)Extending aclocal’
or see http://sources.redhat.com/automake/automake.html#Extending-aclocal
/usr/share/aclocal/ao.m4:9: warning: underquoted definition of XIPH_PATH_AO
那么需要到http://ftp.gnu.org/gnu/automake/下载最新版的automake,
当前版本是automake-1.9.6
tar zxvf automake-1.9.6.tar.gz
cd automake-1.9.6
./configure
make
make install
到http://www.gnu.org/software/libtool/libtool.html下载libtool-1.5.22.tar.gz,
tar zxvf libtool-1.5.22.tar.gz
cd libtool-1.5.22
./configure
make
make install
cd /usr/share
mv aclocal aclocal.bk
mv aclocal-1.9 aclocal-1.9.bk
mv automake-1.9 automake-1.9.bk
ln -s /usr/local/share/aclocal aclocal
ln -s /usr/local/share/aclocal-1.9 aclocal-1.9
ln -s /usr/local/share/automake-1.9 automake-1.9

1.安装时必须用cacti-0.8.6i.tar.gz 其他版本问题多
2.使用以下命令检查是否可以取到snmp数据
snmpwalk -v 1 *.*.*.* -c public
没有的话是snmpd没起 或配置错误 或网络错误

3.检查cacti是否取到数据 先 cd /var/www/html/cacti/rra
rrdtool fetch ******.rrd AVERAGE
如果全部为nan 则进行第四步
4.在cacti server上 su cactiuser 然后在/var/www/html/cacti目录下执行php poller.php 看cacti时候能识别取到的数据
一般显示错误 waitting on 1/1 poller 是因为snmpd.conf配置错误 或 cacti版本问题,解决办法是重新检查snmpd.conf配置文件或更换其他cacti版本
5.CMDPHP: Poller[0] ERROR: Cannot connect to MySQL server on ‘localhost’. Please make sure you have specified a valid MySQL database name in ‘include/config.php’
出现该错误多半是因为mysql.sock位置在 /tmp 而非 /var/lib/mysql 的原因 解决办法
把/etc/my.cof中mysql.sock位置改成/var/lib/mysql即可

10.页面设置:

在浏览器上输入:

http://IP/cacti

进入cacti的初始设置页面:
在这里我们要输入一些原始的信息:

NEXT -》
输入一些信息,如rrdtool、php、snmpwalk、snmpget的位置,使用ucd-snmp还是net-snmp等 -》
输入原始的用户和密码:admin/admin -》
更改admin用户的密码 -》
点击 Save

安装完成!!!
现在可以在浏览器中进入Cacti的世界了!

http://blog.sina.com.cn/s/blog_4e424e2101000b7j.html

http://linux.chinaunix.net/bbs/thread-648262-1-1.html

http://www.cublog.cn/u/4312/showart_416768.html

http://bbs.chinaunix.net/viewthread.php?tid=644567&highlight=cacti

http://bbs.chinaunix.net/viewthread.php?tid=594019&highlight=cacti

http://bbs.chinaunix.net/viewthread.php?tid=631801&highlight=cacti

cacti的常用脚本和模板

http://www.xiaojb.com/archives/it/scripts-and-templates-of-cacti.shtml

转载请注明:爱开源 » 中文cacti服务器安装配置

发表我的评论
取消评论
表情

Hi,您需要填写昵称和邮箱!

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址