在Grafana上使用InfluxDB每秒计算请求 [英] Calculating request per second using InfluxDB on Grafana

查看:359
本文介绍了在Grafana上使用InfluxDB每秒计算请求的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用telegraf插件nginx读取Nginx的基本状态信息(ngx_http_stub_status_module)

I use telegraf plugin nginx to read Nginx's basic status information (ngx_http_stub_status_module)

这是我的查询

原始sql:

SELECT derivative(mean("requests"), 1s) FROM "nginx" WHERE $timeFilter GROUP BY time($interval) fill(null)

这是我的数据

time            accepts active  handled host    port    reading requests    server      waitingwriting
1464921070000000000 7   1   7   hysm    80  0   17      localhost   0   1
1464921080000000000 8   1   8   hysm    80  0   19      localhost   0   1
1464921090000000000 8   1   8   hysm    80  0   20      localhost   0   1
1464921100000000000 8   1   8   hysm    80  0   21      localhost   0   1

但是requestPerSecond是0.083,我的查询出了什么问题?

but requestPerSecond is 0.083, what is wrong with my query?

推荐答案

假设您要处理一个计数器,那么您想要的查询就是

Assuming that you're dealing with a a counter, the query you're going to want is

SELECT derivative(max(requests))
FROM "nginx"
WHERE $timeFilter
GROUP BY time($interval)

这篇关于在Grafana上使用InfluxDB每秒计算请求的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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