在 Grafana 上使用 InfluxDB 计算每秒请求数
Calculating request per second using InfluxDB on Grafana
我使用telegraf插件nginx读取Nginx的基本状态信息(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,我的查询有什么问题?
假设您正在处理一个计数器,您需要的查询是
SELECT derivative(max(requests))
FROM "nginx"
WHERE $timeFilter
GROUP BY time($interval)
我使用telegraf插件nginx读取Nginx的基本状态信息(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,我的查询有什么问题?
假设您正在处理一个计数器,您需要的查询是
SELECT derivative(max(requests))
FROM "nginx"
WHERE $timeFilter
GROUP BY time($interval)