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?
Use Grafana or Grafana Cloud to visualize data from your InfluxDB Cloud instance.
To access data source settings, hover your mouse over the Configuration (gear) icon, then click Data sources, and then click the data source. InfluxDB data source options differ depending on which query language you select: InfluxQL or Flux.
InfluxDB v2. 5 is the latest stable version. Flux is an alternative to InfluxQL and other SQL-like query languages for querying and analyzing data. Flux uses functional language patterns making it incredibly powerful, flexible, and able to overcome many of the limitations of InfluxQL.
To perform an InfluxQL query, send a GET request to the /query endpoint, set the URL parameter db as the target database, and set the URL parameter q as your query. You can also use a POST request by sending the same parameters either as URL parameters or as part of the body with application/x-www-form-urlencoded .
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)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With