首页 文章

如何使用InfluxDB在Grafana仪表板上显示“33分钟前”?

提问于
浏览
4

我最近用InfluxDB Build 了Grafana . 我想展示一个小组,显示自事件发生以来已经过了多长时间 .

例子:

  • 服务器最后报道时间:33分钟前

  • 上次用户注册:17分钟前

我可以使用以下代码轻松获得单个指标:

SELECT time, last("duration") as last_duration FROM custom_events ORDER BY time DESC

但我似乎无法让格拉法纳在时间领域做我想做的事 .

有什么建议?

2 回答

  • 2

    从Grafana(4.6.0)开始,现在可以使用singlestat面板 .

    • 转到 Options -Tab

    • 选择 Value - > Stat - > Time of last point

    • 选择 Value - > Stat - > Unit - > Date & time - > From Now

    enter image description here

  • 1

    它目前(4.0.3)无法显示singlestat面板中的最后一个时间戳 . 但是有一个issue支持这个 . 希望我们将来有时间实现这一点 .

相关问题