【问题标题】:Graphite Derivative shows no data石墨衍生物没有数据
【发布时间】:2016-09-16 21:26:58
【问题描述】:

使用石墨/Grafana 记录一个 mongodb 实例中所有集合的大小。为此,我编写了一个简单的(WIP)python 脚本:

#!/usr/bin/python

from pymongo import MongoClient
import socket
import time

statsd_ip = '127.0.0.1'
statsd_port = 8125

# create a udp socket 
sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)

client = MongoClient(host='12.34.56.78', port=12345)
db = client.my_DB

# get collection list each runtime
collections = db.collection_names()

sizes = {}

# main
while (1):
    # get collection size per name
    for collection in collections:
        sizes[collection] = db.command('collstats', collection)['size']

    # write to statsd
    for size in sizes:
        MESSAGE = "collection_%s:%d|c" % (size, sizes[size])
        sock.sendto(MESSAGE, (statsd_ip, statsd_port))

    time.sleep(60)

这可以正确显示我在 grafana 中的所有集合大小。但是,我想了解这些大小的变化率,因此我在 grafana 中构建了以下石墨查询:

derivative(statsd.myHost.collection_myCollection)

而且图表显示完全空白。有什么想法吗?

跟进:选择大于24小时的时间范围时,所有数据都类似地从图中消失。我这辈子都想不通。

【问题讨论】:

  • 我需要查看数据或显示它的图表,以便更好地理解为什么 derivative() 函数可能对您失败。另外,请发布您的storage-schemas.conf
  • 以下是部分数据截图:imgur album。无论出于何种原因,图像的顺序都搞砸了,但信息就在那里。
  • 更新:我认为这个问题源于石墨。使用石墨 Web 界面绘制图形会产生与 grafana 中相同的结果 - 导数显示一个空图,包括大于过去 24 小时的范围显示一个空图。我在 irc.freenode.net 上咨询了#graphite,他们似乎认为这可能是一个聚合问题。我的 storage-aggregation.conf 是一个空文件。

标签: graphite grafana


【解决方案1】:

更新:这是因为我的 collectd 被配置为每秒发送一次样本。然而,collectd 的 statsd 插件每 60 秒接收一次数据,所以对于大多数数据点,我最终得到了None

我通过检查 Graphite 中的原始数据发现了这一点,方法是在浏览器中将 &format=raw 附加到 Graphite-api 查询的末尾,它以逗号分隔列表的形式为您提供每个数据点的值。

对此的临时修复是用keepLastValue(60) 包围石墨查询。然而,这会创建一个阶梯图,因为每个“无”(60 个值)的值成为 60 个阶梯内的最后一个有效值。将其导数绘制成宽间距锯齿图。

为了解决这个问题,我可能会继续修复 collectd 上的刷新间隔或切换到独立的 statsd 实例并从那里进行必要的配置。

【讨论】:

  • 我在收集超时值时遇到了类似的情况。用keepLastValue(60) 包围石墨查询是什么意思。你能举出确切的例子吗?例如。我有这个查询 - http://<domain>/render?width=1700&from=-2h&until=now&height=900&target=aerospike.old_statsip-10-146-210-31.service.stat_rw_timeout&title=old_latency_cumulative_not_raw 显示每 30 秒收集的超时累计总和。
  • 你在应用keepLastValue(60)之后应用导数()吗?
  • 请参阅此处perehospital.cat/blog/… 以获得很好的解释
猜你喜欢
  • 2012-07-13
  • 2020-09-05
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2014-12-18
  • 2016-02-17
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多