格拉法纳(Grafana):包含最后结果的时间的面板 [英] Grafana: Panel with time of last result

查看:387
本文介绍了格拉法纳(Grafana):包含最后结果的时间的面板的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个Elasticsearch实例,该实例从多个备份例程接收日志.我想从Grafana的ES中查询这些日志,并设置一个面板来显示上次进行不同备份的时间.理想情况下,如果时间长于某个阈值,我也希望能够以彩色显示.

I have an elasticsearch instance that receives logs from multiple backup routines. I'd like to query ES for these logs from Grafana and set up a panel that shows the last time for the different backups. Ideally I would also like to be able to show this in color if the time is longer than a certain threshold.

基本上,这个想法是要有一个显示,例如,如果某个备份在最近24小时内已完成,则显示为绿色,否则显示为红色.

Basically the idea is to have a display that shows, for instance, green if a certain backup has been completed in the last 24 hours, and red if it hasn't.

我将如何在Grafana中以ES作为数据源?

How would I do this in Grafana with ES as the datasource?

推荐答案

确切的实现取决于所使用的面板.

Exact implementation depends on the used panel.

singlestat的示例:编写ES查询,然后选择Stat:Time of last point,您可能需要选择合适的单位/格式:

Example for singlestat: write ES query and then select Stat: Time of last point, you may need to select suitable unit/format:

很遗憾,Grafana无法理解您所请求的时间格式(超过24小时)的阈值.您需要将其作为指标返回(例如,上次备份的时间(以秒为单位))=您需要为此编写查询.这意味着您将需要显示2个统计信息(上次时间+年龄),因此您将无法使用singlestat.表格面板可能会更好-您可以根据此处的年龄指标使用阈值设置.

Unfortunately, Grafana doesn't understand thresholds in your requested time format (older than 24 hours). You will need to return it as metric (for example as age of last backup in seconds) = you will need to write query for that. That means, that you will have 2 stats to show (last time + age), so you won't be able to use singlestat. Probably table panel will be better - you can use thresholding based on the age metric there.

这篇关于格拉法纳(Grafana):包含最后结果的时间的面板的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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