Percentile 95 with Grafana and Prometheus

Hello, We need and We are trying to make a graph of traffic data of a switch cisco with 95th percentile and We can not get it, the general query of the port of switch is like: (irate(ifHCOutOctets{ifIndex=“10121”,instance=“172.20.5.43”,job=“SwitchCisco”}[6m]))
How We can do the percentile 95 of the above query?
Thank you

As my experience, if you use SNMP, it’s very difficult to get the percentile.
In my setup, first I use SNMP to build the traffic, I use elasticsearch by the way, and I just have the Derivative value from SNMP IfInOctets, then I tried to get the percentile, but it’s too difficult, even in the elasticsearch can do the query, but not in Grafana.
I suggest use netflow if you want to get the percentile. I have the percentile right now since using netflow from the network devices, especially cisco…
You can use netflow_exporter to the prometheus from this:
https://github.com/neptune-networks/flow-exporter

Regards,
Fadjar Tandabawana

Try the following PromQL query:

quantile_over_time(0.95,
  rate(ifHCOutOctets{ifIndex=“10121”,instance=“172.20.5.43”,job=“SwitchCisco”}[6m])[$__range:6m]
)

It uses Prometheus subqueries and $__range template variable for calculating 95th percentile over 6-minute average rates during the selected time range on the graph. Note that the percentile is calculated independently per each point on the graph.