配置cacti,遇见了各种问题。最后通过网上查找资料,克服了各种困难。
错误一:配置完snmp.conf后用snmpwalk测试出现
- $ snmpwalk -v 1 -c public 127.0.0.1
Timeout: No Response from 127.0.0.1
我是按照网上的教程来测试的,以为snmp没有配置好。
- com2sec workpc 192.168.1.18 zd=8866
- com2sec workpc 127.0.0.1 zd=8866
- group servergroup v2c workpc
- group servergroup v1 workpc
- access servergroup "" any noauth prefix all none none
- view all included .1
- #sudo php5 /cacti安装路径/poller.php --force
- */1 * * * * root php5 /usr/share/nginx/www/cacti/poller.php > /dev/null 2>/var/log/cacti/poller-error.log
+------+-------+-----------+-------+---------+------+-------+------------------+
| Id | User | Host | db | Command | Time | State | Info |
+------+-------+-----------+-------+---------+------+-------+------------------+
| 107 | cacti | localhost | cacti | Sleep | 63 | | NULL |
| 113 | cacti | localhost | cacti | Sleep | 63 | | NULL |
| 114 | cacti | localhost | cacti | Sleep | 63 | | NULL |
| 2098 | cacti | localhost | cacti | Sleep | 63 | | NULL |
| 2365 | cacti | localhost | cacti | Sleep | 65 | | NULL |
| 2368 | cacti | localhost | cacti | Sleep | 63 | | NULL |
| 2369 | cacti | localhost | cacti | Sleep | 63 | | NULL |
| 2370 | cacti | localhost | cacti | Sleep | 63 | | NULL |
| 2371 | cacti | localhost | cacti | Sleep | 63 | | NULL |
| 2374 | cacti | localhost | cacti | Sleep | 63 | | NULL |
| 3509 | cacti | localhost | NULL | Query | 0 | NULL | show processlist |
+------+-------+-----------+-------+---------+------+-------+------------------+
11 rows in set (0.00 sec)
(2) show variables like "wait_timeout";
+---------------+-------+
| Variable_name | Value |
+---------------+-------+
| wait_timeout | 28800 |
(3)修改my.conf文件 /etc/mysql/my.conf
wait_timeout=30
interactive_timeout=30
增加上面两句
(4) show variables like "wait_timeout";
+---------------+-------+
| Variable_name | Value |
+---------------+-------+
| wait_timeout | 30 |
总结:没有效果,还是会断断续续
(3)cacti和spine版本不一致 (换了之后我的问题就解决了)
我的cacti版本是0.8.7e spine版本是0.8.8a 所以把sprine换成0.8.7e
装sprine碰到的问题也是很多啊。
错误一: configure: error: cannot run /bin/bash config/config.sub
这是链接问题。
#ls -al config/* 查看链接路径
#find / -name config.sub 或者locate config.sub 查找config.sub的路径
- #ln -s -f /正确路径/config.sub config.sub
例如我的#ln -s -f /usr/share/libtool/config/config.sub config.sub
同样的道理:config.guess路径不对也这样改过来。
(2)spine configure: error: MySQL libraries not found
这个我是这么修改的:
- # find / -name libmysqlclient_r.*
得到文件所在目录是/usr/lib/i386-linux-gnu/
#vi configure
查找 libmysqlclient_r.*在哪一行,把那个路径改过来。原文件如下
- str="$i/lib64/libmysqlclient_r.*"
- 改后 str="$i/lib/i386-linux-gnu/libmysqlclient_r.*"
这样编译就通过了。
改完图像也就没有断断续续了。。^_^
错误四:
08/05/2012 10:51:01 AM - SPINE: Poller[0] ERROR: SQL Failed! Error:'1062', Message:'Duplicate entry '3-mem_buffers-2012-08-05 10:51:01' for key 'PRIMARY'', SQL Fragment:'INSERT INTO poller_output (local_data_id, rrd_name, time, output) VALUES (3,'mem_buffers','2012-08-05 10:51:01','1111288'),(4,'mem_swap','2012-08-05 10:51:01','2085472'),(5,'','2012-08-05 10:51:01','1min:0.15 5min:0.07 10min:0.09'),(6,'users','2012-08-05 10:51:01','2'),(7,'proc','2012-08-05 10:51:01','108'),(35,'loadavg_1','2012-08-05 10:51:01','0.15'),(36,'loadavg_15','2012-08-05 10:51:01','0.09'),(37,'loadavg_5','2012-08-05 10:51:01','0.07'),(38,'','2012-08-05 10:51:01','Qcache_free_blocks:82 Qcache_free_memory:15105288 Qcache_hits:201711 Qcache_inserts:78896 Qcache_lowmem_prunes:0 Qcache_not_cached:1956 Qcache_queries_in_cache:1363 Qcache_total_blocks:2850'),(39,'','2012-08-05 10:51:01','Com_select:80853 Select_full_join:104 Select_full_range_join:0 Select_range:1013 Select_range_check:0 Select_scan:6753'),(40,'','2012-08-05 10:51:01','Handler_commit:101414 Handler_delete:8684 Handler_discover:0 Handler_rollback:48 Handler_update:10725 Handler_write:274068')'
这个是cacti的日志出现的,大致意思就是重复插入数据,主键约束原因报错,看到错误后进入数据库查看,差点把日期的约束取消。还好及时悔改,怕改了有外键什么的怎么办。
然后想到重复插如可能是轮询的错。
- #vi /etc/crontab
- 有这么句话: */1 * * * * root php5 /usr/share/nginx/www/cacti/poller.php > /dev/null 2>/var/log/cacti/poller-error.log
然后
- cd /etc/cron.d/
- #vi cacti
- MAILTO=root
- */1 * * * * www-data php /usr/share/cacti/site/poller.php >/dev/null 2>/var/log/cacti/poller-error.log
- ###*/1 * * * * www-data php /usr/share/cacti/site/poller.php >/dev/null 2>/var/log/cacti/poller-error.log
错误五:cacti日志
POLLER: Poller[0] WARNING: Poller Output Table not Empty. Issues Found: 15
解决办法:重建缓存,我的这个方法好像有点笨。
有些问题没有记录下来,解决后也就忘了。如果有时间在把自己安装的过程和添加插件的过程记录一遍吧。以后用的话有文档加上自己实践过也容易点。
安装的时候多看官方的说明。我为此走了不少弯路啊。。