格拉法纳(Grafana):如何设定选定期间的持续时间 [英] Grafana: How to have the duration for a selected period
问题描述
我找不到用Grafana计算SLA(可用性)的正确数学公式: 我有一张图表显示每天的停机时间: 据此,我想计算SLA(例如:99.5%).
I can't find the correct mathematical formula to compute a SLA (availability) with Grafana: I have graph to show the duration of downtime for each days: From this, i would like to compute the SLA (eg: 99,5%).
在所选期间(过去7天)的图表上,我可以获取以下数据:
On the graph for the selected period (Last 7 days) i can to have this data:
- 71258是停机时间的总和,以秒为单位.我有summary(1day,max,false)
- 我需要具有所选时间段的持续时间总和(此处7天= 604800秒).但是如何?
如果我有这最后的数据,我会做的:
If i have this last data, after i will do :
(100%* 604800)/71258 = X%
(100% * 604800) / 71258 = X %
100%-X%=我的SLA!
100% - X % = My SLA!!
我的问题是:哪个公式在Grafana中具有选定时间段的持续时间?
My question is: Which formula use to have the duration for a selected period in Grafana ?
推荐答案
One of the database you can run behind Grafana, is Axibase Time Series Database (ATSD). It provides built-in aggregation functions that can perform SLA-type calculations, for example, to compute % of the period when the value exceeded the threshold.
- THRESHOLD_COUNT-此期间的违规次数
- THRESHOLD_DURATION-违规的累计持续时间
- THRESHOLD_PERCENT-持续时间除以周期
在您的示例中,该值为THRESHOLD_PERCENT.
In your example, that would be THRESHOLD_PERCENT.
以下是针对Amazon Web Services实例的SLA报告样本: https://apps.axibase .com/chartlab/0aa34311/6/. THRESHOLD_PERCENT显示在顶部图表上.
Here's a sample SLA report for Amazon Web Services instance: https://apps.axibase.com/chartlab/0aa34311/6/. THRESHOLD_PERCENT is visualized on the top chart.
API请求如下:
{
"queries": [{
"startDate": "2016-02-22T00:00:00Z",
"endDate": "2016-02-23T00:00:00Z",
"timeFormat": "iso",
"entity": "nurswgvml007",
"metric": "app.response_time",
"aggregate": {
"types": [
"THRESHOLD_COUNT",
"THRESHOLD_DURATION",
"THRESHOLD_PERCENT"
],
"period": {
"count": 1,
"unit": "HOUR"
},
"threshold": {
"max": 200
}
}
}]
}
ATSD驱动程序: https://github.com/grafana/grafana-plugins/tree/master/datasources/atsd
ATSD driver: https://github.com/grafana/grafana-plugins/tree/master/datasources/atsd
披露:我为Axibase工作.
Disclosure: I work for Axibase.
这篇关于格拉法纳(Grafana):如何设定选定期间的持续时间的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!