显示石墨无效线 [英] show graphite invalid lines

查看:106
本文介绍了显示石墨无效线的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在石墨日志中看到很多这样的行:

I see lots of lines like this in my graphite logs:

01/10/2014 21:07:12 :: [listener] invalid line received from client HOST:PORT, ignoring

如果我能看到无效的行,那将有很大的帮助.一些文档和教程建议石墨将在无效警告之后直接打印违规行,但对我而言,不会.如何启用此属性?

It would greatly help if I could see the invalid line. Some documentation and tutorials suggest graphite would print the offending line directly after the invalid warning, but for me it doesn't. How can I enable this property?

谢谢.

推荐答案

因此,我尝试解决此问题的方法是完全破解,但它对我有用.

So my attempt to troubleshoot this was a total hack but it worked for me.

  • 编辑protocol.py(第75行上的/opt/graphite/lib/carbon/protocols.py,并添加一条额外的日志行
  • Edit protocol.py (/opt/graphite/lib/carbon/protocols.py on line 75 and add an additional log line
 class MetricLineReceiver(MetricReceiver, LineOnlyReceiver):
    delimiter = '\n'

  def lineReceived(self, line):
    try:
      metric, value, timestamp = line.strip().split()
      datapoint = (float(timestamp), float(value))
    except:
      log.listener('invalid line received from client %s, ignoring' % self.peerName )
      return

    self.metricReceived(metric, datapoint)

后:

 class MetricLineReceiver(MetricReceiver, LineOnlyReceiver):
    delimiter = '\n'

  def lineReceived(self, line):
    try:
      metric, value, timestamp = line.strip().split()
      datapoint = (float(timestamp), float(value))
    except:
      log.listener('invalid line received from client %s, ignoring' % self.peerName )
      log.listener('invalid line - [ %s ]' % line)
      return

    self.metricReceived(metric, datapoint)

  • 以调试模式重新启动守护程序

    • restart daemon in debug mode

      /usr/bin/python /opt/graphite/bin/carbon-cache.py --pid /opt/graphite/storage/carbon-cache-a.pid --debug start

      通过执行此操作,我可以准确地看到导致我感到悲伤的指标并加以解决.

      By doing this I was able to see exactly which metric was causing me grief and address it.

      希望有帮助!

      这篇关于显示石墨无效线的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆