show graphite invalid lines

爷,独闯天下 提交于 2019-12-11 01:52:33

问题


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?

Thanks.


回答1:


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

Steps

  • Edit protocol.py (/opt/graphite/lib/carbon/protocols.py on line 75 and add an additional log line
Before:
 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)
After:
 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

  • find problem metric and fix
  • revert change to protocol.py
  • restart carbon-cache as daemon

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

Hope that helps!



来源:https://stackoverflow.com/questions/26149849/show-graphite-invalid-lines

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!