Megabits/sec Not Showing Correctly

Hi All,

Trying to get familiar with Grafana and I am simply collecting data from speed tests to monitor my network.

The issue I am coming across is is when I create a gauge that should be megabits/sec or Mbps. The number is incorrect.

What am I doing wrong here?

Nothing wrong. You have so huge value that Grafana makes conversion to have more readable value in the panel. E. g. 1000 000Mbs/=1Tb/s. See metric prefixes Unit prefix - Wikipedia

Thanks @jangaraj for your reply.
That totally makes sense.

How can I get this to display correctly? I want to display this as Mbps and I know my speed tests are averaging 200Mbps. I know for a fact I am not getting speeds as noted in the example above. I am just not sure how to convert this in Grafana :frowning:

The simplest solution might be just to divide by a constant in the query
itself, so that the value returned to Grafana is in the units you want.

So, if your raw data is in bits per second, and you want the result to be
displayed in megabits per second, you would simply add either “/ 1000000” or
“/ 1048576”, depending on your definition of a megabit, to the query.

Then the numbers that Grafana processes will have the dimensions you prefer.


Apologies for not following up on this sooner.

Where would I do this calculation? I am looking at my query and I am not quite sure how this would work …

from(bucket: "Speedtest")
  |> range(start: v.timeRangeStart, stop: v.timeRangeStop)
  |> filter(fn: (r) => r["_field"] == "download_bandwidth")

It looks like you’re using InfluxDB v2, and I can only do InfluxQL v1.8, so I
hope someone else can tell you how to fit the arithmetic into the query.


No worries @pooh
Appreciate you looking at it :slight_smile:

Wouldn’t a better solution be to set the unit to “bits/sec” - because that essentially indicates the units of the source data. Then if the value returned by the query is 1,000,000 for instance, what would be displayed in the front end is 1 Mbps. I.e. as long as the units of the source data are set correctly, Grafana will auto-convert to kilo/mega/giga etc as appropriate.

I have set it to be this but then it shows up as TB.
This is very confusing to navigate how to make this work.

Probably didn’t make my point clearly: I meant that you shouldn’t include “mega” in the “Unit” box itself. Just “bits” (or “bytes”, etc), since that seems to be the unit of your actual data:
Screen Shot 2021-06-06 at 9.25.34 PM

So I was able to do that easy enough. My only issue now is its off where the decimal falls.

Its saying 7.86 Mbps but its actually 78.6 Mbps.

Ok…do you know what the units of your source data actually are?

If you’re saying that it’s roughly a factor 10 off, then my suspicion is that your data is in bytes rather than bits (which would be factor 8, roughly speaking).

I.e. is it possible that you’re looking at a transfer speed of 7.86MB/sec, meaning a link speed of ~63Mbps?

I thought the same thing as well so I tried that and all it does is keep the value the same and change the data measurement from Mbps to MBps …

I’m afraid I’m no longer quite sure what your desired outcome is. Is it that your database stores measurements in bytes/second, but you’d like to display bits/second? It would be great to know for sure what the unit is of the values stored in your database, because otherwise we’re just stabbing in the dark.

Grafana will not convert from bits to bytes or vice versa - you would need to do that in your query (as @pooh previously suggested).

What Grafana does do is show you human-readable scaling by moving the decimal point and adding a “kilo-”, “mega-”, “giga-”, etc, prefix as appropriate. E.g. if your database contains the value 7860000 and you select the unit “bytes/sec” (because that’s the unit of the value in your database), what Grafana will show is “7.86 MiB/s”.

I hope that makes sense.