gpt4 book ai didi

logging - 显示 Graphite 无效线

转载 作者:行者123 更新时间:2023-12-02 08:31:39 25 4
gpt4 key购买 nike

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

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

如果我能看到无效行,那将大有帮助。一些文档和教程建议 Graphite 会在无效警告后直接打印违规行,但对我来说它不会。如何启用此属性?

谢谢。

最佳答案

所以我尝试解决这个问题是一个彻底的黑客攻击,但它对我有用。

步骤

  • 编辑 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)
后:
 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)
  • 在 Debug模式下重启守护进程

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

  • 找到问题指标并修复
  • 还原对 protocol.py 的更改
  • 作为守护进程重启 carbon-cache

通过这样做,我能够准确地看到是哪个指标让我感到悲伤并加以解决。

希望对您有所帮助!

关于logging - 显示 Graphite 无效线,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26149849/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com