Calculate 95th percentile bandwidth with influxdb

Hello

I’m using Telegraf SNMP to capture data into Influx,

and I have a SingleStat metric in grafana with this query:
SELECT non_negative_derivative(percentile(“ifHCOutOctets”, 95), 1s) *8 FROM “snmp” WHERE “hostname” =~ /^$Switch$/ AND “ifAlias” =~ /^$Alias$/ AND $timeFilter GROUP BY time($__interval) fill(none)

However percentile function does not seem to work? the value returned is not 95th percentile, infact i changed 95 to 50, and the number stays the same.

Any Ideas?

Thanks

Not sure either, you probably need a large group by time to get percentile to get many samples, and looks very strange to do non negative derivative on a percentile

Thanks Torkel, I will have a play, i guess this is something influxdb related anyway?

I looked at a few guides online about playing with bandwidth in grafana, apparently i need to do a non_negative_derivative (ideally) or derivative on Octet counters, otherwise do you have any suggestions? (i don’t really know what derivative does!)

I was hoping Grafana could replace our Cacti software, the only thing missing was the 95th percentile stuff, i’ll see if i can get it working.

Ran into this same issue. In order to generate a percentile value, we had to run an Influx continuous query on the incoming raw data with non_negative_derivative\math like you have, to convert to octets to bits. Once we had a value converted to bits in a new measurement, you can run the percentile function.

Also if you have an existing Cacti setup, there is a plugin to output to the metrics to Influx. Might help instead of converting to Telegraf.

Wow ! Thanks for the hint, I’ll attempt to get it working with the continuous queries. Although i’m guessing I would have to run a seperate query on every interface, which will be a lot !

We were looking into replacing Cacti altogether with Grafana, didn’t know there was a influxdb plugin for Cacti though, that sounds useful aswell for testing Thanks!

You can use wildcards for the continuous query. We only have one running converting all devices and interfaces.

Thanks, any chance of seeing your query?

You may need to change the time(1m) to time(5m) based on your polling interval.

“CREATE CONTINUOUS QUERY “Interface-Traffic-Conversion” ON cacti BEGIN SELECT non_negative_derivative(mean(value), 1s) * 8 AS bitspersec INTO cacti.autogen.“interface.traffic.rollup” FROM cacti.autogen.“interface.traffic” GROUP BY type, description, namecache, time(1m) END”

1 Like

Hi everyone,

I read your post and I have a question. Why do you use non_negative_derivative function and not non_negative_difference ? I’m monitoring my infrastructure and I’m following the instruction in this website (input utilization formula) : https://www.cisco.com/c/en/us/support/docs/ip/simple-network-management-protocol-snmp/8141-calculate-bandwidth-snmp.html

but when I check the definition of derivative function there : https://docs.influxdata.com/flux/v0.65/stdlib/built-in/transformations/aggregates/derivative/

I don’t understand what it means.

And second question : if the value, for example the number of input octets, is catched every 20 secondes, do you know if I need to include this time in the calcul or if the derivative function already includes it ?

Thanks for your help !

Volkan