如何显示"33分钟前"在带有InfluxDB的Grafana仪表板上? [英] How to show "33 minutes ago" on Grafana dashboard with InfluxDB?

查看:75
本文介绍了如何显示"33分钟前"在带有InfluxDB的Grafana仪表板上?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我最近用InfluxDB设置了Grafana.我想展示一个面板,指示发生事件以来已经有多长时间了.

I have recently set up Grafana with InfluxDB. I'd like to show a panel that indicates how long it has been since an event took place.

示例:

  • 服务器上次报告时间:33分钟前
  • 最后一个用户注册:17分钟前

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

I can get a single metric pretty easily with the following code:

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

但是我似乎无法让Grafana在时间字段上做我想做的事情.

But I can't seem to get Grafana to do what I want with the time field.

有什么建议吗?

推荐答案

自Grafana(4.6.0)起,现在可以使用singlestat面板了.

Since Grafana(4.6.0) this is now possible with singlestat panels.

  1. 转到Options -Tab
  2. 选择Value-> Stat-> Time of last point
  3. 选择Value-> Stat-> Unit-> Date & time-> From Now
  1. GoTo the Options-Tab
  2. Select Value -> Stat -> Time of last point
  3. Select Value -> Stat -> Unit -> Date & time -> From Now

这篇关于如何显示"33分钟前"在带有InfluxDB的Grafana仪表板上?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆