如何在Grafana中创建SLA图表? [英] How can I create an SLA chart in Grafana?

查看:322
本文介绍了如何在Grafana中创建SLA图表?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个seriesMetric和一个constantLine(目标/SLA).我希望能够计数"该行下方的出现次数,然后除以总数即可在SLA中获得%.我知道如何使用asPercent做第二部分,但是我不知道如何计算Grafana中该行以下的出现次数.没有countif功能.我尝试了currentBelowaverageBelow,但是图表上什么都没出现(两行消失了).我认为我做错了.

I have a seriesMetric, and a constantLine (the goal/SLA). I want to be able to "count" the occurances below the line, and divide by the total to get a % within SLA. I know how to do the 2nd part, using asPercent, but I can't figure out how to count the occurrences below the line in Grafana. There's no countif function. I tried currentBelow and averageBelow, but then nothing appeared on my chart (the two lines disappeared). I assume I did something wrong.

我认为这是一个非常常见的用例,我认为有人这样做了.理想情况下,百分比应放在图表旁边的singleStat面板中.

I think this is a pretty common use case, and I assume someone has done this. Ideally the % would go in a singleStat panel next to the chart.

(我们将Gafana与Graphite一起使用.)

(We use Gafana with Graphite.)

示例SLA图表

推荐答案

在一位同事的帮助下,我们终于解决了这个问题.这是对我们有用的东西:

We finally figured this out, thanks to a coworker. Here's what worked for us:

"A", "target": "averageSeries(stats.timers.rails.production-aws.rack.*.util.mean)"

这是主要指标.

"B", "target": "removeAboveValue(#A,25)"

这将删除SLA之外的值.我们的SLA利用率应为<25%.

This removes the values that are out of SLA. Our SLA is utilization should be <25%.

"C", "target": "alias(transformNull(asPercent(#B), 0), '% within SLA')"

asPercent将序列自己除以创建1(和Null).

asPercent divides the series by itself which creates 1's (and Nulls).

transformNull关闭removeAboveValue函数,将Null替换为0.

transformNull operates off the removeAboveValue function replacing Nulls with 0s.

最后,在轴&网格>图例>单击平均并显示2个小数.这样做将为您查看的任何时间范围提供平均的SLA达到水平.

Finally, under Axis & Grid > Legend > Click Average and Show 2 Decimals. Doing this will provide an average SLA attainment for whatever timeframe you're viewing.

这是结果. SLA图表

这篇关于如何在Grafana中创建SLA图表?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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