Grafana:固定数量的状态历史框。

huangapple go评论58阅读模式
英文:

Grafana: Status History with fixed amount of boxes

问题

我正在尝试在 Grafana 9.4.3 中可视化一些节点的正常运行时间。假设我有 5 个节点,并且我想要查看这些节点在我的网络中的正常运行时间,比如过去的 6 小时。如果在某个时间间隔内某个节点在线,显示一个绿色框,如果它离线,显示一个红色框。一个数据源会提供关于节点在某个时间间隔内(例如下午 1 点到下午 2 点)是否可用的信息(这里我们简化为“是”或“否”的答案)。

我需要使用 "状态历史",据说每行显示 6 个框,总共有 5 行(每个节点一行)。

现在,在尝试构建面板时,我使用 Grafana 的测试数据来构建仪表板,然后将其与实际数据源链接起来。测试数据(场景:"Grafana Live",通道:"random-2s-stream")。我得到的是这些框,但随着生成更多数据,它们具有灵活的宽度:

Grafana:固定数量的状态历史框。

我想要的和需要的是显示一组固定的框 - 这些框具有固定的宽度和高度,始终如此。文档中有一个示例,显示了状态历史的情况:https://grafana.com/docs/grafana/v9.4/panels-visualizations/visualizations/status-history/

这是 "查询" 部分:

Grafana:固定数量的状态历史框。

有人能告诉我在哪里可以实现这一点吗?

英文:

I am trying to visualize the uptime of some nodes in Grafana 9.4.3. Let's say I have 5 nodes and I want to have the uptime of those nodes in my network over time, say the last 6 hours. If in a certain time interval a node was online, show a green box, if it was offline, show a red box. A data source would provide information about whether the nodes for a time interval (e.g. 1pm - 2 pm) was available (let's simplify it here to be a "yes" or "no" answer)

I need to use "Status History", where supposedly 6 boxes are displayed per row, and in total wed have 5 rows (one for each node).

Now, when trying to build the panel, I use test data from grafana to build the dashboard before linking it up with the actual data sources. Test data (Scenario: "Grafana Live", Channel: "random-2s-stream"). What I get is the boxes, but with a flexible width as more data is generated:

Grafana:固定数量的状态历史框。

What I want and need is that a fixed set of boxes is shown - and these boxes have a fixed width and height, always. An example is shown in the documentation for Status History: https://grafana.com/docs/grafana/v9.4/panels-visualizations/visualizations/status-history/

This is the "query":

Grafana:固定数量的状态历史框。

Anyone can point me where this can be achieved?

答案1

得分: 1

自动计算基于样本数和提供给面板的时间序列数目。修复宽度的最简单方式是在查询选项中指定“最大数据点”。

至于高度 - 据我所知,没有办法限制查询结果的数量。因此,您需要确保查询返回相同数量的时间序列。

英文:

Width and height of boxes calculated automatically based on number on samples and number of time series supplied to panel.

The easiest way to fix the width is to specify Max data points within Query options.
Grafana:固定数量的状态历史框。

As for height - afaik, there is now way to limit number of results of query. So you'll need to guarantee that your query returns same number of time series by yourself.

huangapple
  • 本文由 发表于 2023年5月10日 21:44:24
  • 转载请务必保留本文链接:https://go.coder-hub.com/76219192.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定