Calculating request per second using InfluxDB on Grafana

孤街浪徒 提交于 2019-12-07 08:45:46

问题


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

This is my query

raw sql:

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

This is my data

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

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


回答1:


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)


来源:https://stackoverflow.com/questions/37631018/calculating-request-per-second-using-influxdb-on-grafana

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!