gpt4 book ai didi

influxdb - 在 Grafana 上使用 InfluxDB 计算每秒请求数

转载 作者:行者123 更新时间:2023-12-02 21:49:13 27 4
gpt4 key购买 nike

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

这是我的查询

request per second query

原始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,我的查询有什么问题?

request per second graph

最佳答案

假设您正在处理一个计数器,您需要的查询是

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

关于influxdb - 在 Grafana 上使用 InfluxDB 计算每秒请求数,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37631018/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com