cacti有数据无图无rra文件

说明:
cacti跑了一段时间,突然发现cacti图像都是nan,但snmpwalk -c public -v 2c 127.0.0.1 system数据是有的,这说明snmp是运行正常的。新建graph时./cacti/rra/下面没有生成.rrd文件。rra目录及目录下文件权限已经改为777,还是一样。在Graph Management开启debug模式说.rrd’: No such file or directory,手动执行/usr/local/php/bin/php /home/www/data/cacti/poller.php提示error while loading shared libraries: libmysqlclient.so.15: cannot open shared object file: No such file or directory。


排查:
1.因为snmpwalk有拿到数据,说明snmp没有问题。

# snmpwalk -c public -v 2c 127.0.0.1 system //有数据,说明没问题

 
2.新建个graph,分别在Graph Management,Data Source开启debug模式测试

Console | Graph Management |Turn On Graph Debug Mode
RRDTool Says:
ERROR: opening '/home/www/data/cacti/rra/localhost_hdd_free_70.rrd': No such file or directory

Console | Data Source | Turn On Data Source Debug Mode
Data Source Debug
/usr/local/bin/rrdtool create 
/home/www/data/cacti/rra/localhost_load_1min_80.rrd 
--step 300  
DS:load_1min:GAUGE:600:0:500 
DS:load_5min:GAUGE:600:0:500 
DS:load_15min:GAUGE:600:0:500 
RRA:AVERAGE:0.5:1:500 
RRA:AVERAGE:0.5:1:600 
RRA:AVERAGE:0.5:6:700 
RRA:AVERAGE:0.5:24:775 
RRA:AVERAGE:0.5:288:797 
RRA:MAX:0.5:1:500 
RRA:MAX:0.5:1:600 
RRA:MAX:0.5:6:700 
RRA:MAX:0.5:24:775 
RRA:MAX:0.5:288:797 

 
3.怀疑是spine的mysql密码更改

# /usr/local/mysql/bin/mysql -ucacti -p  //能登陆说明用户,密码正确
# vim /usr/local/cacti-spine/etc/spine.conf  //用户,密码也正确

 
4.手动执行/usr/local/php/bin/php /home/www/data/cacti/poller.php

# /usr/local/php/bin/php /home/www/data/cacti/poller.php  //提示
error while loading shared libraries: libmysqlclient.so.15: cannot open shared object file: No such file or directory

# ldd /usr/local/cacti-spine/bin/spine  //可以看到libmysqlclient_r.so.15 => not found
        linux-vdso.so.1 =>  (0x00007fff29be6000)
        libnetsnmp.so.25 => /usr/local/net-snmp/lib/libnetsnmp.so.25 (0x00002b252025d000)
        libmysqlclient_r.so.15 => not found
        libcrypto.so.6 => /lib64/libcrypto.so.6 (0x0000003956800000)
        libz.so.1 => /lib64/libz.so.1 (0x0000003369600000)
        libpthread.so.0 => /lib64/libpthread.so.0 (0x0000003369e00000)
        libm.so.6 => /lib64/libm.so.6 (0x0000003369200000)
        libc.so.6 => /lib64/libc.so.6 (0x0000003368e00000)
        libdl.so.2 => /lib64/libdl.so.2 (0x0000003369a00000)
        /lib64/ld-linux-x86-64.so.2 (0x0000003368a00000)

 
5.才想起原来系统有2个mysql,一个自己编译mysql 5.1.38,一个是系统自带(版本更低)。当初编译安装spine时,–prefix=/usr/local/cacti-spine –with-snmp=/usr/local/net-snmp/没有指定mysql。spine编译时使用原系统自带的mysql的libraries库。而后来我把系统自带的mysql删掉。导致snmp能拿到数据,spine却没有办法写入mysql库,rrd没办法拿到数据绘图,/cacti/rra/目录下当然就没有文件。。

解决:
重新编译spine

# wget http://www.cacti.net/downloads/spine/cacti-spine-0.8.8a.tar.gz
# tar zxvf cacti-spine-0.8.8a.tar.gz
# cd cacti-spine-0.8.8a
# ./configure --prefix=/usr/local/cacti-spine --with-snmp=/usr/local/net-snmp/
# make && make install

 

# ldd /usr/local/cacti-spine/bin/spine  //可以看到libmysqlclient_r.so.16 => /usr/local/....
        linux-vdso.so.1 =>  (0x00007fffdf5fd000)
        libnetsnmp.so.25 => /usr/local/net-snmp/lib/libnetsnmp.so.25 (0x00002ab1399f5000)
        libmysqlclient_r.so.16 => /usr/local/mysql/lib/mysql/libmysqlclient_r.so.16 (0x00002ab139cca000)
        libcrypt.so.1 => /lib64/libcrypt.so.1 (0x000000337b400000)
        libnsl.so.1 => /lib64/libnsl.so.1 (0x0000003371400000)
        libcrypto.so.6 => /lib64/libcrypto.so.6 (0x0000003956800000)
        libz.so.1 => /lib64/libz.so.1 (0x0000003369600000)
        libpthread.so.0 => /lib64/libpthread.so.0 (0x0000003369e00000)
        libm.so.6 => /lib64/libm.so.6 (0x0000003369200000)
        libc.so.6 => /lib64/libc.so.6 (0x0000003368e00000)
        libdl.so.2 => /lib64/libdl.so.2 (0x0000003369a00000)
        /lib64/ld-linux-x86-64.so.2 (0x0000003368a00000)

等一下就可以看到cacti又有数据了。

发表评论

邮箱地址不会被公开。 必填项已用*标注