设为首页 收藏本站
查看: 1588|回复: 0

[经验分享] Cacti 中的 Debugging 技巧

[复制链接]

尚未签到

发表于 2019-1-10 09:58:53 | 显示全部楼层 |阅读模式
  前一阵研究了一大顿 Cacti,遇到了很多大大小小的问题,而这些问题基本都让我在 Cacti 的官方论坛里找到了答案,我觉得 Cacti 手册中的 Debugging 章节还是比较不错的。我的总结如下:
  1. Check Cacti Log File
  检查Log文件,这可是最常用的一步了,文件在 /log/cacti.log,Host 后面的数字可以在 Devices 里面点 SNMP Agent 之后在URL的最后看到,常见的 Log 错误如下:
  CACTID: Host[...] DS[....] WARNING: SNMP timeout detected [500 ms], ignoring host ‘……..’
  这个是说 SNMP 超时,可以更改 Settings->Poller 的时间来解决
  CACTID: Poller [...] Host[...] WARNING: Recache Event Detected for Host
  如果老出现的话,在 System Utilities->Rebuild Poller Cache 里面重建下 poller,或用 php rebuild_poller_cache.php 命令也一样
  CACTID: Poller [...] Host[...] WARNING: Result from SNMP not valid. Partial Result: No Such Object avail
  你的 SNMP Agent 不支持该类型的 OID 类型
  2. Check Basic Data Gathering
  这个好办,测试一下数据是否能够正常得到,SNMP Agent 代理是否工作正常,OID 是否能够或允许访问到,使用 SNMP 命令:
  $ snmpwalk -v 2c -c public target-host system
  如果 Cacti 使用脚本文件获取状态信息,则使用如下命令:
  $ su – cactiuser
  $ /full/path/to/perl your-perl-script.pl p1 p2
  3. Check cacti’s poller
  用 cmd.php 来检查具体的 SNMP Agent 是否正常:
  $ php -q cmd.php
  4. Check MySQL updating
  这个我没有用过。
  5. Check rrd file updating
  $ rrdtool update  –template …
  6. Check rrd file ownership
  这个简单,看各个 rrd 文件的访问权限是否设置正确。
  7. Check rrd file numbers
  用命令看看具体的 rrd 文件里面的数据是不是正常的,如果是NAN,返回上面具体检查。官方文档描述如下(我就不翻译了):
  $ rrdtool fetch  AVERAGE
  You’re perhaps wondering about this step, if the former was ok. But due to data sources MINIMUM and MAXIMUM definitions, it is possible, that valid updates for rrd files are suppressed, because MINIMUM was not reached or MAXIMUM was exceeded.
  Assuming, you’ve got some valid rrdtool update in step 3, perform a
  $ rrdtool fetch  AVERAGE
  and look at the last 10-20 lines. If you find NaN’s there, perform
  $ rrdtool info
  and check the ds[...].min and ds[...].max entries, e.g.
  ds[loss].min = 0.0000000000e+00
  ds[loss].max = 1.0000000000e+02
  In this example, MINIMUM = 0 and MAXIMUM = 100. For a ds.[...].type=GAUGE verify, that e.g. the number returned by the script does not exceed ds[...].MAX (same holds for MINIMUM, respectively).
  If you run into this, please do not only update the data source definition within the Data Template, but perform a
  $ rrdtool tune  –maximum :
  8. Check rrdtool graph statement
  打开 Graph Management 里面具体的 SNMP Agent,并且打开 Debug 功能,具体看 DEF 的状态,它们指向具体的 rrd 文件。
  9. Miscellaneous
  查看 MySQL 数据库里面记录的数据是否过大,如果过大可以在 php.ini 文件中的 Memory setting 选项更改,默认是8M。
  10. RPM Installation?
  看看 RPM 是否安装完整。
  11. Not NaN, but 0 (zero) values?
  这个问题我没遇到过,所以直接摘录原文:
  Pay attention to custom scripts. It is required, that external commands called from there are in the $PATH of the cactiuser running the poller. It is therefor recommended to provide /full/path/to/external/command
  User “criggie” reported an issue with running smartctl. It was complaining “you are not root” so a quick chmod +s on the script fixed that problem.
  Secondly, the script was taking several seconds to run. So cacti was logging a “U” for unparseable in the debug output, and was recording NAN. So my fix there was to make the script run faster, and the age of my box made it difficult to accomplish.
  The timeout setting is governed by “Settings → Poller → Script and Script Server Timeout Value”. In general, it is recommended to make scripts faster to avoid that the poller does not finish in time.
  12. Cacti 登录密码忘记的解决方法
  如果是 admin 的密码丢失,id = 1;其他用户以此类推:
  mysql> show databases;
  mysql> use cacti;
  mysql> show tables;

  mysql> update user_auth set password=md5(“newpassword”) where>
  新的 admin 用户密码就是 newpassword 了。


运维网声明 1、欢迎大家加入本站运维交流群:群②:261659950 群⑤:202807635 群⑦870801961 群⑧679858003
2、本站所有主题由该帖子作者发表,该帖子作者与运维网享有帖子相关版权
3、所有作品的著作权均归原作者享有,请您和我们一样尊重他人的著作权等合法权益。如果您对作品感到满意,请购买正版
4、禁止制作、复制、发布和传播具有反动、淫秽、色情、暴力、凶杀等内容的信息,一经发现立即删除。若您因此触犯法律,一切后果自负,我们对此不承担任何责任
5、所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其内容的准确性、可靠性、正当性、安全性、合法性等负责,亦不承担任何法律责任
6、所有作品仅供您个人学习、研究或欣赏,不得用于商业或者其他用途,否则,一切后果均由您自己承担,我们对此不承担任何法律责任
7、如涉及侵犯版权等问题,请您及时通知我们,我们将立即采取措施予以解决
8、联系人Email:admin@iyunv.com 网址:www.yunweiku.com

所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其承担任何法律责任,如涉及侵犯版权等问题,请您及时通知我们,我们将立即处理,联系人Email:kefu@iyunv.com,QQ:1061981298 本贴地址:https://www.yunweiku.com/thread-661510-1-1.html 上篇帖子: 在 Cacti 下实现监控 JBoss 服务器 下篇帖子: cacti snmp
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

扫码加入运维网微信交流群X

扫码加入运维网微信交流群

扫描二维码加入运维网微信交流群,最新一手资源尽在官方微信交流群!快快加入我们吧...

扫描微信二维码查看详情

客服E-mail:kefu@iyunv.com 客服QQ:1061981298


QQ群⑦:运维网交流群⑦ QQ群⑧:运维网交流群⑧ k8s群:运维网kubernetes交流群


提醒:禁止发布任何违反国家法律、法规的言论与图片等内容;本站内容均来自个人观点与网络等信息,非本站认同之观点.


本站大部分资源是网友从网上搜集分享而来,其版权均归原作者及其网站所有,我们尊重他人的合法权益,如有内容侵犯您的合法权益,请及时与我们联系进行核实删除!



合作伙伴: 青云cloud

快速回复 返回顶部 返回列表