共享安装 cacti 过程中的一些经历 cacti 中文-linux - sun solaris
项目有个需求,原来安装 cacti 的机器要革掉,需要在另一台机器上部署 cacti,
原来安装的人调走了,没有人指导,完全依靠自己在网络上寻找资料,摸索,
由于 linux/unix 基础差,走了很多弯路,花费了很多的时间,吃了很多苦头。经历了数个星期,终于搞定。
在安装过程中,非常感谢互联网上共享经验文章的同志们,得到了很多宝贵的资料,
于是决定安装完毕后,将安装过程的一些过程记录下来,写成文章,共享出来,
希望将来有需要安装 cacti 的同志能得到一些帮助。
2011-11 无相
------------------------------------------
一些安装包的下载地址:
rrdtool
http://oss.oetiker.ch/rrdtool/
php
http://www.php.net/
mysql
http://www.mysql.com/
cacti
http://www.cacti.net/download_cacti.php
cacti 的官方安装手册
http://www.cacti.net/downloads/docs/html/requirements.html
http://www.gnu.org/software/autoconf/
http://ftp.gnu.org/gnu/autoconf/
http://ftp.gnu.org/gnu/automake/
http://ftp.gnu.org/gnu/sed/
http://www.sunfreeware.com/
ftp://ftp.sunfreeware.com/pub/freeware/sparc/10/
libxml2
http://xmlsoft.org/downloads.html
http://xmlsoft.org/
http://ftp.acc.umu.se/pub/GNOME/sources/libxml2/2.6/
------------------------------------------
首先记住战胜困难的一条基本原则,
在面对困难的时候,不要厌烦,不要怨恨,宽容困难,耐心研究,会帮助你解决问题的。
不要遇到一点困难,就愁眉苦脸的,太丢脸了。
--------------------------------------------
其次介绍下 linux/unix 系统下程序安装 rpm 方式和 source 源代码方式的比较
在进行移植的过程中,使用了 2 种不同的方式进行程序的安装,rpm 方式和 source 方式,感觉2种方式各有特点。
rpm 包方式,如果准备工作一切顺利,则安装快速,简单。
关键点是准备工作要做好:
一:所下载的 rpm 包版本,必须和当前的操作系统环境保持一致,操作系统版本,32 位还是 64 位等等。
如果下错版本,将会出现一些问题,即使勉强安装上去,也会无法正常使用。
二:rpm 包,互相之间有依赖,如果安装的 rpm 包所依赖的其它包不存在,则会导致无法正常安装,必须先安装所依赖的包,才能使安装正常进行。
三:有的时候互相依赖的多个 rpm 包,单独安装都会报错,必须同时进行安装,才能成功。
source 源代码安装方式,是我个人比较喜欢的一种方式:
一:基本上不必考虑太多环境的问题,例如是什么版本的 linux,是 32 位的还是 64 位的等等,这些环境不用太多考虑。
在进行配置编译的时候,会根据系统环境,自动产生合适的机器代码。
二:基本步骤分为: configure(配置),make(编译),make install(安装3个步骤)
三:所需要特别注意的地方就是,要掌握好 configure 和 make 过程中,需要设置的参数, 如果缺少一些必要的参数,则会导致安装出来的产品缺乏一些功能。
例如: --prefix 参数指定 安装目录,--prefix=/home/php 指定安装 php 的主目录为 /home/php
--with-apxs2=/usr/apache2/bin/apxs 安装 php 时,指定关联的 apache 主目录
四:重新安装也很方便,make clean 命令,可以清除以前的安装痕迹。
-------------------------------------------------------------------------------
下面开始记录安装过程
首先尝试在一台 sun solaris 10 操作系统上安装 cacti,(后面会介绍在 linux 上安装 cacti )
网上下载了 apache 和 mysql 开始安装, 装了半天装不上,
发现一个严重的问题,我下载的版本都是 linux 的版本的,不能在 solaris unix 上安装。
于是重新下载了 apache ,mysql solaris 版本的安装文件开始安装。
在网上搜索资料,加上 solaris 关键字后,搜索到的文章里面发现了一个事实。
solaris 10 系统自带了 apache 和 mysql ,根本不需要自己安装,php 没有自带,需要安装。
按照网上一篇文章《solaris 10下安装php,mysql,apache》 里面的步骤,
很快跑起了 apache,mysql ,
由于 27 上还有 weblogic 占用了 80 端口,于是我修改了 httpd.conf 文件,修改了 apache的端口,
Listen 8070
用 http://172.16.67.27:8070/ 进行访问。
于是开始下载 php 的包,以及文章里面提到的一系列前提小工具的包。
发现一个事实:
php 以及小工具包的版本,分为了 windows 的版本和 linux/unix 的统一版本。
都是用 c 语言写的,根本不分 linux 和 unix,
下载的 *.tar.gz 都是源代码包,需要在 linux 或者 unix 上,进行编译,根据当前系统的具体情况,编译生成安装包,再进行安装。
solaris 系统上解压的命令是: # gunzip -cd php-5.1.2.tar.gz | gtar xvpf -
一般有三个步骤:
一: ./configure 生成一些配置文件,为编译安装做准备,通常带一些参数,
例如:--prefix=/home/php 这个参数的意思是将软件安装到 /home/php 目录下,
如果不指定安装目录,会默认安装到 /usr/local 目录下,例如安装了 autoconf 后,不指定 prefix ,安装后,
在 /usr/local/bin 目录下会找到 autoconf 的执行文件。
如果修改系统环境变量 /etc/profile ,把 /usr/local/bin 加入到 path 中,则可以在任意目录下执行 autoconf 命令了。
如果指定了 prefix 参数,改变了安装目录,例如:./config --prefix=/home/cacti/libxml2
则安装完后,需要把 /home/cacti/libxml2/bin 加到环境变量里面去,否则别的程序无法调用这个工具的命令。
让环境变量立刻生效的命令是: source /etc/profile
二: make 命令,执行编译,中间不能有一个错误,有一个 error 就会退出编译,编译不成功,必须把问题解决,
一般有 error 的时候,会在退出后提示,要仔细看错误信息。
三:make install 最后执行安装。
在网上下载安装包的时候,发现有 2 种版本: tar.gz tar.bz2
.bz2和.gz都是linux下压缩文件的格式,有点类似windows下的.zip和.rar文件。
.bz2和.gz的区别在于,前者比后者压缩率更高,后者比前者花费更少的时间。也就是说同一个文件,压缩后,.bz2文件比.gz文件更小,但是.bz2文件的小是以花费更多的时间为代价的。
另外网上也有一些编译好的包下载,指定了特定的操作系统版本, 这个不需要编译,解压后利用 pkgadd *** 命令加入系统包即可。
通常是一些类似 *.solaris.rpc.local.gz 之类的文件。
例如:autoconf-2.57-sol9-sparc-local.gz
# gunzip automake-1.7.2-sol9-sparc-local.gz
# pkgadd -d automake-1.7.2-sol9-sparc-local
The following packages are available:
1 SMCautoc automake
(sparc) 2.57
查看 solaris 的包信息命令:pkginfo
# pkginfo | grep auto
application SMCautoc autoconf
application SMCautom automake
使用编译好的包,必须要仔细确定环境是一摸一样的,否则后面会出错,最好还是下载源代码包,编译安装是最好的,还可以发现系统缺少哪些工具。
按照:《solaris 10下安装php,mysql,apache》 里面的步骤,安装了以下小工具:
Autoconf,automake,gsed,flex,Bison,gm4,perl,gunzip,gtar
另外的 gcc 和 gmake 已有,不需要安装。
都是默认安装在 /usr/local 目录下,没有指定 --prefix= 安装目录。
文档里介绍的 pkg-get 都是连接互联网,自动下载安装的,我们的机器不能连接外网,因此都是到网上下载了 tar.gz 包,手工安装。
接着安装了 libxml2 ,后来发现 solaris 已自带安装了 libxml2 2.6.23 版本
往服务器上上传文件,用 secureCRT 客户端工具,比 ssh 要好用, secuerFX 也是以 windows 窗口方式拖拽文件,要单独安装。
可以设定默认上传方式用 binary 二进制的方式上传。
Securefx securecrt - global options - file transfer - default transfer type : binary
然后开始安装 PHP:
config 的参数很多,有多行, \ 表示命令没有结束,连接下一行:
./configure --prefix=/home/php --with-apxs2=/usr/apache2/bin/apxs \
--with-mysql=/usr/sfw/ --enable-dbase --with-libxml-dir=/usr/bin \
--with-config-file-path=/etc/apache2 --with-gd-dir=/opt/sfw/bin \
--with-jpeg-dir=/usr/lib --with-png-dir=/usr/lib --with-zlib --enable-mbstring
首先我没有经验,只执行了第一行:
./configure --prefix=/home/php --with-apxs2=/usr/apache2/bin/apxs \
后来才发现错了,需要把每一行的命令都拷贝下来执行。
按照完整的配置参数来执行, 注意要把下面的参数,修改成你机器上的实际目录,例如 apapche 的目录,gd 的目录,mysql 的目录:
./configure --prefix=/home/php --with-apxs2=/usr/apache2/bin/apxs \
--with-mysql=/usr/sfw/ --enable-dbase --with-libxml-dir=/usr/bin \
--with-config-file-path=/etc/apache2 --with-gd-dir=/opt/sfw/bin \
--with-jpeg-dir=/usr/lib --with-png-dir=/usr/lib --with-zlib --enable-mbstring
命令执行后,报了一个提示,--with-gd-dir=/opt/sfw/bin 无效, 这个参数有问题,没有理会,
开始执行 make 编译。
出现了一个错误,退出编译。在网上搜索错误信息,也没有准确答案。
libtool: link: warning: library `/usr/local/lib/libfreetype.la' was moved.
libtool: link: warning: library `/usr/local/lib/libfreetype.la' was moved.
ld: fatal: library -lnet: not found
ld: fatal: File processing errors. No output written to sapi/cli/php
collect2: ld returned 1 exit status
make: *** [sapi/cli/php] Error 1
注意编译过程必须完全通过,才能继续安装,只要有一个错误 error 就必须解决,否则安装出来的东西无法使用。
想起了 config 时出现的提示信息:--with-gd-dir=/opt/sfw/bin 无效
cd /opt/sfw/bin 里面,果然没有发现有 sed
想是不是这个原因
下载安装 gd
gd-2.0.11gif.tar.gz 直接编译失败
gmake 的时候报错,freetype 相关,可能是 freetype 版本太低,或者没有找到 freetype ,要下载安装。
尝试 gd-1.8.3gif.tar.gz
解压后没有 configure 文件,
直接 gmake gmake install 安装,默认安装在 /usr/local/bin 目录下,
到 usr/local/bin 下果然发现了 gd 的文件。
重新配置 php ,修改 --with-gd-dir=/usr/local/bin \
./configure --prefix=/home/php --with-apxs2=/usr/apache2/bin/apxs \
--with-mysql=/usr/sfw/ --enable-dbase --with-libxml-dir=/home/cacti/libxml2 \
--with-config-file-path=/etc/apache2 --with-gd-dir=/usr/local/bin \
--with-jpeg-dir=/usr/lib --with-png-dir=/usr/lib --with-zlib --enable-mbstring
编译成功
出现 Thank you for using PHP. 才表示编译成功
安装成功
bash-3.00# cp php.ini-dist /etc/apache2/php.ini
修改 /etc/apache2/php.ini, /etc/apache2/httpd.conf
除了按照文档上的要求,修改了一些参数后,
我还自作聪明的,按照在 windows xp 下安装 php 后做的修改,自己多修改了两项内容,以为文档漏掉了:
extension_dir = "./"
修改为 extension_dir = "/home/php/php-5.2.17/ext"
把 ;extension=php_mysql.dll
去掉分号,修改为 extension=php_mysql.dll
结果在后面引起了很多麻烦,暂时没有发现,后面会提到。
重启 apache ,http://172.16.67.27/ 首页出不来,吓了一跳,以为又把 apache 搞坏了。
后来想起,已经修改了端口:
http://172.16.67.27:8070/ 首页正常出现了。
接下来测试 php 能否工作,写了一个 php 文件:zhtest.php
<?
phpinfo();
?>
丢到 /var/apache2/htdocs 目录下。
访问 http://172.16.67.27:8070/zhtest.php 终于出现了期待已久的 php 信息页面。
PHP Version 5.2.17
接下来按照文档指示,接连安装了 rrdtool,net-snmp, cactid, cacti
cactid 不是 cacti
cacti-cactid-0.8.6i.tar.gz
cacti 的安装略有不同,不是 config,make,make install 来安装,
是把压缩包解压后,拷贝到 /var/apache2/htdocs/cacti 目录下,增加 cacti 用户组及用户,分配目录权限,将数据库脚本 cacti.sql 导入到 mysql 数据库后,
然后访问: http://172.16.67.27:8070/cacti
正常情况下,就会弹出一个安装 cacti 的页面,按照提示,一步步输入配置信息后,就会以 web 页面的方式安装好 cacti 。
但我却没有正常出现安装页面。
首先我下载的 cacti 安装包,是从 CSDN 资源中下载的一个号称是 cacti 0.8.7 的 中文安装包。
在导入 cacti.sql 到 mysql 时就报错了,提示 NAMES 这个系统环境变量不存在。
查看 cacti.sql 文件, 里面有一句 SET NAMES=UTF8
mysql 就是找不到这个变量,没有办法只好删除了这一句,导入成功后,查看数据库表里的内容,很多都是中文乱码,
没有办法解决,只好先丢到一边不管中文乱码问题了。
接着访问: http://172.16.67.27:8070/cacti
却跳到了 http://172.16.67.27:8070/cacti/install 这个地址,
页面上出现了目录文件下载的页面,目录文件结构,点击就下载文件。
怎么查,也查不出原因。
后来我想到,查看 apache 日志:
bash-3.00# pwd
/var/apache2/logs
[Mon Oct 24 20:19:06 2011] [notice] caught SIGTERM, shutting down
PHP Warning: PHP Startup: Unable to load dynamic library './php_mysql.dll' - ld.so.1: httpd: fatal: ./php_mysql.dll: open failed: No such file or directory
in Unknown on line 0
[Mon Oct 24 20:19:27 2011] [notice] Digest: generating secret for digest authentication ...
[Mon Oct 24 20:19:27 2011] [notice] Digest: done
php_mysql.dll 这个文件没有加载。
于是我修改了很多次 extension_dir = "/home/php/include/php/ext" 换了不同地址,都不能找到。
后来我索性用
bash-3.00# find / -name 'php_mysql.dll' -print
查找整个电脑,都没有找到 php_mysql.dll 文件。
后来我终于想明白了,dll 文件是 windows 的动态链接库文件, linux,unix 下根本就没有 dll 文件,也没有办法使用。
我前面自作聪明修改了 httpd.conf 文件,引起了这个错误。
于是我把 extension=php_mysql.dll 又重新加上了 ;
;extension=php_mysql.dll 屏蔽掉。
查找 mysql.so 文件
bash-3.00# find / -name 'mysql.so' -print
/usr/sfw/lib/ser/modules/mysql.so
bash-3.00#
extension_dir = "/usr/sfw/lib/ser/modules"
修改好后,访问 http://172.16.67.27:8070/cacti
还是自动跳到了 http://172.16.67.27:8070/cacti/install 地址,
但不同的是不是文件下载目录页面了,而是变成了一片空白,什么信息都没有。
搞了很久,也没有效果,开始有点泄气了。
后来想,是不是 php 和 mysql 没有配置好,先测试下 php 和 mysql 的功能。
做了一个小例子:
CREATE TABLE `test` (
`id` varchar(10) NOT NULL,
`name` varchar(20) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
testmysql.php
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>测试 MySQL 连接 二</title>
</head>
<body>
<?php
// 数据库服务器名称
$mysql_server_name="localhost";
// 登录用户名
$mysql_username="root";
// 登录密码
$mysql_password="mysql";
// 数据库名称
$mysql_database="mysql";
// 连接数据库服务器
$conn = mysql_connect($mysql_server_name,$mysql_username,$mysql_password)
or die ("Not Connected: " . mysql_error());
// 激活数据库
mysql_select_db($mysql_database, $conn)
or die ("Can't use $mysql_database : " . mysql_error());
// 查询语句
$strsql = "SELECT * FROM test";
// 设置查询字符集
mysql_query("set names utf8");
//执行查询
$result = mysql_query($strsql)
or die("Invalid query: " . mysql_error());
// 获取查询结果
while ($row = mysql_fetch_array($result, MYSQL_BOTH)) {
?>
<!-- -->
<ul>
<li>
<!-- 输出查询到的信息 -->
<h3><?php printf ("ID: %s Name: %s", $row["id"], $row["name"]); ?><h3>
</li>
</ul>
<?php
}
//释放资源
mysql_free_result($result);
// 关闭连接
mysql_close($conn);
?>
</body>
</html>
http://127.0.0.1/testmysql.php 在本机 windows 下的 php 环境测试成功,从数据库表里查出了数据。
然后放到 27 上进行测试,结果发现也成功了,放到 /var/apapche2/htdocs/cacti 目录下,
访问 http://172.16.67.27:8070/cacti/testmysql.php 也成功了。
但访问 http://172.16.67.27:8070/cacti/ 还是会跳到 http://172.16.67.27:8070/cacti/install/ 页面,
一片空白。
过了 1 天,冷静了一天后,决定重新下载个 cacti 的版本,重新安装。
在 cacti 官网下载了最新版本:cacti-0.8.7h.tar.gz
在 27 上重新安装,不需要卸载,重新解压,拷贝目录,赋权,导入 cacti.sql 脚本,这个是英文版本,数据库里没有中文乱码了,全是英文。
然后访问:http://172.16.67.27:8070/cacti
结果依然跳到了 http://172.16.67.27:8070/cacti/install 页面,
但惊喜的是,页面不在是空白,出现了一些错误信息:
Error
The following PHP extensions are missing:
sockets
Please install those PHP extensions and retry
我明白了, http://172.16.67.27:8070/cacti/install 就是开始进行 web 页面安装的开始页面,
出现了错误信息,但由于以前安装的是 csdn 上下载的 中文 版本,这个版本有问题,中文乱码,
无法显示错误信息,结果就变成了一片空白。
换成英文版本后,错误信息就能看见了。
根据错误信息提示,应该是 php 没有打开 sockets 这个扩展 extensions,
我从网络上别的文章中发现在 php 进行 config 的时候,加上了很多参数,其中一项就是打开 sockets 这个扩展,
于是,我重新对 php 进行 config ,make,make install 的过程,
没有卸载以前的安装,只是直接覆盖安装。
cd /home/php/php-5.2.17
我修改后的 config 如下,增加了一些扩展:
./configure --prefix=/home/php --with-apxs2=/usr/apache2/bin/apxs \
--with-mysql=/usr/sfw/ --enable-dbase --with-libxml-dir=/home/cacti/libxml2 \
--with-config-file-path=/etc/apache2 --with-gd-dir=/usr/local/bin \
--enable-soap --enable-sockets --enable-calendar --enable-fastcgi \
--enable-dbase --enable-exif --enable-ftp --enable-gd-native-ttf --enable-gd-jis-conv --enable-shmop --enable-zip \
--enable-force-cgi-redirect --enable-bcmath \
--with-jpeg-dir=/usr/lib --with-png-dir=/usr/lib --with-zlib --enable-mbstring
出现 Thank you for using PHP. 配置成功
按照 config 后出现的一个提示信息,我执行了 make test 命令,有一个错误:
make test
ERROR: Cannot open file '/home/php/php-5.2.17/ext/standard/tests/file/copy_variation4.clean.php' (save_text)
*** Error code 1 (ignored)
The following command caused the error:
if test ! -z "/home/php/php-5.2.17/sapi/cli/php" && test -x "/home/php/php-5.2.17/sapi/cli/php"; then \
INI_FILE=`/home/php/php-5.2.17/sapi/cli/php -d 'display_errors=stderr' -r 'echo php_ini_loaded_file();' 2> /dev/null`; \
if test "$INI_FILE"; then \
egrep -v '^(zend_)?extension(_debug)?(_ts)?[\t\ ]*=' "$INI_FILE" > /home/php/php-5.2.17/tmp-php.ini; \
else \
echo > /home/php/php-5.2.17/tmp-php.ini; \
fi; \
INI_SCANNED_PATH=`/home/php/php-5.2.17/sapi/cli/php -d 'display_errors=stderr' -r '$a = explode(",\n", trim(php_ini_scanned_files())); echo $a[0];' 2> /dev/null`; \
if test "$INI_SCANNED_PATH"; then \
INI_SCANNED_PATH=`/home/php/php-5.2.17/build/shtool path -d $INI_SCANNED_PATH`; \
egrep -h -v '^(zend_)?extension(_debug)?(_ts)?[\t\ ]*=' "$INI_SCANNED_PATH"/*.ini >> /home/php/php-5.2.17/tmp-php.ini; \
fi; \
TEST_PHP_EXECUTABLE=/home/php/php-5.2.17/sapi/cli/php \
TEST_PHP_SRCDIR=/home/php/php-5.2.17 \
CC="gcc" \
/home/php/php-5.2.17/sapi/cli/php -n -c /home/php/php-5.2.17/tmp-php.ini -d 'open_basedir=' -d 'output_buffering=0' -d 'memory_limit=-1' /home/php/php-5.2.17/run-tests.php -n -c /home/php/php-5.2.17/tmp-php.ini -d extension_dir=/home/php/php-5.2.17/modules/ ` if test "x" != "x"; then for i in ""; do . $i; /home/php/php-5.2.17/build/shtool echo -n -- " -d extension=$dlname"; done; fi; if test "x" != "x"; then for i in ""; do . $i; /home/php/php-5.2.17/build/shtool echo -n -- " -d zend_extension=/home/php/php-5.2.17/modules/$dlname"; done; fi` ; \
else \
echo "ERROR: Cannot run tests without CLI sapi."; \
没有理会,继续编译,安装:
make
make install
Installing PHP SAPI module: apache2handler
/var/apache2/build/instdso.sh SH_LIBTOOL='/var/apache2/build/libtool' libphp5.la /usr/apache2/libexec
/var/apache2/build/libtool --mode=install cp libphp5.la /usr/apache2/libexec/
cp .libs/libphp5.so /usr/apache2/libexec/libphp5.so
chmod +x /usr/apache2/libexec/libphp5.so
cp .libs/libphp5.lai /usr/apache2/libexec/libphp5.la
libtool: install: warning: remember to run `libtool --finish /home/php/php-5.2.17/libs'
chmod 755 /usr/apache2/libexec/libphp5.so
[activating module `php5' in /etc/apache2/httpd.conf]
Installing PHP CLI binary: /home/php/bin/
Installing PHP CLI man page: /home/php/man/man1/
Installing build environment: /home/php/lib/php/build/
Installing header files: /home/php/include/php/
Installing helper programs: /home/php/bin/
program: phpize
program: php-config
Installing man pages: /home/php/man/man1/
page: phpize.1
page: php-config.1
Installing PEAR environment: /home/php/lib/php/
[PEAR] Archive_Tar - already installed: 1.3.7
[PEAR] Console_Getopt - already installed: 1.2.3
[PEAR] Structures_Graph- already installed: 1.0.3
[PEAR] XML_Util - already installed: 1.2.1
[PEAR] PEAR - already installed: 1.9.1
Wrote PEAR system config file at: /home/php/etc/pear.conf
You may want to add: /home/php/lib/php to your php.ini include_path
Installing PDO headers: /home/php/include/php/ext/pdo/
bash-3.00#
bash-3.00# cp php.ini-dist /etc/apache2/php.ini
修改 php.ini
;include_path = ".:/php/includes"
; UNIX: "/path1:/path2"
include_path = "/home/php/include/php:/home/php/lib/php"
; Directory in which the loadable extensions (modules) reside.
extension_dir = "./"
修改为
extension_dir = "/usr/sfw/lib/ser/modules/"
检查 /etc/apache2/httpd.conf
DirectoryIndex index.php index.html
AddType application/x-compress .Z
AddType application/x-gzip .gz .tgz
AddType application/x-httpd-php .php
DirectoryIndex index.php index.html
重启
# svcadm disable apache2
# svcadm enable apache2
http://172.16.67.27:8070/
http://172.16.67.27:8070/zhtest.php
http://172.16.67.27:8070/testmysql.php
均正常
http://172.16.67.27:8070/cacti
终于出现了安装页面
Cacti Installation Guide
Thanks for taking the time to download and install cacti, the complete graphing solution for your network. Before you can start making cool graphs, there are a few pieces of data that cacti needs to know.
Make sure you have read and followed the required steps needed to install cacti before continuing. Install information can be found for Unix and Win32-based operating systems.
Also, if this is an upgrade, be sure to reading the Upgrade information file.
Cacti is licensed under the GNU General Public License, you must agree to its provisions before continuing:
This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
安装页面,一步步走下去,在路径设置页面,rrdtool,snmp,php 的路径都必须是绿色的才能通过,如果是红色的,就要前面安装的路径,填写正确的路径,
一般前面安装的 php 等,路径没有加到环境变量里,所以需要手工修改,如果加到了环境变量 /etc/profile 里面,一般安装页面会自己找的:
[NOT FOUND] PHP Binary Path: The path to your PHP binary file (may require a php recompile to get this file).
/usr/bin/php
[ERROR: FILE NOT FOUND]
前面安装的 php 路径是:
/home/php/bin/php
安装完毕后,首页出来:
http://172.16.67.27:8070/cacti/index.php
admin/admin
cacti 登陆后的 settings 菜单页面里面有 snmp rrdtool 的设置,可以对前面安装时指定的路径在这里修改。
snmpwalk Binary Path : /usr/local/bin/snmpwalk
snmpget Binary Path : /usr/local/bin/snmpget
RRDTool Binary Path : /usr/local/bin/rrdtool
PHP Binary Path: /home/php/bin/php
Cacti Log File Path: /var/apache2/htdocs/cacti/log/cacti.log
RRDTool Default Font:
/usr/openwin/lib/locale/zh_CN.GB18030/X11/fonts/TrueType/fangsongti.ttf
find / -name 'fonts' -print
修改 admin 密码后,登陆不进去了,总是显示 admin 用户密码不对
在网上找到了忘记密码的方法,admin 用户的密码保存在了数据库里,直接修改数据库里的表,可以修改密码:
mysql -uroot -p
password: admin
mysql> use cacti;
Database changed
mysql>
mysql> show tables;
+---------------------------+
| Tables_in_cacti |
+---------------------------+
| cdef |
| cdef_items |
| colors |
| data_input |
| data_input_data |
| data_input_fields |
| data_local |
| data_template |
| data_template_data |
| data_template_data_rra |
| data_template_rrd |
| graph_local |
| graph_template_input |
| graph_template_input_defs |
| graph_templates |
| graph_templates_gprint |
| graph_templates_graph |
| graph_templates_item |
| graph_tree |
| graph_tree_items |
| host |
| host_graph |
| host_snmp_cache |
| host_snmp_query |
| host_template |
| host_template_graph |
| host_template_snmp_query |
| poller |
| poller_command |
| poller_item |
| poller_output |
| poller_reindex |
| poller_time |
| rra |
| rra_cf |
| settings |
| settings_graphs |
| settings_tree |
| snmp_query |
| snmp_query_graph |
| snmp_query_graph_rrd |
| snmp_query_graph_rrd_sv |
| snmp_query_graph_sv |
| user_auth |
| user_auth_perms |
| user_auth_realm |
| user_log |
| version |
+---------------------------+
48 rows in set (0.00 sec)
mysql> select * from user_auth;
+----+----------+----------------------------------+-------+---------------+----------------------+-----------+-----------+--------------+----------------+------------+---------------+--------------+--------------+------------------------+---------+
| id | username | password | realm | full_name | must_change_password | show_tree | show_list | show_preview | graph_settings | login_opts | policy_graphs | policy_trees | policy_hosts | policy_graph_templates | enabled |
+----+----------+----------------------------------+-------+---------------+----------------------+-----------+-----------+--------------+----------------+------------+---------------+--------------+--------------+------------------------+---------+
| 1 | admin | 4f38f4117791e85980213136bb816569 | 0 | Administrator | | on | on | on | on | 1 | 1 | 1 | 1 | 1 | on |
| 3 | guest | 43e9a4ab75570f5b | 0 | Guest Account | on | on | on | on | on | 3 | 1 | 1 | 1 | 1 | |
+----+----------+----------------------------------+-------+---------------+----------------------+-----------+-----------+--------------+----------------+------------+---------------+--------------+--------------+------------------------+---------+
2 rows in set (0.00 sec)
mysql> select enable from user_auth where id =1;
ERROR 1054: Unknown column 'enable' in 'field list'
mysql> select enabled from user_auth where id =1;
+---------+
| enabled |
+---------+
| on |
+---------+
1 row in set (0.00 sec)
mysql> update user_auth set password=md5("mysql") where id=1;
Query OK, 1 row affected (0.00 sec)
Rows matched: 1 Changed: 1 Warnings: 0
mysql> commit;
Query OK, 0 rows affected (0.00 sec)
mysql> quit;
Bye
bash-3.00#
密码修改为 mysql 后重新登陆
网上查到,如果这一招不行,就可以重置数据库:
mysql -uroot -p cacti < cacti.sql
发现安装的 cacti 是英文版,全部是英文,另外和原来 21 机器上老的 cacti 比较,还缺少了几个菜单,‘阀值’ 等几个菜单都没有。
决定不能随便交差了事,必须要做的完美点,可以多学点东西。
决定像原来的机器21 那样安装中文版。
在 21 上 cacti 的首页上,发现右上角的标志是:cactiEZ
在网上搜索,发现 cactiEZ 和 cacti 不同,cactiEZ 是个集成的汉化中文版产品,有专门的网站:
http://www.cactiez.net/
http://www.cactiez.com/
在网站上准备下载 cactiEZ,发现 cactiEZ 只提供了i386和x86_64两个版本下载,根本没有 sun solaris 的版本,
也就是说只能在 linux 上安装,否则就只能在 solaris 上使用英文版了。
另外 cactiEZ 提供的下载文件全部是 iso 镜像文件,根本就没有源代码,rpm 包下载,而且 iso 文件,有几百兆大小。
既然 cactiEZ 只提供i386和x86_64两个版本,在 sun solaris 系统上,估计安装不了,
而且 solaris 10 自带的 mysql 有问题,cacti.sql 无法导入,全是中文乱码。而且执行 set lang 中文字符的命令,就会报错。
mysql 数据库不支持。除非在 solaris 上重新安装 mysql,才能解决中文乱码的问题。
我决定在 17 (一台linux 机器)上,安装 apache,mysql,php,cactiez
rpm -qa 查看包
rpm -e * 删除已经安装的包
下载 mysql
http://www.mysql.com/downloads/index.html
首先在网上搜索关于 CactiEZ 的安装文档.
经过阅读才发现, cactiEZ 的安装文件 ISO 300 多M,是一个 linux 整个操作系统安装文件,首先会先安装一个新的 linux 操作系统,
里面包含了,php,apache,mysql,cacti ,所有的完整插件,是一个集成版本的操作系统。
原来 21 上安装的不是这个,而是一个仅仅中文化的 cacti 部分。
是一个从 CactiEZ 的 iso 安装文件,安装完毕后,剥离出来的 cacti 部分。
所以放弃了安装 CactiEZ 的 iso 文件。决定还是现在 17 上安装一个普通中文版的 cacti 试试。
先开始安装 apache:
apache 下载
http://apache.etoak.com//httpd/
不过 linux 一般自带了 apache 包,不需要下载,
17 上,果然已经安装了 apache :
ps -ef|grep httpd 查看 apache 进程,
service httpd restart 重启 apache。
寻找 apache 配置文件:
find / -name 'httpd.conf' -print
/etc/httpd/conf/httpd.conf
修改端口为 8070,因为 80 端口已经被 eos weblogic 占用了。
http://172.16.67.17:8070/
寻找 apache 的部署应用主目录:
find / -name 'index.html' -print
/var/www/manual/misc/index.html
/var/www/manual/platform/index.html
/var/www/manual/howto/index.html
/var/www/manual/rewrite/index.html
/var/www/manual/faq/index.html
/var/www/manual/programs/index.html
/var/www/manual/mod/index.html
/var/www/manual/mod/mod_python/index.html
/var/www/manual/index.html
/var/www/manual/vhosts/index.html
/var/www/manual/ssl/index.html
/var/www/manual/developer/index.html
more /etc/httpd/conf/httpd.conf
ServerRoot "/etc/httpd"
DocumentRoot "/var/www/html"
<Directory "/var/www/html">
DirectoryIndex index.html index.html.var
原来 17 上 linux 自带的 apache 主目录,也是 /var/www/html ,和 21 上一样。
决定进行测试:
index.html
<html>
is a apples@
</html>
cd /var/www/html
http://172.16.67.17:8070/index.html
Forbidden
You don't have permission to access /index.html on this server.
cp index.html 22.html
http://172.16.67.17:8070/22.html
is a apples@ 成功出现了内容,看来 apache 的主目录确实是 /var/www/html
开始安装 mysql :
mysql 下载
http://dev.mysql.com/downloads/mysql/5.0.html#downloads
选择 MySQL Community Server 不要点名字,点下面的小 ‘download’,就可以选择历史版本。
下载类型很多,选择 oracle linux 4&5
注意选择 64 位,还是 32 位,是 x86 还是 i686
搞清楚版本,否则安装后,会出问题。
uname -a
查看 linux 是 4 还是 5
[root@3.5.5Biz-46 ~]# [root@q1test01 ~]# lsb_release -a
LSB Version: :core-3.0-amd64:core-3.0-ia32:core-3.0-noarch:graphics-3.0-amd64:graphics-3.0-
ia32:graphics-3.0-noarch
Distributor ID: RedHatEnterpriseAS
Description: Red Hat Enterprise Linux AS release 4 (Nahant Update 2)
Release: 4
Codename: NahantUpdate2
注意要选择 MySQL Server
不要选择 Development Libraries,Client Utilities 这些东东了。
Red Hat & Oracle Linux 5 (x86, 64-bit), RPM Package
MySQL Server5.0.9219.1M
Download
(MySQL-server-community-5.0.92-1.rhel5.x86_64.rpm)
到了登陆页面
点击下方的:
No thanks, just take me to the downloads!
就可以不用登陆,就不需要注册用户了。
如果不是下载 tar gz 包编译安装,下载 rpm 就必须下载 3 个rpm 包
MySQL-client-community-5.0.92-1.rhel5.x86_64.rpm
MySQL-devel-community-5.0.92-1.rhel5.x86_64.rpm
MySQL-server-community-5.0.92-1.rhel5.x86_64.rpm
注意不要下错版本了,x86 的 64 位的 rhel5 表示 red hat linux 5
安装成功。
[root@web-server-b other]# ll
total 44288
-rw-r--r-- 1 root dba 6612147 Nov 2 14:53 MySQL-client-community-5.0.92-1.rhel5.x86_64.rpm
-rw-r--r-- 1 root dba 11496916 Nov 2 14:59 MySQL-devel-community-5.0.92-1.rhel5.x86_64.rpm
-rw-r--r-- 1 root dba 20057342 Nov 2 14:45 MySQL-server-community-5.0.92-1.rhel5.x86_64.rpm
-rw-r--r-- 1 root dba 7095187 Nov 2 14:39 httpd-2.2.21.tar.gz
[root@web-server-b other]#
[root@web-server-b other]# rpm -ivh MySQL-client-community-5.0.92-1.rhel5.x86_64.rpm
Preparing... ########################################### [100%]
1:MySQL-client-community ########################################### [100%]
[root@web-server-b other]# rpm -ivh MySQL-devel-community-5.0.92-1.rhel5.x86_64.rpm
Preparing... ########################################### [100%]
1:MySQL-devel-community ########################################### [100%]
[root@web-server-b other]# rpm -ivh MySQL-server-community-5.0.92-1.rhel5.x86_64.rpm
Preparing... ########################################### [100%]
1:MySQL-server-community ########################################### [100%]
PLEASE REMEMBER TO SET A PASSWORD FOR THE MySQL root USER !
To do so, start the server, then issue the following commands:
/usr/bin/mysqladmin -u root password 'new-password'
/usr/bin/mysqladmin -u root -h web-server-b password 'new-password'
Alternatively you can run:
/usr/bin/mysql_secure_installation
which will also give you the option of removing the test
databases and anonymous user created by default. This is
strongly recommended for production servers.
See the manual for more instructions.
Please report any problems with the /usr/bin/mysqlbug script!
The latest information about MySQL is available on the web at
http://www.mysql.com
Support MySQL by buying support/licenses at http://shop.mysql.com
Starting MySQL.[纭畾]
Giving mysqld 2 seconds to start
[root@web-server-b other]# rpm -qa|grep MySQ
MySQL-client-community-5.0.92-1.rhel5
MySQL-server-community-5.0.92-1.rhel5
MySQL-devel-community-5.0.92-1.rhel5
[root@web-server-b other]#
[root@web-server-b other]# ps -ef|grep mysql
root 15792 1 0 16:33 pts/1 00:00:00 /bin/sh /usr/bin/mysqld_safe --datadir=/var/lib/mysql --pid-file=/var/lib/mysql/web-server-b.pid
mysql 15816 15792 0 16:33 pts/1 00:00:00 /usr/sbin/mysqld --basedir=/ --datadir=/var/lib/mysql --user=mysql --pid-file=/var/lib/mysql/web-server-b.pid --skip-external-locking
root 17610 29134 0 16:34 pts/1 00:00:00 grep mysql
[root@web-server-b other]# cd /usr/share/mysql/
[root@web-server-b mysql]# ls
SELinux english greek mi_test_all.res mysql-log-rotate mysqld_multi.server portuguese swedish
binary-configure errmsg.txt hungarian my-huge.cnf mysql.server ndb-config-2-node.ini romanian ukrainian
charsets estonian italian my-innodb-heavy-4G.cnf mysql_fix_privilege_tables.sql ndb_size.tmpl russian
czech fill_help_tables.sql japanese my-large.cnf mysql_system_tables.sql norwegian serbian
danish french korean my-medium.cnf mysql_system_tables_data.sql norwegian-ny slovak
dutch german mi_test_all my-small.cnf mysql_test_data_timezone.sql polish spanish
[root@web-server-b mysql]# service mysql stop
Shutting down MySQL.[纭畾]
[root@web-server-b mysql]# cp /usr/share/mysql/my-medium.cnf /etc/my.cnf
[root@web-server-b mysql]# service mysql start
Starting MySQL.[纭畾]
[root@web-server-b mysql]#
查看 mysql 用户
more /etc/shadow
id mysql
查看用户组
more /etc/group
mysql -uroot -p
默认密码为空
mysqladmin -uroot -p/ password 'admin'
service mysql start
mysql 安装成功,开始安装 php:
安装php(php不能用5.3及以上的版本,因为废除了以前很多函数。导致cacti的程序不兼容)
首先按照 solaris 下安装 php 的那篇文章里提到的,检查一些组件,是否已经安装,必须进行这一步,否则可能会影响 php 以后的正常使用:
[root@web-server-b ~]# rpm -qa |grep jpeg
libjpeg-devel-6b-37
libjpeg-6b-37
libjpeg-devel-6b-37
libjpeg-6b-37
[root@web-server-b ~]# rpm -qa |grep libpng
libpng-1.2.10-7.1.el5_3.2
libpng-devel-1.2.10-7.1.el5_3.2
libpng-devel-1.2.10-7.1.el5_3.2
libpng-1.2.10-7.1.el5_3.2
[root@web-server-b ~]# rpm -qa |grep freetype
freetype-devel-2.2.1-21.el5_3
freetype-2.2.1-21.el5_3
freetype-devel-2.2.1-21.el5_3
freetype-2.2.1-21.el5_3
[root@web-server-b ~]# rpm -qa |grep freetype
freetype-devel-2.2.1-21.el5_3
freetype-2.2.1-21.el5_3
freetype-devel-2.2.1-21.el5_3
freetype-2.2.1-21.el5_3
[root@web-server-b ~]# rpm -qa |grep gd
gd-2.0.33-9.4.el5_1.1
gdb-6.8-37.el5
gdbm-1.8.0-26.2.1
gdbm-devel-1.8.0-26.2.1
gd-devel-2.0.33-9.4.el5_1.1
gdbm-1.8.0-26.2.1
sysklogd-1.4.1-44.el5
gdbm-devel-1.8.0-26.2.1
gd-devel-2.0.33-9.4.el5_1.1
gd-2.0.33-9.4.el5_1.1
gdm-2.16.0-56.el5
[root@web-server-b ~]# rpm -qa |grep libxml
libxml2-2.6.26-2.1.2.8
libxml2-python-2.6.26-2.1.2.8
libxml2-2.6.26-2.1.2.8
libxml2-devel-2.6.26-2.1.2.8
libxml2-devel-2.6.26-2.1.2.8
[root@web-server-b ~]# rpm -qa |grep libxslt
libxslt-1.1.17-2.el5_2.2
libxslt-1.1.17-2.el5_2.2
libxslt-devel-1.1.17-2.el5_2.2
装 php 之前检查,17 上该有的组件基本上都有了。
准备安装 php 的参数:
./configure --prefix=/home/php --with-apxs2=/usr/apache2/bin/apxs \
--with-mysql=/usr/sfw/ --enable-dbase --with-libxml-dir=/home/cacti/libxml2 \
--with-config-file-path=/etc/apache2 --with-gd-dir=/usr/local/bin \
--enable-soap --enable-sockets --enable-calendar --enable-fastcgi \
--enable-dbase --enable-exif --enable-ftp --enable-gd-native-ttf --enable-gd-jis-conv --enable-shmop --enable-zip \
--enable-force-cgi-redirect --enable-bcmath \
--with-jpeg-dir=/usr/lib --with-png-dir=/usr/lib --with-zlib --enable-mbstring
--with-apxs2=/usr/apache2/bin/apxs \
find / -name 'apxs' -print 在 17 上找不到 apache 的 apxs 文件
可能 linux 自带的 apache 不是 apache2
想先卸载 17 上自带的 apache,重新安装 apache2
查看安装包
[root@web-server-b httpd]# rpm -qa ht*
htmlview-4.0.0-2.el5
httpd-2.2.3-31.el5
httpd-manual-2.2.3-31.el5
查看 rpm 安装目录
[root@web-server-b httpd]# rpm -ql httpd-2.2.3-31.el5
/etc/httpd
/etc/httpd/conf
/var/www
[root@web-server-b httpd]# rpm -ql httpd-manual-2.2.3-31.el5
/etc/httpd/conf.d/manual.conf
/var/www/manual
/var/www/manual/LICENSE
卸载命令是:
rpm -e httpd-2.2.3-31.el5
rpm -e httpd-manual-2.2.3-31.el5
网上说如果采用源代码方式安装 apache2 , 可以不用卸载原来的 rpm 包,只要不启动 就可以了。
决定不卸载 apache rpm 包了,先停掉:
service httpd stop
make 之前先执行 make clean 清除以前的安装痕迹
mkdir /home/apache2
tar xvf httpd-2.2.21.tar.gz
./configure --prefix=/home/apache2 --enable-so --enable-mods-shared=most --with-mpm=worker --enable-disk-cache --enable-mem-cache
make clean
make
make install
果然有了 /home/apache2/bin/apxs
重启 apache 命令报错:
service mysql start
service mysql stop
/home/apache2/modules/mod_disk_cache.so: undefined symbol: ap_cache_cacheable_hdrs_out
执行配置检查命令,也是一样的错误:
/home/apache2/bin/apachectl configtest
[root@web-server-b bin]# /home/apache2/bin/apachectl configtest
httpd: Syntax error on line 67 of /home/apache2/conf/httpd.conf:
Cannot load /home/apache2/modules/mod_disk_cache.so into server:
/home/apache2/modules/mod_disk_cache.so: undefined symbol: ap_cache_cacheable_hdrs_out
应该是安装时,指定的参数 --enable-disk-cache --enable-mem-cache 惹的祸
重新编译,在下载的一篇文档上,拷贝了配置参数:
./configure --prefix=/home/apache2 --with-enable=so --enable-rewrite
make clean
make
make install
结果安装完毕后,依然无法启动,报错:
[root@web-server-b httpd-2.2.21]# /home/apache2/bin/apachectl configtest
httpd: Syntax error on line 54 of /home/apache2/conf/httpd.conf: module authn_file_module is built-in and can't be loaded
[root@web-server-b httpd-2.2.21]# /home/apache2/bin/apachectl start
httpd: Syntax error on line 54 of /home/apache2/conf/httpd.conf: module authn_file_module is built-in and can't be loaded
错误显示,某些 module 无法加载,决定修改配置文件,不加载这个 module:
vi /home/apache2/conf/httpd.conf
#LoadModule authn_file_module modules/mod_authn_file.so 加上 # 进行注释。
Listen 8070
修改后,依然报错,换成另外的 module 了:
[root@web-server-b httpd-2.2.21]# /home/apache2/bin/apachectl configtest
httpd: Syntax error on line 58 of /home/apache2/conf/httpd.conf: module authn_default_module is built-in and can't be loaded
不能把所有的 module 都注释掉,在网上查了下,感觉应该还是编译的问题: 前面的这个参数 --with-enable=so 应该写错了。
修改如下:
./configure --prefix=/home/apache2 --enable-so
[root@web-server-b src]# mkdir /home/apache5
[root@web-server-b src]# mkdir /home/apache5/src
[root@web-server-b src]# mv httpd-2.2.21.tar.gz /home/apache5/src
tar xvf httpd-2.2.21.tar.gz
./configure --prefix=/home/apache5 --enable-so
make clean
make
make install
/home/apache5/bin/apachectl configtest
/home/apache5/bin/apachectl start
/home/apache5/bin/apachectl stop
[root@web-server-b httpd-2.2.21]# /home/apache5/bin/apachectl configtest
httpd: Could not reliably determine the server's fully qualified domain name, using 172.16.67.17 for ServerName
Syntax OK
[root@web-server-b httpd-2.2.21]# /home/apache5/bin/apachectl start
httpd: Could not reliably determine the server's fully qualified domain name, using 172.16.67.17 for ServerName
(98)Address already in use: make_sock: could not bind to address [::]:80
(98)Address already in use: make_sock: could not bind to address 0.0.0.0:80
no listening sockets available, shutting down
Unable to open logs
这回的错误和以前的不一样了,只是表示 80 端口被占用的错误,看来果然是前面编译的错误,现在修改下端口即可
vi httpd.conf
Listen 8070
[root@web-server-b conf]# ps -ef|grep httpd
root 2636 27199 0 15:41 pts/1 00:00:00 grep httpd
[root@web-server-b conf]# /home/apache5/bin/apachectl start
httpd: Could not reliably determine the server's fully qualified domain name, using 172.16.67.17 for ServerName
[root@web-server-b conf]# ps -ef|grep httpd
root 3173 1 0 15:41 ? 00:00:00 /home/apache5/bin/httpd -k start
daemon 3174 3173 0 15:41 ? 00:00:00 /home/apache5/bin/httpd -k start
daemon 3175 3173 0 15:41 ? 00:00:00 /home/apache5/bin/httpd -k start
daemon 3176 3173 0 15:41 ? 00:00:00 /home/apache5/bin/httpd -k start
daemon 3177 3173 0 15:41 ? 00:00:00 /home/apache5/bin/httpd -k start
daemon 3178 3173 0 15:41 ? 00:00:00 /home/apache5/bin/httpd -k start
root 3180 27199 0 15:41 pts/1 00:00:00 grep httpd
[root@web-server-b conf]#
奇怪的是启动 apache 进程的用户是 daemon 用户,而不是 root 用户,网上查了下,可以在 apache 的配置文件中修改启动用户和用户组。
[root@web-server-b htdocs]# mv /var/www/html/22.html /home/apache5/htdocs/
[root@web-server-b htdocs]# ls
22.html index.html
http://172.16.67.17:8070/22.html
页面出来了
[root@web-server-b usr]# rpm -qa libxml*
libxml2-2.6.26-2.1.2.8
libxml2-python-2.6.26-2.1.2.8
libxml2-2.6.26-2.1.2.8
libxml2-devel-2.6.26-2.1.2.8
libxml2-devel-2.6.26-2.1.2.8
[root@web-server-b usr]# rpm -ql libxml2-2.6.26-2.1.2.8
/usr/bin/xmlcatalog
/usr/bin/xmllint
/usr/lib64/libxml2.so.2
/usr/lib64/libxml2.so.2.6.26
/usr/share/doc/libxml2-2.6.26
/usr/share/doc/libxml2-2.6.26/AUTHORS
/usr/share/doc/libxml2-2.6.26/ChangeLog.gz
/usr/share/doc/libxml2-2.6.26/Copyright
/usr/share/doc/libxml2-2.6.26/NEWS
/usr/share/doc/libxml2-2.6.26/README
/usr/share/doc/libxml2-2.6.26/TODO
/usr/share/man/man1/xmlcatalog.1.gz
/usr/share/man/man1/xmllint.1.gz
/usr/share/man/man3/libxml.3.gz
/usr/bin/xmlcatalog
/usr/bin/xmllint
/usr/lib/libxml2.so.2
/usr/lib/libxml2.so.2.6.26
/usr/share/doc/libxml2-2.6.26
/usr/share/doc/libxml2-2.6.26/AUTHORS
/usr/share/doc/libxml2-2.6.26/ChangeLog.gz
/usr/share/doc/libxml2-2.6.26/Copyright
/usr/share/doc/libxml2-2.6.26/NEWS
/usr/share/doc/libxml2-2.6.26/README
/usr/share/doc/libxml2-2.6.26/TODO
/usr/share/man/man1/xmlcatalog.1.gz
/usr/share/man/man1/xmllint.1.gz
/usr/share/man/man3/libxml.3.gz
[root@web-server-b usr]#
[root@web-server-b lib]# rpm -qa freetype
freetype-2.2.1-21.el5_3
freetype-2.2.1-21.el5_3
[root@web-server-b lib]# rpm -ql freetype-2.2.1-21.el5_3
/usr/lib64/libfreetype.so.6
/usr/lib64/libfreetype.so.6.3.10
/usr/share/doc/freetype-2.2.1
/usr/share/doc/freetype-2.2.1/ChangeLog
/usr/share/doc/freetype-2.2.1/README
/usr/lib/libfreetype.so.6
/usr/lib/libfreetype.so.6.3.10
/usr/share/doc/freetype-2.2.1
/usr/share/doc/freetype-2.2.1/ChangeLog
/usr/share/doc/freetype-2.2.1/README
[root@web-server-b lib]#
[root@web-server-b lib]# find / -name '*jpeg*' -print
/usr/lib/libjpeg.so
/usr/lib/libjpeg.so.62.0.0
[root@web-server-b lib]# ls *jpeg*
libjpeg.so libjpeg.so.62 libjpeg.so.62.0.0
[root@web-server-b lib]# ls *png*
libpng.a libpng.so libpng.so.3 libpng.so.3.10.0 libpng12.a libpng12.so libpng12.so.0 libpng12.so.0.10.0
[root@web-server-b lib]# pwd
/usr/lib
[root@web-server-b lib]#
[root@web-server-b conf]# cd /usr/bin
[root@web-server-b bin]# ls *gd*
gdb gdialog gdk-pixbuf-query-loaders-64 gdmXnest gdmflexiserver gdmthemetester wmf2gd
gdbserver gdk-pixbuf-csource gdlib-config gdmXnestchooser gdmphotosetup oggdec
gdbtui gdk-pixbuf-query-loaders-32 gdm-dmx-reconnect-proxy gdmdynamic gdmsetup update-gdk-pixbuf-loaders
[root@web-server-b bin]#
这些需要的东西如果缺少,就要安装
继续安装
./configure --prefix=/home/php --with-apxs2=/home/apache5/bin/apxs \
--with-mysql=/usr/ --enable-dbase --with-libxml-dir=/usr/ --with-freetype-dir=/usr/ \
--with-config-file-path=/home/apache5/conf --with-gd-dir=/usr/bin \
--enable-soap --enable-sockets --enable-calendar --enable-fastcgi \
--enable-dbase --enable-exif --enable-ftp --enable-gd-native-ttf --enable-gd-jis-conv --enable-shmop --enable-zip \
--enable-force-cgi-redirect --enable-bcmath \
--with-jpeg-dir=/usr/lib --with-png-dir=/usr/lib --with-zlib --enable-mbstring
报错:
checking for MySQL UNIX socket location... no
configure: error: Cannot find libmysqlclient under /usr/.
Note that the MySQL client library is not bundled anymore!
在网上找到原因
[root@web-server-b mysql]# pwd
/usr/lib64/mysql
[root@web-server-b mysql]# ll
total 41300
-rw-r--r-- 1 root root 10762 Jan 26 2011 libdbug.a
-rw-r--r-- 1 root root 673404 Jan 26 2011 libheap.a
-rw-r--r-- 1 root root 120260 Jan 26 2011 libmygcc.a
-rw-r--r-- 1 root root 3133250 Jan 26 2011 libmyisam.a
-rw-r--r-- 1 root root 894762 Jan 26 2011 libmyisammrg.a
-rw-r--r-- 1 root root 9830656 Jan 26 2011 libmysqlclient.a
-rwxr-xr-x 1 root root 989 Jan 26 2011 libmysqlclient.la
-rw-r--r-- 1 root root 9880474 Jan 26 2011 libmysqlclient_r.a
-rwxr-xr-x 1 root root 1035 Jan 26 2011 libmysqlclient_r.la
-rw-r--r-- 1 root root 2466868 Jan 26 2011 libmystrings.a
-rw-r--r-- 1 root root 1749372 Jan 26 2011 libmysys.a
-rw-r--r-- 1 root root 10455342 Jan 26 2011 libndbclient.a
-rwxr-xr-x 1 root root 1302 Jan 26 2011 libndbclient.la
-rw-r--r-- 1 root root 77628 Jan 26 2011 libvio.a
-rw-r--r-- 1 root root 308412 Jan 26 2011 libz.a
-rwxr-xr-x 1 root root 878 Jan 26 2011 libz.la
-rw-r--r-- 1 root root 1398634 Jan 26 2011 mysqld-debug.sym
-rw-r--r-- 1 root root 1080924 Jan 26 2011 mysqld.sym
[root@web-server-b mysql]#
做两个符号连接
[root@web-server-b mysql]# ln -s /usr/lib64/mysql/libmysqlclient.a /usr/lib/libmysqlclient.a
[root@web-server-b mysql]# ln -s /usr/lib64/mysql/libmysqlclient_r.a /usr/lib/libmysqlclient_r.a
[root@web-server-b mysql]#
config 成功
+--------------------------------+
| License: |
| This software is subject to the PHP License, available in this |
| distribution in the file LICENSE. By continuing this installation |
| process, you are bound by the terms of this license agreement. |
| If you do not agree with the terms of this license, you must abort |
| the installation process at this point. |
+--------------------------------+
Thank you for using PHP.
Notice: Following unknown configure options were used:
--with-gd-dir=/usr/bin
Check './configure --help' for available options
make , make install 成功
bash-3.00# cp /home/php/src/php.ini-dist /home/apache5/conf/php.ini --php.ini 拷贝到和 httpd.conf 一个目录
修改 php.ini
;include_path = ".:/php/includes"
; UNIX: "/path1:/path2"
include_path = "/home/php/include/php:/home/php/lib/php"
register_globals = Off 修改成 register_globals = On
检查 /etc/apache5/httpd.conf 确保以下内容正确:
DirectoryIndex index.php index.html
AddType application/x-compress .Z
AddType application/x-gzip .gz .tgz
AddType application/x-httpd-php .php
DirectoryIndex index.php index.html
重启
/home/apache5/bin/apachectl start
/home/apache5/bin/apachectl stop
从 27 上拷贝测试 php 的页面:
scp root@172.16.67.27:/var/apache2/htdocs/testmysql.php /home/apache5/htdocs
scp root@172.16.67.27:/var/apache2/htdocs/zhtest.php /home/apache5/htdocs
在 17 mysql 上,建立 test 测试表:
mysql>create database cacti default character set utf8; 注意创建数据库时,要用 character set utf8 指定默认字符集为 utf8.
GRANT ALL PRIVILEGES ON *.* TO 'root'@'172.168.0.7' IDENTIFIED BY 'admin' WITH GRANT OPTION;
mysql>flush privileges;
CREATE TABLE `test` (
`id` varchar(10) NOT NULL,
`name` varchar(20) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
修改 testmysql.php
$mysql_database="mysql";
修改为
$mysql_database="cacti";
http://172.16.67.17:8070/
http://172.16.67.17:8070/zhtest.php
http://172.16.67.17:8070/testmysql.php
?ID: 1 Name: 地球
?ID: 2 Name: 月亮
?ID: 3 Name: 土星
均正常
开始安装 rrdtool snmp
[root@web-server-b snmp]# gunzip net-snmp-5.3.0.1.tar.gz
[root@web-server-b snmp]# ls
net-snmp-5.3.0.1.tar
[root@web-server-b snmp]# tar xvf net-snmp-5.3.0.1.tar
./configure --prefix=/home/cacti/snmp --enable-developer
make
make install
按照一篇文章里说的,做个符号链接:
ln -s /home/cacti/snmp/bin/* /usr/local/bin
cp EXAMPLE.conf /home/cacti/snmp/share/snmp/snmpd.conf
[root@web-server-b rrdtool]# gunzip rrdtool-1.2.27.tar.gz
[root@web-server-b rrdtool]# tar xvf rrdtool-1.2.27.tar
cd rrdtool-1.2.27
./configure --prefix=/home/cacti/rrdtool --disable-python --disable-tcl
make
make install
按照一篇文章里说的,做个符号链接:
ln -s /home/cacti/rrdtool/bin/* /usr/local/bin
执行 snmpwalk 和 rrdtool 命令都可以了
开始安装 cacti
useradd cactiuser -g users
passwd cactiuser
在网上下载了 cacti 的中文安装包 090815172648.gz
tar -zxvf 090815172648.gz
cp -r cacti-0.8.7e-cn-utf8 /home/apache5/htdocs/cacti
cd /home/apache5/htdocs/cacti
mysql>create database cacti default character set utf8;
mysql>grant all privileges on cacti.* to cactiuser@localhost IDENTIFIED BY 'cactiuser';
mysql>flush privileges;
mysql>\q
#mysql -uroot -p cacti < cacti.sql
利用 Navicat 查看 mysql 数据库,看见里面导入的表里面都是中文了。
create database cacti default character set utf8; 指定了字符集 utf8 很重要
chown -R cactiuser rra
chown -R cactiuser log
cd scripts/
chown -R cactiuser:users *
(从后面的安装经验来看,这几个目录不必修改所属用户 cactiuser,全部是 root 用户也可以。但需要用 root 用户设置 crontab,并且用 root 用户启动 apache ,snmp。
cactiuser 用户主要用来登陆 mysql,mysql 配置好 cactiuser 的权限即可)
vi /home/apache5/htdocs/cacti/include/config.php
$database_type = "mysql";
$database_default = "cacti";
$database_hostname = "localhost";
$database_username = "cactiuser";
$database_password = "cactiuser";
$database_port = "3306";
不用做任何修改
前面的
mysql>grant all privileges on cacti.* to cactiuser@localhost IDENTIFIED BY 'cactiuser';
已经指定了 cactiuser 用户可以登陆 mysql 数据库,密码 cactiuser
mysql -ucactiuser -p
cactiuser
登陆成功
切换 cactiuser
su - cactiuser
crontab -e
*/3 * * * * /home/php/bin/php /home/apache5/htdocs/cacti/poller.php
[cactiuser@web-server-b ~]$ crontab -l
*/3 * * * * /home/php/bin/php /home/apache5/htdocs/cacti/poller.php
手工测试
[cactiuser@web-server-b ~]$ /home/php/bin/php /home/apache5/htdocs/cacti/poller.php
sh: -q: command not found
sh: -: command not found
[cactiuser@web-server-b ~]$
执行不成功
于是切换成 root 用户来设置
crontab: installing new crontab
[root@web-server-b ~]# crontab -l
*/3 * * * * /home/php/bin/php /home/apache5/htdocs/cacti/poller.php
[root@web-server-b ~]# /home/php/bin/php /home/apache5/htdocs/cacti/poller.php
[root@web-server-b ~]#
成功了
删除 cactiuser 的 crontab 设置
x:每按一次删除光标所在位置的后面一个字符。[超常用]
dd:删除光标所在行。[超常用]
重启 apache
/home/apache5/bin/apachectl stop
/home/apache5/bin/apachectl start
http://172.16.67.17:8070/cacti
开始进入中文版的 cacti 安装界面,都是中文的。
Cacti安装指南
感谢你花时间下载并安装Cacti,它是全图像化的网络监测解决方案.在你开始生成很酷的图像之前, 有些数据需要填写以供Cacti使用.
在继续安装之前,请确定你已经阅读了安装所需的相关步骤.相关安装信息可点击 Unix或Win32.
同样,如果是升级安装,请阅读升级信息.
Cacti采用 GNU GPL 许可方式,你必须同意此授权方式:
本程式为免费软件,遵从GNU GPL许可方式,既可以采用GPL v2也可以采用更新的版本,你可以重新发布或修改此程序.
程式的发布是希望对于使用者有所帮助,没有任何授权用于商业或其它特殊用途.详情请看GNU GPL许可授权.
Cacti安装指南
在继续前,请确认下面的配置是否正确.
[未找到] RRDTool路径: rrdtool文件的路径.
[错误: 文件未找到]
[已找到] PHP路径: php文件的路径(可能需要重新编辑以获得此文件).
[确定: 文件已找到]
[未找到] snmpwalk路径: snmpwalk文件的全路径.
[错误: 文件未找到]
[未找到] snmpget路径: snmpget文件的路径.
[错误: 文件未找到]
[未找到] snmpbulkwalk路径: snmpbulkwalk文件的路径.
[错误: 文件未找到]
[未找到] snmpgetnext路径: snmpgetnext文件的路径.
[错误: 文件未找到]
[已找到] Cacti日志文件路径: Cacti日志文件所在路径.
[确定: 文件已找到]
SNMP应用程序版本: 你所安装的SNMP. 如果你使用SNMP v2c或没有在PHP中嵌入SNMP支持,需安装.
UCD-SNMP 4.x NET-SNMP 5.x
注: 一旦你点击"完成",所有这些设置将被保存,如果是升级安装,你的库将被更新.以后你可以在"设置"中更改相关信息.
输入正确的路径
/home/cacti/rrdtool/bin/rrdtool
/usr/bin/php
/home/cacti/snmp/bin/snmpwalk
/home/cacti/snmp/bin/snmpget
/home/cacti/snmp/bin/snmpbulkwalk
/home/cacti/snmp/bin/snmpgetnext
安装后,登陆页面出来了
admin / admin 登陆
修改密码
amdin / mysql
中文版的终于出来了
但和原来的 21 cacti 相比,还是没有‘阀值’,‘阀值摸板’ 几个菜单。
经过询问才知道,21 这个 cacti 版本是安装了插件的,所以才会有 ‘阀值’,‘阀值摸板’ 几个菜单,
这个版本是从 cactiez iso 的安装完成后的目录,把 cacti 的目录剥离出来的。
我要么到网上寻找插件,安装插件,要么就直接把 21 上 的 html 目录复制过去就可以了,
另外从 21 上的 mysql 导出 cacti 数据库,然后在 17 上的 mysql 导入 sql 脚本。
于是决定执行第二种方法,从 21 上移植版本。
利用 Navicat drop 掉 mysql 中的 cacti 数据库
[root@web-server-b htdocs]# mysql -uroot -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 72
Server version: 5.0.92-community-log MySQL Community Edition (GPL)
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql> use cacti;
ERROR 1049 (42000): Unknown database 'cacti'
mysql> create database cacti default character set utf8;
Query OK, 1 row affected (0.00 sec)
mysql> grant all privileges on cacti.* to cactiuser@localhost IDENTIFIED BY 'cactiuser';
Query OK, 0 rows affected (0.00 sec)
mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec)
mysql> \q
Bye
[root@web-server-b htdocs]#
[root@web-server-b cacti]# mysql -uroot -p cacti < cacti-0715.sql
Enter password:
[root@web-server-b cacti]#
[root@web-server-b cacti]# chown -R cactiuser rra
[root@web-server-b cacti]# chown -R cactiuser log
[root@web-server-b cacti]# cd scripts/
[root@web-server-b scripts]# chown -R cactiuser:users *
[root@web-server-b scripts]#
vi /home/apache5/htdocs/cacti/include/config.php
$database_type = "mysql";
$database_default = "cacti";
$database_hostname = "localhost";
$database_username = "cactiuser";
$database_password = "cactiuser";
$database_port = "3306";
[root@web-server-b cacti]# /home/apache5/bin/apachectl restart
httpd: Could not reliably determine the server's fully qualified domain name, using 172.16.67.17 for ServerName
[root@web-server-b cacti]# ps -ef|grep httpd
daemon 18614 19790 0 17:03 ? 00:00:00 /home/apache5/bin/httpd -k start
daemon 18615 19790 0 17:03 ? 00:00:00 /home/apache5/bin/httpd -k start
daemon 18616 19790 0 17:03 ? 00:00:00 /home/apache5/bin/httpd -k start
daemon 18617 19790 0 17:03 ? 00:00:00 /home/apache5/bin/httpd -k start
daemon 18618 19790 0 17:03 ? 00:00:00 /home/apache5/bin/httpd -k start
root 18622 17424 0 17:03 pts/1 00:00:00 grep httpd
root 19790 1 0 16:07 ? 00:00:00 /home/apache5/bin/httpd -k start
[root@web-server-b cacti]#
做完上面的操作,访问:
http://172.16.67.17:8070/cacti
没有出现安装页面,看来剥离出来的 cacti 不需要安装,都已经安装好了。
admin / admin 登陆成功。
菜单里配置的主机中文名字都是乱码,看来 mysql 里还是乱码,需要从 21 的 mysql 里重新导一份最新的过来。
决定从 21 上,重新拷贝个最新的过来,包括导数据库等操作。
21 的 html 目录已经有 4。5 G 了,
主要是 2 个内容比较大,第一是 log 目录下的 cacti.log 已经上 G 了,
可以利用 \cp /dev/null cacti.log 清除掉日志里面的内容。
另一个是 rra 目录里面的 rrd 文件,都是 rrdtool 生成的历史数据文件,可以全部 rm 删除掉,不用重启,过几分钟后会自动创建的。
17 上查看图形不存在,页面报 snmp 错误。
在‘设置’-‘路径’ 里面查看,所有的路径都是 21 原来的路径,全部是红叉,这个版本是安装完毕的,没有安装过程,所以里面的路径都是 21 上的路径,要全部修改过来。
/home/cacti/snmp/bin/snmpwalk
/home/cacti/snmp/bin/snmpget
/home/cacti/snmp/bin/snmpbulkwalk
/home/cacti/snmp/bin/snmpgetnext
/home/cacti/rrdtool/bin/rrdtool
/usr/share/fonts/msyh.ttf
/usr/bin/php
/home/apache5/htdocs/cacti/log/cacti.log
/home/cacti/spine/bin/spine
上面的字体文件 msyh.ttf 没有,从 21 上拷贝过来
[root@web-server-b fonts]# pwd
/usr/share/fonts
[root@web-server-b fonts]# scp root@172.16.67.21:/usr/share/fonts/msyh.ttf
usage: scp [-1246BCpqrv] [-c cipher] [-F ssh_config] [-i identity_file]
[-l limit] [-o ssh_option] [-P port] [-S program]
[[user@]host1:]file1 [...] [[user@]host2:]file2
[root@web-server-b fonts]# scp root@172.16.67.21:/usr/share/fonts/msyh.ttf /usr/share/fonts/
The authenticity of host '172.16.67.21 (172.16.67.21)' can't be established.
RSA key fingerprint is 1d:de:27:f2:db:be:32:48:8b:4a:fd:87:d7:3e:93:80.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added '172.16.67.21' (RSA) to the list of known hosts.
root@172.16.67.21's password:
msyh.ttf 100% 14MB 14.4MB/s 00:01
[root@web-server-b fonts]# ls
bitmap-fonts bitstream-vera chinese default dejavu-lgc liberation msyh.ttf zh_TW
[root@web-server-b fonts]# ll
total 14772
drwxr-xr-x 2 root root 4096 Feb 1 2010 bitmap-fonts
drwxr-xr-x 2 root root 4096 Feb 1 2010 bitstream-vera
drwxr-xr-x 4 root root 4096 Feb 1 2010 chinese
drwxr-xr-x 4 root root 4096 Feb 1 2010 default
drwxr-xr-x 2 root root 4096 Feb 1 2010 dejavu-lgc
drwxr-xr-x 2 root root 4096 Feb 1 2010 liberation
-rw-r--r-- 1 root root 15044440 Nov 4 17:26 msyh.ttf
drwxr-xr-x 3 root root 4096 Feb 1 2010 zh_TW
[root@web-server-b fonts]#
[root@web-server-b log]# pwd
/home/apache5/htdocs/cacti/log
[root@web-server-b log]# ls
[root@web-server-b log]# ls
[root@web-server-b log]# find / -name 'cacti.log' -print
/home/cacti/cacti/cacti-0.8.7e-cn-utf8/log/cacti.log
/home/apache5/htdocs/cacti-087e/log/cacti.log
[root@web-server-b log]# cp /home/cacti/cacti/cacti-0.8.7e-cn-utf8/log/cacti.log /home/apache5/htdocs/cacti/log
[root@web-server-b log]#
[root@web-server-b log]# find / -name 'spine' -print
[root@web-server-b log]#
没有安装 spine 需要安装
从 21 上拷贝 spine 安装文件过来
[root@web-server-b cacti]# scp -r patrol@172.16.67.21:/home/orabiee/cacti/cacti-spine-0.8.7e.tar.gz /home/cacti/spine/
patrol@172.16.67.21's password:
cacti-spine-0.8.7e.tar.gz 100% 764KB 764.4KB/s 00:00
[root@web-server-b cacti]# ls
cacti rrdtool snmp spine
[root@web-server-b cacti]# cd spine
[root@web-server-b spine]# ls
cacti-spine-0.8.7e.tar.gz
[root@web-server-b spine]# ll
total 776
-rw-r--r-- 1 root root 782735 Nov 4 18:06 cacti-spine-0.8.7e.tar.gz
[root@web-server-b spine]# gunzip cacti-spine-0.8.7e.tar.gz
[root@web-server-b spine]# tar -zxvf cacti-spine-0.8.7e.tar
gzip: stdin: not in gzip format
tar: Child returned status 1
tar: Error exit delayed from previous errors
[root@web-server-b spine]# tar xvf cacti-spine-0.8.7e.tar
./configure --prefix=/home/cacti/spine --with-mysql --with-snmp=/home/cacti/snmp
make
make install
[root@web-server-b bin]# cd ..
[root@web-server-b spine]# ls
bin cacti-spine-0.8.7e cacti-spine-0.8.7e.tar etc
[root@web-server-b spine]# cd etc
[root@web-server-b etc]# ls
spine.conf
[root@web-server-b etc]# vi spine.conf
DB_Host localhost
DB_Database cacti
DB_User cactiuser
DB_Pass cactiuser
DB_Port 3306
~
~
重启
/home/apache5/bin/apachectl stop
/home/apache5/bin/apachectl start
spine, rrdtool 和 snmp 的路径已经修改了,但还是红叉找不到。
修改环境变量:
vi /etc/profile
export PATH=$PATH:/home/cacti/snmp/bin:/home/cacti/rrdtool/bin:/home/php/bin
source /etc/profile
依然红叉,找不到路径。
[root@web-server-b bin]# spine
SPINE: Using spine config file [../etc/spine.conf]
SPINE: Version 0.8.7e starting
SPINE: Time: 6.3370 s, Threads: 8, Hosts: 21
[root@web-server-b bin]# cd /
[root@web-server-b /]# spine
11/04/2011 06:27:27 PM - SPINE: Poller[0] FATAL: Unable to read configuration file! (Spine init)
重新安装 spine ,默认安装,不指定安装目录 prefix
./configure --with-mysql --with-snmp=/home/cacti/snmp
make
make install
/usr/local/spine/bin/spine 这个路径找到了
但 rrdtool , snmp 的路径还是红叉,找不到
没有办法,重装
开始安装 rrdtool snmp
[root@web-server-b rrdtool]# gunzip rrdtool-1.2.27.tar.gz
[root@web-server-b rrdtool]# tar xvf rrdtool-1.2.27.tar
cd rrdtool-1.2.27
./configure --disable-python --disable-tcl
make
make install
rrdtool 的路径找到了
/usr/local/rrdtool-1.2.27/bin/rrdtool
[root@web-server-b snmp]# gunzip net-snmp-5.3.0.1.tar.gz
[root@web-server-b snmp]# ls
net-snmp-5.3.0.1.tar
[root@web-server-b snmp]# tar xvf net-snmp-5.3.0.1.tar
./configure --enable-developer
make
make install
cp EXAMPLE.conf /home/cacti/snmp/share/snmp/snmpd.conf
snmp 重装了,没有指定 prefix 安装好,
find 命令找不到 snmpwalk 这些文件,找到的路径都是源代码目录下的路径
后来再次重装 snmp 指定 prefix 在 /opt/net-snmp
./configure --prefix=/opt/net-snmp
make
make install
cp EXAMPLE.conf /opt/net-snmp/share/snmp/snmpd.conf
安装好后,指定下面的路径,全部能找到了,不再是红叉了
/opt/net-snmp/bin/snmpwalk
/opt/net-snmp/bin/snmpget
/opt/net-snmp/bin/snmpbulkwalk
/opt/net-snmp/bin/snmpgetnext
/usr/local/rrdtool-1.2.27/bin/rrdtool
/usr/share/fonts/msyh.ttf
/home/php/bin/php
/home/apache5/htdocs/cacti/log/cacti.log
/usr/local/spine/bin/spine
删除 rrd 文件
[root@brio-server cacti]# find /var/www/html -name '*.rrd' -print
/var/www/html/rra/172_16_67_15-web1_mem_cache_78.rrd
/var/www/html/rra/172_16_67_12-suninterface2_ping_199.rrd
/var/www/html/rra/172_16_67_19-biee1_cpu_system_250.rrd
/var/www/html/rra/172_16_67_9-interface1_hdd_total_152.rrd
另外从 21 的 mysql 数据库导一份最新的 sql 文件过来,解决乱码的问题
[root@brio-server html]# cd log
[root@brio-server log]# du -sh
4.2G .
[root@brio-server log]# ll
鎬昏 4349120
-rw-r--r-- 1 apache apache 4449140362 11-07 15:30 cacti.log
[root@brio-server log]# ls
cacti.log
[root@brio-server log]# du -sh
4.2G .
[root@brio-server log]# export LANG=C
[root@brio-server log]# cp /dev/null cacti.log
cp: overwrite `cacti.log'? yes
[root@brio-server log]# ll
total 0
-rw-r--r-- 1 apache apache 0 Nov 7 15:33 cacti.log
[root@brio-server log]#
cd /home/apache5/htdocs/
mv cacti cacti-0715
[root@web-server-b htdocs]# scp root@172.16.67.21:/var/www/html /home/apache5/htdocs/cacti
root@172.16.67.21's password:
被拒绝,权限不对,
查看所属为patrol 用户
scp -r patrol@172.16.67.21:/var/www/html /home/apache5/htdocs/cacti
21 上导出
mysqldump --default-character-set=latin1 --databases cacti -u root -p > /tmp/cacti3.sql
17 拷贝
]# scp patrol@172.16.67.21:/tmp/cacti3.sql /home/apache5/htdocs/cacti/cacti-20111106.sql
[root@web-server-b cacti]# mysql -uroot -p cacti < cacti-20111106.sql
Enter password:
ERROR 1049 (42000): Unknown database 'cacti'
mysql> create database cacti default character set utf8;
Query OK, 1 row affected (0.00 sec)
mysql> grant all privileges on cacti.* to cactiuser@localhost IDENTIFIED BY 'cactiuser';
Query OK, 0 rows affected (0.00 sec)
mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec)
mysql> \q
Bye
[root@web-server-b htdocs]#
[root@web-server-b cacti]# mysql -uroot -p cacti < cacti-20111106.sql
Enter password:
select * from data_input_fields;
显示中文,从21 上导 mysql 数据库到 17 成功。
[root@web-server-b cacti]# chown -R cactiuser rra
[root@web-server-b cacti]# chown -R cactiuser log
[root@web-server-b cacti]# cd scripts/
[root@web-server-b scripts]# chown -R cactiuser:users *
[root@web-server-b scripts]#
vi /home/apache5/htdocs/cacti/include/config.php
$database_type = "mysql";
$database_default = "cacti";
$database_hostname = "localhost";
$database_username = "cactiuser";
$database_password = "cactiuser";
$database_port = "3306";
/home/apache5/bin/apachectl start
/home/apache5/bin/apachectl stop
修改 cacti 设置路径
/opt/net-snmp/bin/snmpwalk
/opt/net-snmp/bin/snmpget
/opt/net-snmp/bin/snmpbulkwalk
/opt/net-snmp/bin/snmpgetnext
/usr/local/rrdtool-1.2.27/bin/rrdtool
/usr/share/fonts/msyh.ttf
/home/php/bin/php
/home/apache5/htdocs/cacti/log/cacti.log
/usr/local/spine/bin/spine
查看页面
mysql 的中文乱码问题解决了,菜单里面的设备主机名字,都显示中文。
但图形里面的指标中文是乱码,应该是 rrdtool 的画图中文乱码问题,以后解决。
数据有 67。6,67。8 的 rrd 历史数据
其它图形为空。
所有的图形都无法显示出来。由于从 21 上拷贝了一些 67.6,67.8 数据库的 rrd 文件过来,所以有一些历史图形数据。
查看日志:
/home/apache5/htdocs/cacti/log/cacti.log
有很多错误:
11/07/2011 05:06:03 PM - SPINE: Poller[0] Host[4] DS[80] SS[2] SERVER: /var/www/html/scripts/ss_host_disk.php ss_host_disk 172.16.67.15 2:161:1000:public:::MD5::DES: 4 get used 3, output: U
11/07/2011 05:06:03 PM - SPINE: Poller[0] ERROR: SS[3] PHP Script Server communications lost. Restarting PHP Script Server
11/07/2011 05:06:03 PM - SPINE: Poller[0] ERROR: SS[5] PHP Script Server communications lost. Restarting PHP Script Server
11/07/2011 05:06:03 PM - SPINE: Poller[0] ERROR: SS[2] Script Server did not start properly return message was: 'U'
11/07/2011 05:06:03 PM - SPINE: Poller[0] ERROR: SS[4] Script Server did not start properly return message was: 'U'
错误信息里面的,文件的路径不对,是 21 上的路径,17 上不一样,应该是 /home/apache5/htdocs/cacti 下面:
/var/www/html/scripts/ss_host_disk.php
必须修改 <path_cacti> 这个路径。
data_queries.php
$xml_filename = str_replace("<path_cacti>", $config["base_path"], $snmp_query["xml_path"]);
很多文件都用到了 $config["base_path"];
在 /home/apache5/htdocs/cacti/include 有一些 global_settings.php config.php config_settings.php
都没有找到在哪里设置的 base_path
决定不再寻找了,修改 apache 的配置文件,改变 apache 的主目录,指向 /var/www/html
不需要重装 php 等工具,重新拷贝 21 上的原始目录和 sql 过来
[root@web-server-b ~]# cd /var/www
[root@web-server-b www]# ls
cgi-bin error html icons manual usage
[root@web-server-b www]# cp /html /html-bak
cp: cannot stat `/html': No such file or directory
[root@web-server-b www]# cp -r html html-bak
[root@web-server-b www]# ls
cgi-bin error html html-bak icons manual usage
[root@web-server-b www]#
[root@web-server-b www]# cd html
[root@web-server-b html]# ls
index.html
[root@web-server-b html]#
[root@web-server-b conf]# pwd
/home/apache5/conf
[root@web-server-b conf]# ls
extra httpd.conf httpd.conf.bak magic mime.types original php.ini
[root@web-server-b conf]# vi httpd.conf
#
ServerRoot "/home/apache5" 这个不要动
DocumentRoot "/home/apache5/htdocs" 修改为 DocumentRoot "/var/www/html"
<Directory "/home/apache5/htdocs"> 修改为 <Directory "/var/www/html">
/home/apache5/bin/apachectl start
/home/apache5/bin/apachectl stop
http://172.16.67.17:8070/testmysql.php
http://172.16.67.17:8070/zhtest.php
http://172.16.67.17:8070/cacti
均找不到页面了
root@web-server-b htdocs]# cp testmysql.php /var/www/html/
[root@web-server-b htdocs]# cp zhtest.php /var/www/html
http://172.16.67.17:8070/testmysql.php
http://172.16.67.17:8070/zhtest.php
能访问了
现在从 21 上导最新的过来
先在 21 上删除一些多余的 rrd 文件
[root@web-server-b htdocs]# scp -r patrol@172.16.67.21:/var/www/html/* /var/www/html/
注意没有 cacti 目录
21 上导出
mysqldump --default-character-set=latin1 --databases cacti -u root -p > /tmp/cacti20111108.sql
17 拷贝
scp patrol@172.16.67.21:/tmp/cacti20111108.sql /var/www/html/cacti20111108.sql
mysql -uroot -p
mysql> create database cacti default character set utf8;
Query OK, 1 row affected (0.00 sec)
mysql> grant all privileges on cacti.* to cactiuser@localhost IDENTIFIED BY 'cactiuser';
Query OK, 0 rows affected (0.00 sec)
mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec)
mysql> \q
Bye
[root@web-server-b htdocs]#
mysql -uroot -p cacti < cacti20111108.sql
访问
不是 http://172.16.67.17:8070/cacti
而是 http://172.16.67.17:8070
FATAL: Cannot connect to MySQL server on 'localhost'. Please make sure you have specified a valid MySQL database name in 'include/config.php'
[root@web-server-b html]# vi include/config.php
$database_type = "mysql";
$database_default = "cacti";
$database_hostname = "localhost";
$database_username = "root";
$database_password = "aaa";
$database_port = "3306";
修改成
$database_type = "mysql";
$database_default = "cacti";
$database_hostname = "localhost";
$database_username = "cactiuser";
$database_password = "cactiuser";
$database_port = "3306";
http://172.16.67.17:8070/ 可以访问了
修改 cacti 路径
/opt/net-snmp/bin/snmpwalk
/opt/net-snmp/bin/snmpget
/opt/net-snmp/bin/snmpbulkwalk
/opt/net-snmp/bin/snmpgetnext
/usr/local/rrdtool-1.2.27/bin/rrdtool
/usr/share/fonts/msyh.ttf
/home/php/bin/php
/home/apache5/htdocs/cacti/log/cacti.log
/usr/local/spine/bin/spine
重启
[root@test scripts]# service snmpd restart
[root@test scripts]# service mysql restart
mysql 是 rpm 包形式安装的,已经加在服务里了。
[root@web-server-b log]# service mysql stop
Shutting down MySQL..[纭畾]
[root@web-server-b log]# ps -ef|grep mysql
root 15560 24826 0 15:45 pts/1 00:00:00 grep mysql
[root@web-server-b log]# service mysql start
Starting MySQL.[纭畾]
[root@web-server-b log]# ps -ef|grep mysql
root 15575 1 0 15:45 pts/1 00:00:00 /bin/sh /usr/bin/mysqld_safe --datadir=/var/lib/mysql --pid-file=/var/lib/mysql/web-server-b.pid
mysql 15605 15575 0 15:45 pts/1 00:00:00 /usr/sbin/mysqld --basedir=/ --datadir=/var/lib/mysql --user=mysql --pid-file=/var/lib/mysql/web-server-b.pid --skip-external-locking --port=3306 --socket=/var/lib/mysql/mysql.sock
root 15621 24826 0 15:45 pts/1 00:00:00 grep mysql
[root@web-server-b log]#
/home/apache5/bin/apachectl start
/home/apache5/bin/apachectl stop
1 个小时后,一部分图形画出来了,有一部分图形未画出来。
看来修改了 apache 的主目录后,有一部分图形正常了:
67.6,67.8 的数据库图形出来了,一部分 cpu ,内存等图形也出来了,
但是所有的磁盘空间的图形,和 21 上,测试 url 是否正常,load 加载调度进程是否正常,日志文件大小等监控图形就是不出来。
21 上的 log 日志都是好的,进行对比
17
11/08/2011 04:27:09 PM - SPINE: Poller[0] ERROR: SS[1] Script Server did not start properly return message was: 'U'
11/08/2011 04:27:09 PM - SPINE: Poller[0] ERROR: SS[1] PHP Script Server communications lost. Restarting PHP Script Server
11/08/2011 04:27:09 PM - SPINE: Poller[0] ERROR: SS[4] Script Server did not start properly return message was: 'U'
11/08/2011 04:27:09 PM - SPINE: Poller[0] ERROR: SS[4] PHP Script Server communications lost. Restarting PHP Script Server
11/08/2011 04:27:09 PM - SPINE: Poller[0] ERROR: SS[1] Script Server did not start properly return message was: 'U'
11/08/2011 04:27:09 PM - SPINE: Poller[0] ERROR: SS[5] PHP Script Server communications lost. Restarting PHP Script Server
11/08/2011 04:27:09 PM - SPINE: Poller[0] ERROR: SS[5] Script Server did not start properly return message was: 'U'
21
11/08/2011 04:35:03 PM - SPINE: Poller[0] Host[8] DS[133] SS[1] SERVER: /var/www/html/scripts/ss_host_disk.php ss_host_disk 172.16.67.7 2:161:1000:public:::MD5::DES: 8 get total 13, output: 132621991936
11/08/2011 04:35:03 PM - SPINE: Poller[0] Host[7] DS[119] SS[2] SERVER: /var/www/html/scripts/ss_host_disk.php ss_host_disk 172.16.67.5 2:161:1000:public:::MD5::DES: 7 get percent 15, output: 70.02
11/08/2011 04:35:03 PM - SPINE: Poller[0] Host[7] DS[119] SS[3] SERVER: /var/www/html/scripts/ss_host_disk.php ss_host_disk 172.16.67.5 2:161:1000:public:::MD5::DES: 7 get total 15, output: 21140325376
11/08/2011 04:35:03 PM - SPINE: Poller[0] Host[8] DS[133] SS[2] SERVER: /var/www/html/scripts/ss_host_disk.php ss_host_disk 172.16.67.7 2:161:1000:public:::MD5::DES: 8 get used 13, output: 73728
11/08/2011 04:35:03 PM - SPINE: Poller[0] Host[8] DS[134] SS[3] SERVER: /var/www/html/scripts/ss_host_disk.php ss_host_disk 172.16.67.7 2:161:1000:public:::MD5::DES: 8 get total 14, output: 132622016512
11/08/2011 04:35:03 PM - SPINE: Poller[0] Host[7] DS[119] SS[4] SERVER: /var/www/html/scripts/ss_host_disk.php ss_host_disk 172.16.67.5 2:161:1000:public:::MD5::DES: 7 get used 15, output: 14801560576
11/08/2011 04:35:03 PM - SPINE: Poller[0] Host[3] DS[200] SCRIPT: /usr/java/jdk1.6.0_22/bin/java -jar /var/www/html/scripts/moniter_fat.jar url http://172.16.67.15/eos-governor/, output: url:1
11/08/2011 04:35:03 PM - SPINE: Poller[0] Host[8] DS[134] SS[4] SERVER: /var/www/html/scripts/ss_host_disk.php ss_host_disk 172.16.67.7 2:161:1000:public:::MD5::DES: 8 get percent 14, output: 0
11/08/2011 04:35:03 PM - SPINE: Poller[0] Host[7] DS[120] SS[5] SERVER: /var/www/html/scripts/ss_host_disk.php ss_host_disk 172.16.67.5 2:161:1000:public:::MD5::DES: 7 get percent 17, output: 0
11/08/2011 04:35:02 PM - SPINE: Poller[0] Host[3] DS[48] SS[0] SERVER: /var/www/html/scripts/ss_host_disk.php ss_host_disk 172.16.67.21 2:161:1000:public:::MD5::DES: 3 get percent 4, output: 22.07
11/08/2011 04:35:02 PM - SPINE: Poller[0] Host[3] DS[48] SS[1] SERVER: /var/www/html/scripts/ss_host_disk.php ss_host_disk 172.16.67.21 2:161:1000:public:::MD5::DES: 3 get total 4, output: 123706839040
17 上的 cacti 日志,error 好像和 PHP Script Server 有关系,但不知道到底 php 有什么问题。
感觉还是 rrdtool 的问题,于是对比 21 和 17 的 rrdtool 以及 snmp 的版本:
17
[root@web-server-b spine]# /usr/local/rrdtool-1.2.27/bin/rrdtool
RRDtool 1.2.27 Copyright 1997-2008 by Tobias Oetiker <tobi@oetiker.ch>
Compiled Nov 4 2011 18:46:42
Usage: rrdtool [options] command command_options
[root@web-server-b spine]# /opt/net-snmp/bin/snmpget
No hostname specified.
USAGE: snmpget [OPTIONS] AGENT OID [OID]...
Version: 5.3.0.1
Web: http://www.net-snmp.org/
Email: net-snmp-coders@lists.sourceforge.net
21
[root@brio-server tmp]# rrdtool
RRDtool 1.2.30 Copyright 1997-2008 by Tobias Oetiker <tobi@oetiker.ch>
Compiled Feb 20 2009 18:17:02
Usage: rrdtool [options] command command_options
[root@brio-server tmp]# /usr/bin/snmpwalk
No hostname specified.
USAGE: snmpwalk [OPTIONS] AGENT [OID]
Version: 5.3.2.2
Web: http://www.net-snmp.org/
Email: net-snmp-coders@lists.sourceforge.net
[root@brio-server etc]# pwd
/usr/local/spine/etc
[root@brio-server etc]# cd ..
[root@brio-server spine]# ls
bin etc
[root@brio-server spine]# cd bin
[root@brio-server bin]# ls
spine
[root@brio-server bin]# ./spine
SPINE: Using spine config file [../etc/spine.conf]
SPINE: Version 0.8.7e starting
17 的 spine 是从 21 拷贝过来的,版本一样
rrdtool ,snmp 版本不一样,决定重装
rpm -qa 查看包
rpm -e * 删除已经安装的包
记得安装Redhat9。0的时候不要安装系统默认的apache,mysql和php以及相关的软件。已经安装的请用rpm -e * 删除已经安装的包。
先卸载 snmp
[root@web-server-b 21]# rpm -e net-snmp-5.3.1-19.el5
error: Failed dependencies:
net-snmp is needed by (installed) hp-snmp-agents-8.3.0.27-24.x86_64
[root@web-server-b 21]# rpm -e net-snmp-libs-5.3.2.2-7.el5
error: Failed dependencies:
libnetsnmp.so.10()(64bit) is needed by (installed) hpijs-1.6.7-4.1.el5_2.4.x86_64
libnetsnmp.so.10()(64bit) is needed by (installed) OpenIPMI-2.0.16-5.el5.x86_64
libnetsnmp.so.10()(64bit) is needed by (installed) hplip-1.6.7-4.1.el5_2.4.x86_64
libnetsnmp.so.10()(64bit) is needed by (installed) libsane-hpaio-1.6.7-4.1.el5_2.4.x86_64
libnetsnmp.so.10()(64bit) is needed by (installed) net-snmp-5.3.1-19.el5.x86_64
libnetsnmp.so.10()(64bit) is needed by (installed) hp-snmp-agents-8.3.0.27-24.x86_64
libnetsnmpagent.so.10()(64bit) is needed by (installed) net-snmp-5.3.1-19.el5.x86_64
libnetsnmpagent.so.10()(64bit) is needed by (installed) hp-snmp-agents-8.3.0.27-24.x86_64
libnetsnmphelpers.so.10()(64bit) is needed by (installed) net-snmp-5.3.1-19.el5.x86_64
libnetsnmphelpers.so.10()(64bit) is needed by (installed) hp-snmp-agents-8.3.0.27-24.x86_64
libnetsnmpmibs.so.10()(64bit) is needed by (installed) net-snmp-5.3.1-19.el5.x86_64
libnetsnmpmibs.so.10()(64bit) is needed by (installed) hp-snmp-agents-8.3.0.27-24.x86_64
libnetsnmptrapd.so.10()(64bit) is needed by (installed) net-snmp-5.3.1-19.el5.x86_64
[root@web-server-b 21]#
卸载不成功,有很多依赖的程序,
直接安装
[root@web-server-b 21]# rpm -ivh net-snmp-5.3.2.2-7.el5.x86_64.rpm
file /usr/share/snmp/mibs/NET-SNMP-EXAMPLES-MIB.txt from install of net-snmp-5.3.2.2-7.el5.x86_64 conflicts with file from package net-snmp-5.3.1-19.el5.x86_64
file /usr/share/snmp/mibs/NET-SNMP-TC.txt from install of net-snmp-5.3.2.2-7.el5.x86_64 conflicts with file from package net-snmp-5.3.1-19.el5.x86_64
file /usr/share/snmp/mibs/UCD-SNMP-MIB.txt from install of net-snmp-5.3.2.2-7.el5.x86_64 conflicts with file from package net-snmp-5.3.1-19.el5.x86_64
安装失败,和 net-snmp-5.3.1-19.el5.x86_64 文件冲突
继续卸载 net-snmp-5.3.1-19.el5,发现有 3 个关联,狠下心,把几个关联的都删除了,不知道以后会不会有影响。
[root@web-server-b 21]# rpm -qa |grep snmp
net-snmp-5.3.1-19.el5
net-snmp-libs-5.3.2.2-7.el5
hp-snmp-agents-8.3.0.27-24
[root@web-server-b 21]# rpm -e net-snmp-5.3.1-19.el5
error: Failed dependencies:
net-snmp is needed by (installed) hp-snmp-agents-8.3.0.27-24.x86_64
[root@web-server-b 21]# rpm -e hp-snmp-agents-8.3.0.27-24
error: Failed dependencies:
hp-snmp-agents is needed by (installed) hp-smh-templates-8.3.0.9-13.noarch
[root@web-server-b 21]# rpm -e hp-smh-templates-8.3.0.9-13.noarch
[root@web-server-b 21]# rpm -e hp-snmp-agents-8.3.0.27-24
Shutting down NIC Agent Daemon (cmanicd): [纭畾]
Shutting down Storage Event Logger (cmaeventd): [纭畾]
Shutting down FCA agent (cmafcad): [纭畾]
Shutting down SAS agent (cmasasd): [纭畾]
Shutting down IDA agent (cmaidad): [纭畾]
Shutting down IDE agent (cmaided): [纭畾]
Shutting down SCSI agent (cmascsid): [纭畾]
Shutting down Health agent (cmahealthd): [纭畾]
Shutting down Standard Equipment agent (cmastdeqd): [纭畾]
Shutting down Host agent (cmahostd): [纭畾]
Shutting down Threshold agent (cmathreshd): [纭畾]
Shutting down RIB agent (cmasm2d): [纭畾]
Shutting down Rack Infrastructure Info Srv (cpqriisd): [澶辫触]
Shutting down Rack agent (cmarackd): [澶辫触]
Shutting down Performance agent (cmaperfd): [纭畾]
Shutting down SNMP Peer (cmapeerd): [纭畾]
Un-installing HPcmanic SELinux policy module
snmpd is started
warning: /etc/hp-snmp-agents.conf saved as /etc/hp-snmp-agents.conf.rpmsave
[root@web-server-b 21]#
[root@web-server-b 21]# rpm -e net-snmp-5.3.1-19.el5
warning: /etc/snmp/snmpd.conf saved as /etc/snmp/snmpd.conf.rpmsave
[root@web-server-b 21]#
[root@web-server-b 21]# rpm -ivh net-snmp-5.3.2.2-7.el5.x86_64.rpm
warning: net-snmp-5.3.2.2-7.el5.x86_64.rpm: Header V3 DSA signature: NOKEY, key ID e8562897
Preparing... ########################################### [100%]
1:net-snmp ########################################### [100%]
[root@web-server-b 21]#
net-snmp-libs-5.3.2.2-7.el5.x86_64.rpm 安装成功
[root@web-server-b 21]# rpm -ivh net-snmp-utils-5.3.2.2-7.el5.x86_64.rpm
warning: net-snmp-utils-5.3.2.2-7.el5.x86_64.rpm: Header V3 DSA signature: NOKEY, key ID e8562897
Preparing... ########################################### [100%]
1:net-snmp-utils ########################################### [100%]
[root@web-server-b 21]# rpm -ivh net-snmp-perl-5.3.2.2-7.el5.x86_64.rpm
warning: net-snmp-perl-5.3.2.2-7.el5.x86_64.rpm: Header V3 DSA signature: NOKEY, key ID e8562897
Preparing... ########################################### [100%]
1:net-snmp-perl ########################################### [100%]
[root@web-server-b 21]# rpm -ivh net-snmp-devel-5.3.2.2-7.el5.x86_64.rpm
warning: net-snmp-devel-5.3.2.2-7.el5.x86_64.rpm: Header V3 DSA signature: NOKEY, key ID e8562897
error: Failed dependencies:
beecrypt-devel is needed by net-snmp-devel-5.3.2.2-7.el5.x86_64
elfutils-devel is needed by net-snmp-devel-5.3.2.2-7.el5.x86_64
lm_sensors-devel is needed by net-snmp-devel-5.3.2.2-7.el5.x86_64
只有 net-snmp-devel-5.3.2.2-7.el5.x86_64.rpm 安装失败
[root@web-server-b 21]# rpm -qa |grep snmp
net-snmp-perl-5.3.2.2-7.el5
net-snmp-libs-5.3.2.2-7.el5
net-snmp-5.3.2.2-7.el5
net-snmp-utils-5.3.2.2-7.el5
查看安装目录
[root@web-server-b httpd]# rpm -ql net-snmp-5.3.2.2-7.el5
。。。
/usr/sbin/snmpd
。。。。
[root@web-server-b sbin]# find / -name 'snmpwalk'
/usr/bin/snmpwalk
/opt/net-snmp/bin/snmpwalk
/home/cacti/snmp/net-snmp-5.3.0.1/win32/snmpwalk
/home/cacti/snmp/net-snmp-5.3.0.1/apps/.libs/snmpwalk
/home/cacti/snmp/net-snmp-5.3.0.1/apps/snmpwalk
[root@web-server-b sbin]# /usr/bin/snmpwalk
No hostname specified.
USAGE: snmpwalk [OPTIONS] AGENT [OID]
Version: 5.3.2.2
Web: http://www.net-snmp.org/
Email: net-snmp-coders@lists.sourceforge.net
[root@web-server-b bin]# ll snmp*
-rwxr-xr-x 1 root root 8880 Sep 4 2009 snmpbulkget
-rwxr-xr-x 1 root root 11088 Sep 4 2009 snmpbulkwalk
-rwxr-xr-x 1 root root 26133 Sep 4 2009 snmpconf
-rwxr-xr-x 1 root root 19568 Sep 4 2009 snmpdelta
-rwxr-xr-x 1 root root 10936 Sep 4 2009 snmpdf
-rwxr-xr-x 1 root root 8320 Sep 4 2009 snmpget
-rwxr-xr-x 1 root root 8304 Sep 4 2009 snmpgetnext
lrwxrwxrwx 1 root root 8 Nov 9 15:32 snmpinform -> snmptrap
-rwxr-xr-x 1 root root 53080 Sep 4 2009 snmpnetstat
-rwxr-xr-x 1 root root 9736 Sep 4 2009 snmpset
-rwxr-xr-x 1 root root 12368 Sep 4 2009 snmpstatus
-rwxr-xr-x 1 root root 19328 Sep 4 2009 snmptable
-rwxr-xr-x 1 root root 13696 Sep 4 2009 snmptest
-rwxr-xr-x 1 root root 12952 Sep 4 2009 snmptranslate
-rwxr-xr-x 1 root root 11440 Sep 4 2009 snmptrap
-rwxr-xr-x 1 root root 31112 Sep 4 2009 snmpusm
-rwxr-xr-x 1 root root 25480 Sep 4 2009 snmpvacm
-rwxr-xr-x 1 root root 11048 Sep 4 2009 snmpwalk
[root@web-server-b bin]# pwd
/usr/bin
[root@web-server-b bin]#
rrdtool rpm 安装失败
[root@web-server-b 21]# ll
total 2064
-rw-r--r-- 1 root root 990143 Nov 9 15:14 rrdtool-1.2.30-1.el5.rf.x86_64.rpm
-rw-r--r-- 1 root root 979007 Nov 9 15:14 rrdtool-1.2.30-1.el5.wrl.x86_64.rpm
-rw-r--r-- 1 root root 8044 Nov 9 15:14 rrdtool-devel-1.2.30-1.el5.wrl.x86_64.rpm
-rw-r--r-- 1 root root 55345 Nov 9 15:14 rrdtool-perl-1.2.30-1.el5.wrl.x86_64.rpm
-rw-r--r-- 1 root root 39030 Nov 9 15:14 rrdtool-tcl-1.2.30-1.el5.wrl.x86_64.rpm
[root@web-server-b 21]# rpm -ivh rrdtool-1.2.30-1.el5.rf.x86_64.rpm
warning: rrdtool-1.2.30-1.el5.rf.x86_64.rpm: Header V3 DSA signature: NOKEY, key ID 6b8d79e6
error: Failed dependencies:
perl(RRDp) is needed by rrdtool-1.2.30-1.el5.rf.x86_64
perl(RRDs) is needed by rrdtool-1.2.30-1.el5.rf.x86_64
[root@web-server-b 21]# rpm -ivh rrdtool-1.2.30-1.el5.wrl.x86_64.rpm
error: Failed dependencies:
perl(RRDp) is needed by rrdtool-1.2.30-1.wrl.x86_64
perl(RRDs) is needed by rrdtool-1.2.30-1.wrl.x86_64
[root@web-server-b 21]# perl
[root@web-server-b 21]# which perl
/usr/bin/perl
[root@web-server-b 21]# rpm -ivh rrdtool-perl-1.2.30-1.el5.wrl.x86_64.rpm
error: Failed dependencies:
librrd.so.2()(64bit) is needed by rrdtool-perl-1.2.30-1.wrl.x86_64
rrdtool = 1.2.30 is needed by rrdtool-perl-1.2.30-1.wrl.x86_64
[root@web-server-b 21]# rpm -ivh rrdtool-devel-1.2.30-1.el5.wrl.x86_64.rpm
error: Failed dependencies:
librrd.so.2()(64bit) is needed by rrdtool-devel-1.2.30-1.wrl.x86_64
librrd_th.so.2()(64bit) is needed by rrdtool-devel-1.2.30-1.wrl.x86_64
rrdtool = 1.2.30 is needed by rrdtool-devel-1.2.30-1.wrl.x86_64
[root@web-server-b 21]#
决定不使用 rpm 方式安装 rrdtool 了,在网上下载源代码安装 rrdtool 1.4.2
[root@web-server-b rrdtool]# gunzip rrdtool-1.4.2.tar.gz
[root@web-server-b rrdtool]# tar xvf rrdtool-1.4.2.tar
rrdtool-1.4.2/
./configure --prefix=/home/cacti/rrdtool/install
make
make install
[root@web-server-b rrdtool]# cd install
[root@web-server-b install]# ls
bin include lib lib64 share
[root@web-server-b install]# cd bin
[root@web-server-b bin]# pwd
/home/cacti/rrdtool/install/bin
[root@web-server-b bin]# ll
total 508
-rwxr-xr-x 1 root root 111966 Nov 9 15:53 rrdcached
-rwxr-xr-x 1 root root 59211 Nov 9 15:53 rrdcgi
-rwxr-xr-x 1 root root 49995 Nov 9 15:53 rrdtool
-rwxr-xr-x 1 root root 255196 Nov 9 15:53 rrdupdate
[root@web-server-b bin]# ./rrdtool
RRDtool 1.4.2 Copyright 1997-2009 by Tobias Oetiker <tobi@oetiker.ch>
Compiled Nov 9 2011 15:53:18
Usage: rrdtool [options] command command_options
Valid commands: create, update, updatev, graph, graphv, dump, restore,
last, lastupdate, first, info, fetch, tune,
resize, xport, flushcached
RRDtool is distributed under the Terms of the GNU General
Public License Version 2. (www.gnu.org/copyleft/gpl.html)
For more information read the RRD manpages
[root@web-server-b bin]#
/home/cacti/rrdtool/install/bin/rrdtool cacti 的路径设置里找不到
还是不指定安装目录,重新默认安装 rrdtool
./configure
make clean
make
make install
原来路径 /usr/local/rrdtool-1.2.27/bin/rrdtool
现在安装 /opt/rrdtool-1.4.2
新的路径,cacti 都能找到了:
/usr/bin/snmpwalk
/usr/bin/snmpget
/usr/bin/snmpbulkwalk
/usr/bin/snmpgetnext
/opt/rrdtool-1.4.2/bin/rrdtool
/usr/share/fonts/msyh.ttf
/usr/bin/php
/var/www/html/log/cacti.log
/usr/local/spine/bin/spine
[root@web-server-b bin]# /usr/bin/snmpwalk
No hostname specified.
USAGE: snmpwalk [OPTIONS] AGENT [OID]
Version: 5.3.2.2
Web: http://www.net-snmp.org/
Email: net-snmp-coders@lists.sourceforge.net
[root@web-server-b bin]# /opt/rrdtool-1.4.2/bin/rrdtool
RRDtool 1.4.2 Copyright 1997-2009 by Tobias Oetiker <tobi@oetiker.ch>
Compiled Nov 9 2011 17:46:45
Usage: rrdtool [options] command command_options
Valid commands: create, update, updatev, graph, graphv, dump, restore,
last, lastupdate, first, info, fetch, tune,
resize, xport, flushcached
RRDtool is distributed under the Terms of the GNU General
Public License Version 2. (www.gnu.org/copyleft/gpl.html)
For more information read the RRD manpages
[root@web-server-b bin]#
[root@web-server-b bin]# service snmpd restart
/home/apache5/bin/apachectl start
/home/apache5/bin/apachectl stop
现在 21 和 17 的 rrdtool ,snmp 版本都一样了,但问题依旧没有解决。
2 个问题
一:部分图形画不出来。
11/10/2011 10:21:15 AM - SPINE: Poller[0] ERROR: SS[2] PHP Script Server communications lost. Restarting PHP Script Server
11/10/2011 10:21:15 AM - SPINE: Poller[0] ERROR: SS[2] Script Server did not start properly return message was: 'U'
11/10/2011 10:21:15 AM - SPINE: Poller[0] ERROR: SS[2] PHP Script Server communications lost. Restarting PHP Script Server
11/10/2011 10:21:15 AM - SPINE: Poller[0] ERROR: SS[2] Script Server did not start properly return message was: 'U'
11/10/2011 10:21:15 AM - SPINE: Poller[0] ERROR: SS[2] PHP Script Server communications lost. Restarting PHP Script Server
11/10/2011 10:21:15 AM - SPINE: Poller[0] ERROR: SS[2] Script Server did not start properly return message was: 'U'
11/10/2011 10:21:15 AM - SPINE: Poller[0] Host[7] DS[115] SS[2] SERVER: /var/www/html/scripts/ss_host_disk.php ss_host_disk 172.16.67.5 2:161:1000:public:::MD5::DES: 7 get percent 9, output: U
11/10/2011 10:21:15 AM - SPINE: Poller[0] Host[7] DS[107] SNMP: v2: 172.16.67.5, dsname: cpu_nice, oid: .1.3.6.1.4.1.2021.11.51.0, value: U
11/10/2011 10:21:15 AM - SPINE: Poller[0] Host[7] DS[108] SNMP: v2: 172.16.67.5, dsname: cpu_system, oid: .1.3.6.1.4.1.2021.11.52.0, value: 5499753
11/10/2011 10:21:15 AM - SPINE: Poller[0] Host[7] DS[109] SNMP: v2: 172.16.67.5, dsname: cpu_user, oid: .1.3.6.1.4.1.2021.11.50.0, value: 10451812
11/10/2011 10:21:15 AM - SPINE: Poller[0] Host[7] DS[110] SNMP: v2: 172.16.67.5, dsname: mem_buffers, oid: .1.3.6.1.4.1.2021.4.14.0, value: U
11/10/2011 10:21:15 AM - SPINE: Poller[0] Host[7] DS[111] SNMP: v2: 172.16.67.5, dsname: mem_cache, oid: .1.3.6.1.4.1.2021.4.15.0, value: U
11/10/2011 10:21:15 AM - SPINE: Poller[0] Host[7] DS[112] SNMP: v2: 172.16.67.5, dsname: mem_free, oid: .1.3.6.1.4.1.2021.4.6.0, value: 63071296
11/10/2011 10:21:15 AM - SPINE: Poller[0] Host[7] DS[274] SNMP: v2: 172.16.67.5, dsname: cpu_nice, oid: .1.3.6.1.4.1.2021.11.11.0, value: 97
二:rrdtool 画出来的图,中文全部乱码问题。
决定首先把 rrdtool 画图的中文乱码问题先解决。
在网上搜索到了几篇文章。
决定先使用网上的修改 rrdtool 源代码的方法:
cacti-rrdtool的汉化
root@web-server-b bin]# cp /home/cacti/rrdtool/rrdtool-1.4.2/src/rrd_graph.c /home/patrol
[root@web-server-b bin]# mv /home/cacti/rrdtool/rrdtool-1.4.2/src/rrd_graph.c /home/cacti/rrdtool/rrdtool-1.4.2/src/rrd_graph-bak.c
old_locale = setlocale(LC_NUMERIC, "C");
修改为
/*old_locale = setlocale(LC_NUMERIC, "C");*/
old_locale = setlocale(LC_NUMERIC, "zh_CN.UTF-8");
重新编译安装
改变安装目录
mkdir /opt/rrdtool-zh
./configure --prefix=/opt/rrdtool-zh
make clean
make
make install
原来路径 /opt/rrdtool-1.4.2
现在安装 /opt/rrdtool-zh
修改 cacti 路径
/opt/rrdtool-zh/bin/rrdtool
service snmpd restart
/home/apache5/bin/apachectl restart
结果 rrdtool 图形依然是乱码
怀疑是字符集写错了
old_locale = setlocale(LC_NUMERIC, "zh_CN.UTF-8");
查看机器本身有哪些字符集
local -a
locale -a |grep -i zh_CN i 参数表示忽略大小写
zh_CN
zh_CN.gb18030
zh_CN.gb2312
zh_CN.gbk
zh_CN.utf8
果然要修改为 zh_CN.utf8
设置操作系统的字符集
# export LANG=C C 表示英文语言
# export LANG=zh_CN.utf8 中文
但在 ssh 或者 CRT 中操作的时候,中文还是乱码,是因为终端工具的字符集还没有修改过来
以 CRT 为例:
options - session options - appearance
右边
character encoding 中设置 UTF-8
奇怪的是:global options 中居然没有这个选择
这样终端里面就能显示中文了
[root@web-server-b ~]# cat ./profle
cat: ./profle: 没有那个文件或目录
[root@web-server-b ~]#
修改环境变量
env 查看
/etc/profile
或者
.profile
或者
.bash_profile bash 环境下的 profile
[root@web-server-b ~]# cat ~/.bash_profile ~/ 表示在当前用户的主目录下
如果已经在用户的主目录下,可以执行
su - root
cat .bash_profile
重新修改
[root@web-server-b src]# pwd
/home/cacti/rrdtool/rrdtool-1.4.2/src
[root@web-server-b src]# vi rrd_graph.c
利用 : 下输入 /setlocale 回车 查找位置
old_locale = setlocale(LC_NUMERIC, "zh_CN.utf8");
[root@web-server-b rrdtool-1.4.2]# rm -rf /opt/rrdtool-zh
[root@web-server-b rrdtool-1.4.2]# mkdir /opt/rrdtool-zh-2
[root@web-server-b rrdtool-1.4.2]#
./configure --prefix=/opt/rrdtool-zh-2
make clean
make
make install
原来路径 /opt/rrdtool-zh
现在安装 /opt/rrdtool-zh-2
修改 cacti 路径
/opt/rrdtool-zh-2/bin/rrdtool
service snmpd restart
/home/apache5/bin/apachectl restart
依旧是乱码
决定试试另一种方法
http://www.51cacti.cn/thread-250-1-1.html
查看21 上,果然是按此方法来做的
21
[root@brio-server bin]# cat rrdtool
#!/bin/sh
export LANG=zh_CN.gb18030
/usr/bin/rrdtool.local "$@"
[root@brio-server bin]#
[root@brio-server bin]# cat /etc/sysconfig/i18n
LANG="zh_CN.UTF-8"
[root@brio-server bin]# locale -a|grep -i zh_cn
zh_CN
zh_CN.gb18030
zh_CN.gb2312
zh_CN.gbk
zh_CN.utf8
[root@brio-server bin]#
17
[root@web-server-b bin]# pwd
/opt/rrdtool-zh-2/bin
You have new mail in /var/spool/mail/root
[root@web-server-b bin]# pwd
/opt/rrdtool-zh-2/bin
[root@web-server-b bin]# ll
总计 508
-rwxr-xr-x 1 root root 111966 11-10 16:00 rrdcached
-rwxr-xr-x 1 root root 59211 11-10 16:00 rrdcgi
-rwxr-xr-x 1 root root 49995 11-10 16:00 rrdtool
-rwxr-xr-x 1 root root 255196 11-10 16:00 rrdupdate
[root@web-server-b bin]# mv rrdtool rrdtool.local
[root@web-server-b bin]# ll
总计 508
-rwxr-xr-x 1 root root 111966 11-10 16:00 rrdcached
-rwxr-xr-x 1 root root 59211 11-10 16:00 rrdcgi
-rwxr-xr-x 1 root root 49995 11-10 16:00 rrdtool.local
-rwxr-xr-x 1 root root 255196 11-10 16:00 rrdupdate
[root@web-server-b bin]#
直接 vi rrdtool 会新建一个文件
输入
#!/bin/sh
export LANG=zh_CN.gb18030
/opt/rrdtool-zh-2/bin/rrdtool.local "$@"
[root@web-server-b bin]# more rrdtool
#!/bin/sh
export LANG=zh_CN.gb18030
/opt/rrdtool-zh-2/bin/rrdtool.local "$@"
[root@web-server-b bin]#
service snmpd restart
/home/apache5/bin/apachectl restart
图形一把叉
查看权限
21
-rwxr-xr-x 1 root root 65 2010-08-02 rrdtool
17
-rw-r--r-- 1 root root 78 11-10 16:18 rrdtool
chmod 777 rrdtool
终于 rrdtool 图形的中文乱码问题解决了,图形上的中文全部正常了。
现在开始解决还有部分图形不出来的问题:
从 21 上把整个 rrd 文件夹都拷贝过来了
scp root@172.16.67.21:/var/www/html/rra/* /var/www/html/rra/
chown -R cactiuser /var/www/html/rra
时间 15:46 左右,继续监控系统。
发现一个现象: 17 上cacti 的设备里面 21 主机 down 了, 21 上设备里面 17 主机 down 了,怀疑是不是装了cacti 的原因,
17,21 上都安装了 cacti,所以它们 2 个互相监测对方不到,对方都是 down 机。
重新创建一个主机
Host: 67.24 应用主机APP
添加图形摸板,监控172.16.67.9服务器load.trace文件
创建图形后,不出图,‘打开图形调试模式’,显示
RRDTool 说:
ERROR: opening '/var/www/html/rra/67_24_m8000app_v_290.rrd': 没有那个文件或目录
在网上搜索,有一个说法 perl 安装缺少包
17
[root@web-server-b rra]# rpm -qa |grep perl
perl-Compress-Zlib-1.42-1.fc6
perl-HTML-Parser-3.55-1.fc6
perl-5.8.8-27.el5
newt-perl-1.08-9.2.2
net-snmp-perl-5.3.2.2-7.el5
perl-URI-1.35-3
perl-libwww-perl-5.805-1.1.1
mod_perl-2.0.4-6.el5
perl-SGMLSpm-1.03ii-16.2.1
perl-HTML-Tagset-3.10-2.1.1
perl-BSD-Resource-1.28-1.fc6.1
perl-String-CRC32-1.4-2.fc6
[root@web-server-b rra]#
[root@web-server-b rra]#
21
[root@brio-server ~]# rpm -qa |grep perl
perl-Compress-Zlib-1.42-1.fc6
perl-HTML-Parser-3.55-1.fc6
perl-DBD-MySQL-3.0007-2.el5
perl-5.8.8-27.el5
newt-perl-1.08-9.2.2
perl-DBD-Pg-1.49-2.el5_3.1
perl-URI-1.35-3
perl-libwww-perl-5.805-1.1.1
mod_perl-2.0.4-6.el5
perl-SGMLSpm-1.03ii-16.2.1
net-snmp-perl-5.3.2.2-7.el5
perl-HTML-Tagset-3.10-2.1.1
perl-BSD-Resource-1.28-1.fc6.1
perl-rrdtool-1.2.30-1.el5.rf
perl-DBI-1.52-2.el5
perl-String-CRC32-1.4-2.fc6
[root@brio-server ~]#
确实少了几个包
perl-DBD-MySQL-3.0007-2.el5
perl-DBD-Pg-1.49-2.el5_3.1
perl-rrdtool-1.2.30-1.el5.rf
perl-DBI-1.52-2.el5
21 上搜索
find / -name 'perl*'
找到了几个包
/home/orabiee/cacti/mysql/perl-DBD-MySQL-3.0007-2.el5.i386.rpm
/home/orabiee/cacti/mysql/perl-DBD-Pg-1.49-2.el5_3.1.i386.rpm
/home/orabiee/cacti/mysql/perl-DBI-1.52-2.el5.i386.rpm
/home/orabiee/cacti/rrdtool-1.4.4/bindings/perl-piped
/home/orabiee/cacti/rrdtool-1.4.4/bindings/perl-shared
/home/orabiee/cacti/httpd-2.2.15/srclib/pcre/perltest8
/home/orabiee/cacti/httpd-2.2.15/srclib/pcre/perltest
/home/orabiee/cacti/perl-rrdtool-1.2.30-1.el5.rf.x86_64.rpm
/home/orabiee/cacti/perl-rrdtool-1.2.23-1.el5.rf.x86_64.rpm
/home/orabiee/cacti/64/perl-DBD-MySQL-3.0007-2.el5.x86_64.rpm
/home/orabiee/cacti/64/perl-DBI-1.52-2.el5.x86_64.rpm
/home/orabiee/cacti/64/perl-DBD-Pg-1.49-2.el5_3.1.x86_64.rpm
/home/orabiee/biee/OracleBI/corda50/dev_tools/embedder/perl
scp root@172.16.67.21:/home/orabiee/cacti/64/* /home/cacti/perl
[root@web-server-b perl]# rpm -ivh perl-DBD-MySQL-3.0007-2.el5.x86_64.rpm
warning: perl-DBD-MySQL-3.0007-2.el5.x86_64.rpm: Header V3 DSA signature: NOKEY, key ID e8562897
error: Failed dependencies:
libmysqlclient.so.15()(64bit) is needed by perl-DBD-MySQL-3.0007-2.el5.x86_64
libmysqlclient.so.15(libmysqlclient_15)(64bit) is needed by perl-DBD-MySQL-3.0007-2.el5.x86_64
perl(DBI) is needed by perl-DBD-MySQL-3.0007-2.el5.x86_64
[root@web-server-b perl]# rpm -ivh perl-DBI-1.52-2.el5.x86_64.rpm
warning: perl-DBI-1.52-2.el5.x86_64.rpm: Header V3 DSA signature: NOKEY, key ID e8562897
Preparing... ########################################### [100%]
1:perl-DBI ########################################### [100%]
[root@web-server-b perl]# rpm -ivh perl-DBD-Pg-1.49-2.el5_3.1.x86_64.rpm
warning: perl-DBD-Pg-1.49-2.el5_3.1.x86_64.rpm: Header V3 DSA signature: NOKEY, key ID e8562897
Preparing... ########################################### [100%]
1:perl-DBD-Pg ########################################### [100%]
[root@web-server-b perl]# rpm -ivh perl-DBD-MySQL-3.0007-2.el5.x86_64.rpm
warning: perl-DBD-MySQL-3.0007-2.el5.x86_64.rpm: Header V3 DSA signature: NOKEY, key ID e8562897
error: Failed dependencies:
libmysqlclient.so.15()(64bit) is needed by perl-DBD-MySQL-3.0007-2.el5.x86_64
libmysqlclient.so.15(libmysqlclient_15)(64bit) is needed by perl-DB
scp root@172.16.67.21:/home/orabiee/cacti/perl* /home/cacti/perl
[root@web-server-b perl]# rpm -ivh perl-rrdtool-1.2.30-1.el5.rf.x86_64.rpm
warning: perl-rrdtool-1.2.30-1.el5.rf.x86_64.rpm: Header V3 DSA signature: NOKEY, key ID 6b8d79e6
error: Failed dependencies:
librrd.so.2()(64bit) is needed by perl-rrdtool-1.2.30-1.el5.rf.x86_64
rrdtool = 1.2.30 is needed by perl-rrdtool-1.2.30-1.el5.rf.x86_64
[root@web-server-b perl]#
perl-DBD-MySQL 和 perl-rrdtool rpm 包安装失败。错误原因好像是 rrdtool 没有检测到。
于是修改环境变量,指向 rrdtool 的路径。
vi /etc/profile
export PATH=/opt/rrdtool-zh-2/bin
[root@web-server-b perl]# env
-bash: env: command not found
[root@web-server-b perl]# vi /etc/profile
-bash: vi: command not found
[root@web-server-b perl]# export PATH=/usr/kerberos/sbin:/usr/kerberos/bin:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/root/bin
[root@web-server-b perl]#
export PATH=$PATH:/opt/rrdtool-zh-2/bin
[root@web-server-b perl]# rpm -ivh perl-rrdtool-1.2.30-1.el5.rf.x86_64.rpm
warning: perl-rrdtool-1.2.30-1.el5.rf.x86_64.rpm: Header V3 DSA signature: NOKEY, key ID 6b8d79e6
error: Failed dependencies:
librrd.so.2()(64bit) is needed by perl-rrdtool-1.2.30-1.el5.rf.x86_64
rrdtool = 1.2.30 is needed by perl-rrdtool-1.2.30-1.el5.rf.x86_64
依然安装失败。
[root@web-server-b 21]# rpm -qa|grep rrdtool
[root@web-server-b 21]# rpm -ivh rrdtool-1.2.30-1.el5.rf.x86_64.rpm
warning: rrdtool-1.2.30-1.el5.rf.x86_64.rpm: Header V3 DSA signature: NOKEY, key ID 6b8d79e6
error: Failed dependencies:
perl(RRDp) is needed by rrdtool-1.2.30-1.el5.rf.x86_64
perl(RRDs) is needed by rrdtool-1.2.30-1.el5.rf.x86_64
[root@web-server-b 21]# rpm -ivh rrdtool-1.2.30-1.el5.wrl.x86_64.rpm
error: Failed dependencies:
perl(RRDp) is needed by rrdtool-1.2.30-1.wrl.x86_64
perl(RRDs) is needed by rrdtool-1.2.30-1.wrl.x86_64
[root@web-server-b 21]# rpm -ivh rrdtool-perl-1.2.30-1.el5.wrl.x86_64.rpm
error: Failed dependencies:
librrd.so.2()(64bit) is needed by rrdtool-perl-1.2.30-1.wrl.x86_64
rrdtool = 1.2.30 is needed by rrdtool-perl-1.2.30-1.wrl.x86_64
后来在网上搜索,找到一篇文章,是说必须几个互相依赖的 rpm 一起安装,才能成功,原来 rpm 一次可以同时安装几个包。
rpm -ivh rrdtool-perl-1.2.30-1.el5.wrl.x86_64.rpm rrdtool-1.2.30-1.el5.rf.x86_64.rpm rrdtool-1.2.30-1.el5.wrl.x86_64.rpm
[root@web-server-b 21]# rpm -ivh rrdtool-perl-1.2.30-1.el5.wrl.x86_64.rpm rrdtool-1.2.30-1.el5.rf.x86_64.rpm rrdtool-1.2.30-1.el5.wrl.x86_64.rpm
warning: rrdtool-1.2.30-1.el5.rf.x86_64.rpm: Header V3 DSA signature: NOKEY, key ID 6b8d79e6
Preparing... ########################################### [100%]
1:rrdtool ########################################### [ 33%]
2:rrdtool-perl ########################################### [ 67%]
3:rrdtool ########################################### [100%]
[root@web-server-b 21]#
[root@web-server-b 21]# rpm -ivh rrdtool-devel-1.2.30-1.el5.wrl.x86_64.rpm rrdtool-tcl-1.2.30-1.el5.wrl.x86_64.rpm
Preparing... ########################################### [100%]
1:rrdtool-tcl ########################################### [ 50%]
2:rrdtool-devel ########################################### [100%]
[root@web-server-b 21]#
[root@web-server-b perl]# rpm -ivh perl-rrdtool-1.2.30-1.el5.rf.x86_64.rpm
warning: perl-rrdtool-1.2.30-1.el5.rf.x86_64.rpm: Header V3 DSA signature: NOKEY, key ID 6b8d79e6
Preparing... ########################################### [100%]
file /usr/lib64/perl5/vendor_perl/5.8.8/x86_64-linux-thread-multi/auto/RRDs/RRDs.so from install of perl-rrdtool-1.2.30-1.el5.rf.x86_64 conflicts with file from package rrdtool-perl-1.2.30-1.wrl.x86_64
[root@web-server-b perl]#
[root@web-server-b 21]# rpm -qa|grep perl
perl-Compress-Zlib-1.42-1.fc6
perl-HTML-Parser-3.55-1.fc6
perl-5.8.8-27.el5
newt-perl-1.08-9.2.2
net-snmp-perl-5.3.2.2-7.el5
perl-URI-1.35-3
perl-libwww-perl-5.805-1.1.1
mod_perl-2.0.4-6.el5
perl-SGMLSpm-1.03ii-16.2.1
perl-DBI-1.52-2.el5
perl-HTML-Tagset-3.10-2.1.1
perl-BSD-Resource-1.28-1.fc6.1
perl-DBD-Pg-1.49-2.el5_3.1
perl-String-CRC32-1.4-2.fc6
rrdtool-perl-1.2.30-1.wrl
[root@web-server-b 21]#
vi /etc/profile
export PATH=$PATH:/opt/rrdtool-zh-2/bin 删除这行
source /etc/profile
如果无效
则
exit
su - root
环境变量就可以生效
21 上和 17 上 perl 的安装包,都一样了,但图形依旧没有出来,还是同样的错误:
RRDTool 说:
ERROR: opening '/var/www/html/rra/67_24_m8000app_v_290.rrd': 没有那个文件或目录
[root@web-server-b ~]# rrdtool
RRDtool 1.2.30 Copyright 1997-2008 by Tobias Oetiker <tobi@oetiker.ch>
Compiled Feb 20 2009 18:17:02
Usage: rrdtool [options] command command_options
Valid commands: create, update, updatev, graph, dump, restore,
last, lastupdate, first, info, fetch, tune,
resize, xport
RRDtool is distributed under the Terms of the GNU General
Public License Version 2. (www.gnu.org/copyleft/gpl.html)
For more information read the RRD manpages
[root@web-server-b ~]# which rrdtool
/usr/bin/rrdtool
[root@web-server-b ~]#
修改 cacti 路径
/opt/rrdtool-zh-2/bin/rrdtool 修改为 /usr/bin/rrdtool
service snmpd restart
/home/apache5/bin/apachectl restart
对比发现,21 上和 17 上的 rrdtool rpm 包还有些不同,
21
[root@brio-server cacti]# rpm -qa|grep rrdtool
rrdtool-devel-1.2.30-1.wrl
rrdtool-1.2.30-1.el5.rf
perl-rrdtool-1.2.30-1.el5.rf
[root@brio-server cacti]#
17
[root@web-server-b perl]# rpm -qa|grep rrdtool
rrdtool-1.2.30-1.wrl
rrdtool-1.2.30-1.el5.rf
rrdtool-tcl-1.2.30-1.wrl
rrdtool-devel-1.2.30-1.wrl
rrdtool-perl-1.2.30-1.wrl
[root@web-server-b perl]#
[root@web-server-b 21]# rpm -e rrdtool-tcl-1.2.30-1.wrl
[root@web-server-b 21]# rpm -qa|grep rrdtool
rrdtool-1.2.30-1.el5.rf
rrdtool-devel-1.2.30-1.wrl
rrdtool-perl-1.2.30-1.wrl
[root@web-server-b 21]# rpm -e rrdtool-devel-1.2.30-1.wrl
[root@web-server-b 21]# rpm -qa|grep rrdtool
rrdtool-1.2.30-1.el5.rf
rrdtool-perl-1.2.30-1.wrl
[root@web-server-b 21]# rpm -e rrdtool-perl-1.2.30-1.wrl rrdtool-1.2.30-1.el5.rf
[root@web-server-b 21]# rpm -qa|grep rrdtool
[root@web-server-b 21]#
[root@web-server-b 21]# cp /home/cacti/perl/perl-rrdtool-1.2.30-1.el5.rf.x86_64.rpm /home/cacti/rrdtool/21
[root@web-server-b 21]# ll
总计 2124
-rw-r--r-- 1 root root 52134 11-11 18:47 perl-rrdtool-1.2.30-1.el5.rf.x86_64.rpm
-rw-r--r-- 1 root root 990143 11-09 15:14 rrdtool-1.2.30-1.el5.rf.x86_64.rpm
-rw-r--r-- 1 root root 979007 11-09 15:14 rrdtool-1.2.30-1.el5.wrl.x86_64.rpm
-rw-r--r-- 1 root root 8044 11-09 15:14 rrdtool-devel-1.2.30-1.el5.wrl.x86_64.rpm
-rw-r--r-- 1 root root 55345 11-09 15:14 rrdtool-perl-1.2.30-1.el5.wrl.x86_64.rpm
-rw-r--r-- 1 root root 39030 11-09 15:14 rrdtool-tcl-1.2.30-1.el5.wrl.x86_64.rpm
[root@web-server-b 21]# rpm -ivh perl-rrdtool-1.2.30-1.el5.rf.x86_64.rpm rrdtool-1.2.30-1.el5.rf.x86_64.rpm rrdtool-devel-1.2.30-1.el5.wrl.x86_64.rpm
warning: perl-rrdtool-1.2.30-1.el5.rf.x86_64.rpm: Header V3 DSA signature: NOKEY, key ID 6b8d79e6
Preparing... ########################################### [100%]
1:rrdtool ########################################### [ 33%]
2:perl-rrdtool ########################################### [ 67%]
3:rrdtool-devel ########################################### [100%]
[root@web-server-b 21]#
service snmpd restart
/home/apache5/bin/apachectl restart
现在 21 和 17 上的 rrdtool rpm 包也基本上一样了,但还是同样的错误。
RRDTool 说:
ERROR: opening '/var/www/html/rra/67_24_m8000app_v_290.rrd': No such file or directory
RRDTool 说:
ERROR: opening '/var/www/html/rra/172_16_67_15-web1_v_292.rrd': No such file or directory
在这个问题上纠缠了很久,最后终于找到了原因。
perl,rrdtool,snmp 都没有问题,接下来我就开始寻找 php 的原因了,检查 php 的安装是否正确。
查看文档前面的安装 php 记录,发现 crontab 的设置:
crontab -e
*/3 * * * * /home/php/bin/php /home/apache5/htdocs/cacti/poller.php
[cactiuser@web-server-b ~]$ crontab -l
*/3 * * * * /home/php/bin/php /home/apache5/htdocs/cacti/poller.php
其中的 php 路径是: /home/php/bin/php
然而在 cacti 路径里设置的 php 路径
/usr/bin/php
但实际上安装的是
/home/php/bin
路径修改
/home/php/bin/php
service snmpd restart
/home/apache5/bin/apachectl restart
果然是这个原因,所有的磁盘空间的图形都出来了,除了 21 设备里面的图形全部出不来外,其余的图形都基本出来了,和 21 上一样。
21 的图形出不来,估计和 21 上安装了 cacti ,2 边互相监测不到,down 机有关系。
于是在新增的 24 设备上,增加了所有的 21 上面的图形模板,创建了 21 上的所有图形。
很快发现一个新问题,17 上新创建的图形无法显示出来:
RRDTool 说:
ERROR: opening '/var/www/html/rra/67_24_m8000app_v_290.rrd': No such file or directory
17 上新创建的图形,无法创建 rrd 文件。
即使 touch **.rrd 创建出来的 rrd 文件也不能用。
必须从 21 上先创建同样的 rrd 文件,然后拷贝到 17 上来,才能继续画图。
21 上面的 cacti 以后要删除,所以不能依赖 21,
必须要 17 上面的 cacti 自己能新建 rrd 文件。
cacti 的日志,已经没有 error 了,但新增的图形就是出不来。
11/11/2011 07:36:01 PM - POLLER: Poller[0] NOTE: Poller Int: '300', Cron Int: '300', Time Since Last: '180', Max Runtime '298', Poller Runs: '1'
11/11/2011 07:36:01 PM - POLLER: Poller[0] NOTE: Cron is configured to run too often! The Poller Interval is '300' seconds, with a minimum Cron period of '300' seconds, but only 180 seconds have passed since the poller last ran.
11/11/2011 07:39:01 PM - POLLER: Poller[0] NOTE: Poller Int: '300', Cron Int: '300', Time Since Last: '360', Max Runtime '298', Poller Runs: '1'
11/11/2011 07:39:01 PM - POLLER: Poller[0] WARNING: Cron is out of sync with the Poller Interval! The Poller Interval is '300' seconds, with a maximum of a '300' second Cron, but 360 seconds have passed since the last poll!
11/11/2011 07:39:01 PM - PHPSVR: Poller[0] PHP Script Server has Started - Parent is spine
11/11/2011 07:39:01 PM - PHPSVR: Poller[0] PHP Script Server has Started - Parent is spine
11/11/2011 07:39:01 PM - PHPSVR: Poller[0] PHP Script Server has Started - Parent is spine
11/11/2011 07:39:01 PM - PHPSVR: Poller[0] PHP Script Server has Started - Parent is spine
11/11/2011 07:39:01 PM - PHPSVR: Poller[0] PHP Script Server has Started - Parent is spine
11/11/2011 07:39:01 PM - PHPSVR: Poller[0] PHP Script Server has Started - Parent is spine
11/11/2011 07:39:01 PM - PHPSVR: Poller[0] PHP Script Server has Started - Parent is spine
11/11/2011 07:39:01 PM - PHPSVR: Poller[0] PHP Script Server has Started - Parent is spine
11/11/2011 07:39:01 PM - PHPSVR: Poller[0] PHP Script Server has Started - Parent is spine
11/11/2011 07:39:01 PM - PHPSVR: Poller[0] PHP Script Server has Started - Parent is spine
11/11/2011 07:39:01 PM - PHPSVR: Poller[0] PHP Script Server has Started - Parent is spine
11/11/2011 07:39:01 PM - PHPSVR: Poller[0] PHP Script Server has Started - Parent is spine
11/11/2011 07:39:01 PM - SPINE: Poller[0] Host[5] SNMP Result: Host responded to SNMP
11/11/2011 07:39:01 PM - SPINE: Poller[0] Host[4] SNMP Result: Host responded to SNMP
11/11/2011 07:39:01 PM - SPINE: Poller[0] Host[4] NOTE: There are '23' Polling Items for this Host
11/11/2011 07:39:01 PM - SPINE: Poller[0] Host[5] NOTE: There are '23' Polling Items for this Host
11/11/2011 07:39:01 PM - PHPSVR: Poller[0] PHP Script Server has Started - Parent is spine
11/11/2011 07:39:01 PM - PHPSVR: Poller[0] PHP Script Server has Started - Parent is spine
11/11/2011 07:39:01 PM - SPINE: Poller[0] Host[4] DS[80] SS[0] SERVER: /var/www/html/scripts/ss_host_disk.php ss_host_disk 172.16.67.15 2:161:1000:public:::MD5::DES: 4 get percent 3, output: 0
11/11/2011 07:39:01 PM - SPINE: Poller[0] Host[5] DS[91] SS[1] SERVER: /home/apache5/htdocs/cacti/scripts/ss_host_disk.php ss_host_disk 172.16.67.17 2:161:1000:public:::MD5::DES: 5 get used 3, output: 274432
11/11/2011 07:39:01 PM - PHPSVR: Poller[0] PHP Script Server has Started - Parent is spine
11/11/2011 07:39:01 PM - SPINE: Poller[0] Host[4] DS[80] SS[2] SERVER: /var/www/html/scripts/ss_host_disk.php ss_host_disk 172.16.67.15 2:161:1000:public:::MD5::DES: 4 get used 3, output: 286720
11/11/2011 07:39:01 PM - PHPSVR: Poller[0] PHP Script Server has Started - Parent is spine
11/11/2011 07:39:01 PM - SPINE: Poller[0] Host[5] DS[91] SS[3] SERVER: /home/apache5/htdocs/cacti/scripts/ss_host_disk.php ss_host_disk 172.16.67.17 2:161:1000:public:::MD5::DES: 5 get percent 3, output: 0
11/11/2011 07:39:01 PM - SPINE: Poller[0] Host[4] DS[80] SS[4] SERVER: /var/www/html/scripts/ss_host_disk.php ss_host_disk 172.16.67.15 2:161:1000:public:::MD5::DES: 4 get total 3, output: 18924691456
11/11/2011 07:39:01 PM - SPINE: Poller[0] Host[5] DS[91] SS[5] SERVER: /home/apache5/htdocs/cacti/scripts/ss_host_disk.php ss_host_disk 172.16.67.17 2:161:1000:public:::MD5::DES: 5 get total 3, output: 18924691456
11/11/2011 07:39:01 PM - SPINE: Poller[0] Host[8] SNMP Result: Host responded to SNMP
11/11/2011 07:39:01 PM - SPINE: Poller[0] Host[7] SNMP Result: Host responded to SNMP
11/11/2011 07:39:01 PM - SPINE: Poller[0] Host[7] NOTE: There are '44' Polling Items for this Host
11/11/2011 07:39:01 PM - SPINE: Poller[0] Host[8] NOTE: There are '42' Polling Items for this Host
11/11/2011 07:39:01 PM - SPINE: Poller[0] Host[8] DS[129] SS[1] SERVER: /var/www/html/scripts/ss_host_disk.php ss_host_disk 172.16.67.7 2:161:1000:public:::MD5::DES: 8 get total 3, output: 132973699072
11/11/2011 07:39:01 PM - SPINE: Poller[0] Host[4] DS[81] SS[0] SERVER: /var/www/html/scripts/ss_host_disk.php ss_host_disk 172.16.67.15 2:161:1000:public:::MD5::DES: 4 get percent 4, output: 45.59
11/11/2011 07:39:01 PM - SPINE: Poller[0] Host[4] DS[81] SS[2] SERVER: /var/www/html/scripts/ss_host_disk.php ss_host_disk 172.16.67.15 2:161:1000:public:::MD5::DES: 4 get total 4, output: 123706839040
11/11/2011 07:39:01 PM - SPINE: Poller[0] Host[5] DS[92] SS[1] SERVER: /home/apache5/htdocs/cacti/scripts/ss_host_disk.php ss_host_disk 172.16.67.17 2:161:1000:public:::MD5::DES: 5 get percent 4, output: 48.44
11/11/2011 07:39:01 PM - PHPSVR: Poller[0] PHP Script Server has Started - Parent is spine
11/11/2011 07:39:01 PM - SPINE: Poller[0] Host[7] DS[113] SS[0] SERVER: /var/www/html/scripts/ss_host_disk.php ss_host_disk 172.16.67.5 2:161:1000:public:::MD5::DES: 7 get percent 3, output: 16.85
11/11/2011 07:39:01 PM - SPINE: Poller[0] Host[8] DS[129] SS[2] SERVER: /var/www/html/scripts/ss_host_disk.php ss_host_disk 172.16.67.7 2:161:1000:public:::MD5::DES: 8 get percent 3, output: 17.06
11/11/2011 07:39:01 PM - SPINE: Poller[0] Host[7] DS[113] SS[3] SERVER: /var/www/html/scripts/ss_host_disk.php ss_host_disk 172.16.67.5 2:161:1000:public:::MD5::DES: 7 get total 3, output: 132973174784
11/11/2011 07:39:01 PM - SPINE: Poller[0] Host[4] DS[81] SS[3] SERVER: /var/www/html/scripts/ss_host_disk.php ss_host_disk 172.16.67.15 2:161:1000:public:::MD5::DES: 4 get used 4, output: 56400326656
11/11/2011 07:39:01 PM - SPINE: Poller[0] Host[5] DS[92] SS[4] SERVER: /home/apache5/htdocs/cacti/scripts/ss_host_disk.php ss_host_disk 172.16.67.17 2:161:1000:public:::MD5::DES: 5 get used 4, output: 59919032320
11/11/2011 07:39:01 PM - SPINE: Poller[0] Host[5] DS[92] SS[0] SERVER: /home/apache5/htdocs/cacti/scripts/ss_host_disk.php ss_host_disk 172.16.67.17 2:161:1000:public:::MD5::DES: 5 get total 4, output: 123706839040
11/11/2011 07:39:01 PM - SPINE: Poller[0] Host[5] DS[93] SS[1] SERVER: /home/apache5/htdocs/cacti/scripts/ss_host_disk.php ss_host_disk 172.16.67.17 2:161:1000:public:::MD5::DES: 5 get total 5, output: 103512064
11/11/2011 07:39:01 PM - PHPSVR: Poller[0] PHP Script Server has Started - Parent is spine
11/11/2011 07:39:01 PM - SPINE: Poller[0] Host[8] DS[129] SS[4] SERVER: /var/www/html/scripts/ss_host_disk.php ss_host_disk 172.16.67.7 2:161:1000:public:::MD5::DES: 8 get used 3, output: 22683721728
11/11/2011 07:39:01 PM - SPINE: Poller[0] Host[8] DS[130] SS[0] SERVER: /var/www/html/scripts/ss_host_disk.php ss_host_disk 172.16.67.7 2:161:1000:public:::MD5::DES: 8 get total 4, output: 62854459392
11/11/2011 07:39:01 PM - SPINE: Poller[0] Host[7] DS[113] SS[5] SERVER: /var/www/html/scripts/ss_host_disk.php ss_host_disk 172.16.67.5 2:161:1000:public:::MD5::DES: 7 get used 3, output: 22411157504
11/11/2011 07:39:01 PM - SPINE: Poller[0] Host[11] SNMP Result: Host responded to SNMP
11/11/2011 07:39:01 PM - SPINE: Poller[0] Host[11] NOTE: There are '3' Polling Items for this Host
11/11/2011 07:39:01 PM - SPINE: Poller[0] Host[4] DS[82] SS[5] SERVER: /var/www/html/scripts/ss_host_disk.php ss_host_disk 172.16.67.15 2:161:1000:public:::MD5::DES: 4 get percent 5, output: 12.29
11/11/2011 07:39:01 PM - SPINE: Poller[0] Host[5] DS[93] SS[2] SERVER: /home/apache5/htdocs/cacti/scripts/ss_host_disk.php ss_host_disk 172.16.67.17 2:161:1000:public:::MD5::DES: 5 get used 5, output: 12717056
11/11/2011 07:39:01 PM - SPINE: Poller[0] Host[8] DS[130] SS[1] SERVER: /var/www/html/scripts/ss_host_disk.php ss_host_disk 172.16.67.7 2:161:1000:public:::MD5::DES: 8 get percent 4, output: 43.42
11/11/2011 07:39:01 PM - SPINE: Poller[0] Host[5] DS[194] SCRIPT: /usr/bin/perl /var/www/html/scripts/ping.pl 172.16.67.17, output: 0.028
11/11/2011 07:39:01 PM - SPINE: Poller[0] Host[5] DS[85] SNMP: v2: 172.16.67.17, dsname: cpu_nice, oid: .1.3.6.1.4.1.2021.11.51.0, value: 70439
11/11/2011 07:39:01 PM - SPINE: Poller[0] Host[5] DS[86] SNMP: v2: 172.16.67.17, dsname: cpu_system, oid: .1.3.6.1.4.1.2021.11.52.0, value: 12469192
11/11/2011 07:39:01 PM - SPINE: Poller[0] Host[5] DS[87] SNMP: v2: 172.16.67.17, dsname: cpu_user, oid: .1.3.6.1.4.1.2021.11.50.0, value: 28657058
11/11/2011 07:39:01 PM - SPINE: Poller[0] Host[5] DS[88] SNMP: v2: 172.16.67.17, dsname: mem_buffers, oid: .1.3.6.1.4.1.2021.4.14.0, value: 539304
11/11/2011 07:39:01 PM - SPINE: Poller[0] Host[5] DS[89] SNMP: v2: 172.16.67.17, dsname: mem_cache, oid: .1.3.6.1.4.1.2021.4.15.0, value: 2109692
11/11/2011 07:39:01 PM - SPINE: Poller[0] Host[5] DS[90] SNMP: v2: 172.16.67.17, dsname: mem_free, oid: .1.3.6.1.4.1.2021.4.6.0, value: 162112
11/11/2011 07:39:01 PM - SPINE: Poller[0] Host[5] DS[94] SNMP: v2: 172.16.67.17, dsname: traffic_out, oid: .1.3.6.1.2.1.2.2.1.16.2, value: 811218215
11/11/2011 07:39:01 PM - SPINE: Poller[0] Host[5] DS[95] SNMP: v2: 172.16.67.17, dsname: traffic_in, oid: .1.3.6.1.2.1.2.2.1.10.4, value: 1414174529
11/11/2011 07:39:01 PM - SPINE: Poller[0] Host[5] DS[265] SNMP: v2: 172.16.67.17, dsname: cpu_nice, oid: .1.3.6.1.4.1.2021.11.11.0, value: 99
11/11/2011 07:39:01 PM - SPINE: Poller[0] Host[5] DS[266] SNMP: v2: 172.16.67.17, dsname: cpu_system, oid: .1.3.6.1.4.1.2021.11.10.0, value: 0
11/11/2011 07:39:01 PM - SPINE: Poller[0] Host[7] DS[114] SS[2] SERVER: /var/www/html/scripts/ss_host_disk.php ss_host_disk 172.16.67.5 2:161:1000:public:::MD5::DES: 7 get percent 4, output: 48.93
11/11/2011 07:39:01 PM - SPINE: Poller[0] Host[7] DS[114] SS[4] SERVER: /var/www/html/scripts/ss_host_disk.php ss_host_disk 172.16.67.5 2:161:1000:public:::MD5::DES: 7 get total 4, output: 62854459392
11/11/2011 07:39:01 PM - SPINE: Poller[0] Host[8] DS[130] SS[3] SERVER: /var/www/html/scripts/ss_host_disk.php ss_host_disk 172.16.67.7 2:161:1000:public:::MD5::DES: 8 get used 4, output: 27291468800
11/11/2011 07:39:01 PM - SPINE: Poller[0] Host[5] DS[93] SS[4] SERVER: /home/apache5/htdocs/cacti/scripts/ss_host_disk.php ss_host_disk 172.16.67.17 2:161:1000:public:::MD5::DES: 5 get percent 5, output: 12.29
11/11/2011 07:39:01 PM - SPINE: Poller[0] Host[5] DS[267] SNMP: v2: 172.16.67.17, dsname: cpu_user, oid: .1.3.6.1.4.1.2021.11.9.0, value: 0
11/11/2011 07:39:01 PM - SPINE: Poller[0] Host[5] DS[94] SNMP: v2: 172.16.67.17, dsname: traffic_in, oid: .1.3.6.1.2.1.2.2.1.10.2, value: 3283326806
11/11/2011 07:39:01 PM - SPINE: Poller[0] Host[5] DS[95] SNMP: v2: 172.16.67.17, dsname: traffic_out, oid: .1.3.6.1.2.1.2.2.1.16.4, value: 2366904
11/11/2011 07:39:01 PM - SPINE: Poller[0] Host[7] DS[114] SS[5] SERVER: /var/www/html/scripts/ss_host_disk.php ss_host_disk 172.16.67.5 2:161:1000:public:::MD5::DES: 7 get used 4, output: 30753094656
11/11/2011 07:39:01 PM - SPINE: Poller[0] Host[7] DS[115] SS[1] SERVER: /var/www/html/scripts/ss_host_disk.php ss_host_disk 172.16.67.5 2:161:1000:public:::MD5::DES: 7 get total 9, output: 132620918784
11/11/2011 07:39:01 PM - SPINE: Poller[0] Host[8] DS[131] SS[0] SERVER: /var/www/html/scripts/ss_host_disk.php ss_host_disk 172.16.67.7 2:161:1000:public:::MD5::DES: 8 get percent 9, output: 0
11/11/2011 07:39:01 PM - SPINE: Poller[0] Host[8] DS[131] SS[3] SERVER: /var/www/html/scripts/ss_host_disk.php ss_host_disk 172.16.67.7 2:161:1000:public:::MD5::DES: 8 get total 9, output: 132623761408
11/11/2011 07:39:01 PM - SPINE: Poller[0] Host[7] DS[115] SS[2] SERVER: /var/www/html/scripts/ss_host_disk.php ss_host_disk 172.16.67.5 2:161:1000:public:::MD5::DES: 7 get used 9, output: 1859584
11/11/2011 07:39:01 PM - SPINE: Poller[0] Host[8] DS[131] SS[4] SERVER: /var/www/html/scripts/ss_host_disk.php ss_host_disk 172.16.67.7 2:161:1000:public:::MD5::DES: 8 get used 9, output: 1859584
11/11/2011 07:39:01 PM - SPINE: Poller[0] Host[8] DS[132] SS[0] SERVER: /var/www/html/scripts/ss_host_disk.php ss_host_disk 172.16.67.7 2:161:1000:public:::MD5::DES: 8 get total 12, output: 15496055808
11/11/2011 07:39:01 PM - SPINE: Poller[0] Host[7] DS[116] SS[5] SERVER: /var/www/html/scripts/ss_host_disk.php ss_host_disk 172.16.67.5 2:161:1000:public:::MD5::DES: 7 get percent 12, output: 8.67
11/11/2011 07:39:01 PM - SPINE: Poller[0] Host[7] DS[116] SS[2] SERVER: /var/www/html/scripts/ss_host_disk.php ss_host_disk 172.16.67.5 2:161:1000:public:::MD5::DES: 7 get total 12, output: 15496055808
11/11/2011 07:39:01 PM - SPINE: Poller[0] Host[8] DS[132] SS[1] SERVER: /var/www/html/scripts/ss_host_disk.php ss_host_disk 172.16.67.7 2:161:1000:public:::MD5::DES: 8 get percent 12, output: 8.61
11/11/2011 07:39:01 PM - SPINE: Poller[0] Host[7] DS[116] SS[3] SERVER: /var/www/html/scripts/ss_host_disk.php ss_host_disk 172.16.67.5 2:161:1000:public:::MD5::DES: 7 get used 12, output: 1343131648
11/11/2011 07:39:02 PM - SPINE: Poller[0] Host[8] DS[132] SS[4] SERVER: /var/www/html/scripts/ss_host_disk.php ss_host_disk 172.16.67.7 2:161:1000:public:::MD5::DES: 8 get used 12, output: 1334713344
11/11/2011 07:39:02 PM - SPINE: Poller[0] Host[7] DS[117] SS[5] SERVER: /var/www/html/scripts/ss_host_disk.php ss_host_disk 172.16.67.5 2:161:1000:public:::MD5::DES: 7 get percent 13, output: 0
11/11/2011 07:39:02 PM - SPINE: Poller[0] Host[7] DS[117] SS[1] SERVER: /var/www/html/scripts/ss_host_disk.php ss_host_disk 172.16.67.5 2:161:1000:public:::MD5::DES: 7 get total 13, output: 132619141120
11/11/2011 07:39:02 PM - SPINE: Poller[0] Host[8] DS[133] SS[0] SERVER: /var/www/html/scripts/ss_host_disk.php ss_host_disk 172.16.67.7 2:161:1000:public:::MD5::DES: 8 get percent 13, output: 0
11/11/2011 07:39:02 PM - SPINE: Poller[0] Host[8] DS[133] SS[3] SERVER: /var/www/html/scripts/ss_host_disk.php ss_host_disk 172.16.67.7 2:161:1000:public:::MD5::DES: 8 get total 13, output: 132621991936
11/11/2011 07:39:02 PM - SPINE: Poller[0] Host[7] DS[117] SS[2] SERVER: /var/www/html/scripts/ss_host_disk.php ss_host_disk 172.16.67.5 2:161:1000:public:::MD5::DES: 7 get used 13, output: 73728
11/11/2011 07:39:02 PM - SPINE: Poller[0] Host[8] DS[133] SS[4] SERVER: /var/www/html/scripts/ss_host_disk.php ss_host_disk 172.16.67.7 2:161:1000:public:::MD5::DES: 8 get used 13, output: 73728
11/11/2011 07:39:02 PM - SPINE: Poller[0] Host[8] DS[134] SS[0] SERVER: /var/www/html/scripts/ss_host_disk.php ss_host_disk 172.16.67.7 2:161:1000:public:::MD5::DES: 8 get total 14, output: 132622016512
11/11/2011 07:39:02 PM - SPINE: Poller[0] Host[7] DS[118] SS[5] SERVER: /var/www/html/scripts/ss_host_disk.php ss_host_disk 172.16.67.5 2:161:1000:public:::MD5::DES: 7 get percent 14, output: 0
11/11/2011 07:39:02 PM - SPINE: Poller[0] Host[7] DS[118] SS[2] SERVER: /var/www/html/scripts/ss_host_disk.php ss_host_disk 172.16.67.5 2:161:1000:public:::MD5::DES: 7 get total 14, output: 132619165696
11/11/2011 07:39:02 PM - SPINE: Poller[0] Host[8] DS[134] SS[1] SERVER: /var/www/html/scripts/ss_host_disk.php ss_host_disk 172.16.67.7 2:161:1000:public:::MD5::DES: 8 get percent 14, output: 0
11/11/2011 07:39:02 PM - SPINE: Poller[0] Host[7] DS[118] SS[3] SERVER: /var/www/html/scripts/ss_host_disk.php ss_host_disk 172.16.67.5 2:161:1000:public:::MD5::DES: 7 get used 14, output: 65536
11/11/2011 07:39:02 PM - SPINE: Poller[0] Host[8] DS[134] SS[4] SERVER: /var/www/html/scripts/ss_host_disk.php ss_host_disk 172.16.67.7 2:161:1000:public:::MD5::DES: 8 get used 14, output: 65536
11/11/2011 07:39:02 PM - SPINE: Poller[0] Host[7] DS[119] SS[5] SERVER: /var/www/html/scripts/ss_host_disk.php ss_host_disk 172.16.67.5 2:161:1000:public:::MD5::DES: 7 get percent 15, output: 70.02
11/11/2011 07:39:02 PM - SPINE: Poller[0] Host[7] DS[119] SS[1] SERVER: /var/www/html/scripts/ss_host_disk.php ss_host_disk 172.16.67.5 2:161:1000:public:::MD5::DES: 7 get total 15, output: 21140325376
11/11/2011 07:39:02 PM - SPINE: Poller[0] Host[8] DS[135] SS[0] SERVER: /var/www/html/scripts/ss_host_disk.php ss_host_disk 172.16.67.7 2:161:1000:public:::MD5::DES: 8 get percent 15, output: 66.83
11/11/2011 07:39:02 PM - SPINE: Poller[0] Host[8] DS[135] SS[3] SERVER: /var/www/html/scripts/ss_host_disk.php ss_host_disk 172.16.67.7 2:161:1000:public:::MD5::DES: 8 get total 15, output: 21140325376
11/11/2011 07:39:02 PM - SPINE: Poller[0] Host[7] DS[119] SS[2] SERVER: /var/www/html/scripts/ss_host_disk.php ss_host_disk 172.16.67.5 2:161:1000:public:::MD5::DES: 7 get used 15, output: 14801576960
11/11/2011 07:39:02 PM - SPINE: Poller[0] Host[4] DS[82] SS[3] SERVER: /var/www/html/scripts/ss_host_disk.php ss_host_disk 172.16.67.15 2:161:1000:public:::MD5::DES: 4 get used 5, output: 12717056
11/11/2011 07:39:02 PM - SPINE: Poller[0] Host[4] DS[82] SS[5] SERVER: /var/www/html/scripts/ss_host_disk.php ss_host_disk 172.16.67.15 2:161:1000:public:::MD5::DES: 4 get total 5, output: 103512064
11/11/2011 07:39:02 PM - SPINE: Poller[0] Host[8] DS[135] SS[4] SERVER: /var/www/html/scripts/ss_host_disk.php ss_host_disk 172.16.67.7 2:161:1000:public:::MD5::DES: 8 get used 15, output: 14128096256
11/11/2011 07:39:02 PM - SPINE: Poller[0] Host[4] DS[169] SCRIPT: /usr/bin/perl /var/www/html/scripts/ping.pl 172.16.67.15, output: 0.121
11/11/2011 07:39:02 PM - SPINE: Poller[0] Host[8] DS[136] SS[0] SERVER: /var/www/html/scripts/ss_host_disk.php ss_host_disk 172.16.67.7 2:161:1000:public:::MD5::DES: 8 get total 17, output: 0
11/11/2011 07:39:02 PM - SPINE: Poller[0] Host[7] DS[120] SS[5] SERVER: /var/www/html/scripts/ss_host_disk.php ss_host_disk 172.16.67.5 2:161:1000:public:::MD5::DES: 7 get percent 17, output: 0
11/11/2011 07:39:02 PM - SPINE: Poller[0] Host[7] DS[120] SS[2] SERVER: /var/www/html/scripts/ss_host_disk.php ss_host_disk 172.16.67.5 2:161:1000:public:::MD5::DES: 7 get total 17, output: 0
11/11/2011 07:39:02 PM - SPINE: Poller[0] Host[8] DS[136] SS[1] SERVER: /var/www/html/scripts/ss_host_disk.php ss_host_disk 172.16.67.7 2:161:1000:public:::MD5::DES: 8 get percent 17, output: 0
11/11/2011 07:39:02 PM - SPINE: Poller[0] Host[7] DS[120] SS[3] SERVER: /var/www/html/scripts/ss_host_disk.php ss_host_disk 172.16.67.5 2:161:1000:public:::MD5::DES: 7 get used 17, output: 0
11/11/2011 07:
11/11/2011 07:39:06 PM - SPINE: Poller[0] Host[8] DS[287] SCRIPT: /usr/java/jdk1.6.0_22/bin/java -jar /var/www/html/scripts/moniter_fat.jar db 172.16.67.8:1521:orasjzfb wi wi tablespace TBS_WI_001, output: t:128817561600 u1:42099867648 f1:86717693952 u2:32.68 f2:67.32
11/11/2011 07:39:06 PM - SPINE: Poller[0] Host[8] DS[123] SNMP: v2: 172.16.67.7, dsname: cpu_nice, oid: .1.3.6.1.4.1.2021.11.51.0, value: U
11/11/2011 07:39:06 PM - SPINE: Poller[0] Host[8] DS[124] SNMP: v2: 172.16.67.7, dsname: cpu_system, oid: .1.3.6.1.4.1.2021.11.52.0, value: 2589474
11/11/2011 07:39:06 PM - SPINE: Poller[0] Host[8] DS[125] SNMP: v2: 172.16.67.7, dsname: cpu_user, oid: .1.3.6.1.4.1.2021.11.50.0, value: 1388086
11/11/2011 07:39:06 PM - SPINE: Poller[0] Host[8] DS[126] SNMP: v2: 172.16.67.7, dsname: mem_buffers, oid: .1.3.6.1.4.1.2021.4.14.0, value: U
11/11/2011 07:39:06 PM - SPINE: Poller[0] Host[8] DS[127] SNMP: v2: 172.16.67.7, dsname: mem_cache, oid: .1.3.6.1.4.1.2021.4.15.0, value: U
11/11/2011 07:39:06 PM - SPINE: Poller[0] Host[8] DS[128] SNMP: v2: 172.16.67.7, dsname: mem_free, oid: .1.3.6.1.4.1.2021.4.6.0, value: 66567384
11/11/2011 07:39:06 PM - SPINE: Poller[0] Host[8] DS[277] SNMP: v2: 172.16.67.7, dsname: cpu_nice, oid: .1.3.6.1.4.1.2021.11.11.0, value: 100
11/11/2011 07:39:06 PM - SPINE: Poller[0] Host[8] DS[278] SNMP: v2: 172.16.67.7, dsname: cpu_system, oid: .1.3.6.1.4.1.2021.11.10.0, value: 0
11/11/2011 07:39:06 PM - SPINE: Poller[0] Host[8] DS[279] SNMP: v2: 172.16.67.7, dsname: cpu_user, oid: .1.3.6.1.4.1.2021.11.9.0, value: 0
11/11/2011 07:39:06 PM - SPINE: Poller[0] Host[7] DS[183] SCRIPT: /usr/java/jdk1.6.0_22/bin/java -jar /var/www/html/scripts/moniter_fat.jar db 172.16.67.6:1521:orasjzfa wi wi connectMaxTotal , output: value:3000.0
11/11/2011 07:39:06 PM - SPINE: Poller[0] Host[7] DS[184] SCRIPT: /usr/java/jdk1.6.0_22/bin/java -jar /var/www/html/scripts/moniter_fat.jar db 172.16.67.6:1521:orasjzfa wi wi connectTotal , output: value:27.0
11/11/2011 07:39:07 PM - SPINE: Poller[0] Host[7] DS[185] SCRIPT: /usr/java/jdk1.6.0_22/bin/java -jar /var/www/html/scripts/moniter_fat.jar db 172.16.67.6:1521:orasjzfa wi wi hitradio , output: value:86.91
11/11/2011 07:39:07 PM - SPINE: Poller[0] Host[7] DS[286] SCRIPT: /usr/java/jdk1.6.0_22/bin/java -jar /var/www/html/scripts/moniter_fat.jar db tablespace , output: U
11/11/2011 07:39:07 PM - SPINE: Poller[0] Host[7] DS[115] SS[5] SERVER: /var/www/html/scripts/ss_host_disk.php ss_host_disk 172.16.67.5 2:161:1000:public:::MD5::DES: 7 get percent 9, output: 0
11/11/2011 07:39:07 PM - SPINE: Poller[0] Host[7] DS[107] SNMP: v2: 172.16.67.5, dsname: cpu_nice, oid: .1.3.6.1.4.1.2021.11.51.0, value: U
11/11/2011 07:39:07 PM - SPINE: Poller[0] Host[7] DS[108] SNMP: v2: 172.16.67.5, dsname: cpu_system, oid: .1.3.6.1.4.1.2021.11.52.0, value: 5555566
11/11/2011 07:39:07 PM - SPINE: Poller[0] Host[7] DS[109] SNMP: v2: 172.16.67.5, dsname: cpu_user, oid: .1.3.6.1.4.1.2021.11.50.0, value: 10550825
11/11/2011 07:39:07 PM - SPINE: Poller[0] Host[7] DS[110] SNMP: v2: 172.16.67.5, dsname: mem_buffers, oid: .1.3.6.1.4.1.2021.4.14.0, value: U
11/11/2011 07:39:07 PM - SPINE: Poller[0] Host[7] DS[111] SNMP: v2: 172.16.67.5, dsname: mem_cache, oid: .1.3.6.1.4.1.2021.4.15.0, value: U
11/11/2011 07:39:07 PM - SPINE: Poller[0] Host[7] DS[112] SNMP: v2: 172.16.67.5, dsname: mem_free, oid: .1.3.6.1.4.1.2021.4.6.0, value: 64356768
11/11/2011 07:39:07 PM - SPINE: Poller[0] Host[7] DS[274] SNMP: v2: 172.16.67.5, dsname: cpu_nice, oid: .1.3.6.1.4.1.2021.11.11.0, value: 99
11/11/2011 07:39:07 PM - SPINE: Poller[0] Host[7] DS[275] SNMP: v2: 172.16.67.5, dsname: cpu_system, oid: .1.3.6.1.4.1.2021.11.10.0, value: 0
11/11/2011 07:39:07 PM - SPINE: Poller[0] Host[7] DS[276] SNMP: v2: 172.16.67.5, dsname: cpu_user, oid: .1.3.6.1.4.1.2021.11.9.0, value: 1
11/11/2011 07:39:07 PM - SYSTEM STATS: Time:6.4572 Method:spine Processes:3 Threads:10 Hosts:10 HostsPerProcess:4 DataSources:258 RRDsProcessed:89
11/11/2011 07:39:07 PM - THOLD: Poller[0] 宕机检测
11/11/2011 07:39:07 PM - SPINE: Poller[0] Time: 6.2242 s, Threads: 10, Hosts: 5
无意中,把 21 上的 crontab 内容拷贝下来,和 17 上的进行对比,发现了原因:
21
*/5 * * * * php /var/www/html/poller.php > /dev/null 2>&1
17
*/3 * * * * /home/php/bin/php /home/apache5/htdocs/cacti/poller.php
是 /home/apache5/htdocs/cacti/poller.php 路径设置错了,
应该是:/var/www/html/poller.php
修改成: */5 * * * * /home/php/bin/php /var/www/html/poller.php > /dev/null 2>&1
果然 17 上可以创建新的 rrd 文件了,图形都出来了。
所有的 used space 图形都出来了
新增加的 设置 67。24 也开始画图了
21 还是没有图形出来,看来没有办法画 21 就是因为也安装了 cacti 的原因,互相 down 机
只能周一移植到另一台机器上去 了。