使用Prometheus和grafana跟踪事件 [英] Tracking events with prometheus and grafana

查看:80
本文介绍了使用Prometheus和grafana跟踪事件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有一篇文章

然后注释将显示在仪表板的面板上:

There's an article "Tracking Every Release" which tells about displaying a vertical line on graphs for every code deployment. They are using Graphite. I would like to do something similar with Prometheus 2.2 and Grafana 5.1. More specifically I want to get an "application start" event displayed on a graph.

Grafana annotations seem to be the appropriate mechanism for this but I can't figure out what type of prometheus metric to use and how to query it.

解决方案

The simplest way to do this is via the same basic approach as in the article, by having your deployment tool tell Grafana when it performs a deployment.

Grafan has a built-in system for storing annotations, which are displayed on graphs as vertical lines and can have text associated with them. It would be as simple as creating an API key in your Grafana instance and adding a curl call to your deploy script:

curl -H "Authorization: Bearer <apikey>" http://grafana:3000/api/annotations -H "Content-Type: application/json" -d '{"text":"version 1.2.3 deployed","tags":["deploy","production"]}'

For more info on the available options check the documentation:

http://docs.grafana.org/http_api/annotations/

Once you have your deployments being added as annotations, you can display those on your dashboard by going to the annotations tab in the dashboard settings and adding a new annotation source:

Then the annotations will be shown on the panels in your dashboard:

这篇关于使用Prometheus和grafana跟踪事件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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