Grafana: Panel with time of last result

杀马特。学长 韩版系。学妹 提交于 2020-06-01 05:51:07

问题


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.

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.

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


回答1:


Exact implementation depends on the used panel.

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

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.




回答2:


In addition to the great answer by Jan Garaj, it looks like there is work being done to make this type of thing much easier in the future.

Check out this issue to check progress.



来源:https://stackoverflow.com/questions/53601321/grafana-panel-with-time-of-last-result

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!