显示石墨无效线

sea*_*mcl 2 logging graphite

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

01/10/2014 21:07:12 :: [listener] invalid line received from client HOST:PORT, ignoring
Run Code Online (Sandbox Code Playgroud)

如果我能看到无效的行,那将会非常有用.一些文档和教程建议石墨会在无效警告后直接打印违规行,但对我来说却没有.我该如何启用此属性?

谢谢.

小智 6

因此,我对此进行故障排除的尝试完全是黑客攻击,但它对我有用.

脚步

  • 编辑protocol.py(/opt/graphite/lib/carbon/protocols.py在第75行并添加一个额外的日志行
之前:
 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)
Run Code Online (Sandbox Code Playgroud) 后:
 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)
Run Code Online (Sandbox Code Playgroud)
  • 在调试模式下重启守护进程

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

  • 找到问题指标并修复
  • 恢复变为 protocol.py
  • 重启carbon-cache作为守护进程

通过这样做,我能够确切地看到哪个指标导致我悲伤并解决它.

希望有所帮助!