Display total bandwidth usage

  • What Grafana version and what operating system are you using?
    OSS v9.3.6

  • What are you trying to achieve?
    Try to make a panel where which can show total monthly, daily or weekly bandwidth by a server.

  • How are you trying to achieve it?
    Exactly not sure where to start, I am not sure if I can active this using default “node exporter” alone or I can use “exec” plugin for telegraf to read vnstat data

[[inputs.exec]]
  commands = [
    "/usr/bin/vnstat -i eth0 -tr --short --json",
    "/usr/bin/vnstat -i tun0 -tr --short --json"
    ]
  timeout = "10s"
  name_suffix = "_vnstat"
  data_format = "json"
  json_name_key="vnstat"
  tag_keys= ["interface"]

Or can use .net plugin for telegraf:

[[inputs.net]]
  ## By default, telegraf gathers stats from any up interface (excluding loopback)
  ## Setting interfaces will tell it to gather these explicit interfaces,
  ## regardless of status. When specifying an interface, glob-style
  ## patterns are also supported.
  ##
  interfaces = ["eth0", "enp0s[0-1]", "lo"]
  ##

In the end of the day, need a dashboard where I can see daily and monthly bandwidth usage by a server.

  • Did you receive any errors in the Grafana UI or in related logs? If so, please tell us exactly what they were.
    No

  • Did you follow any online instructions? If so, what is the URL?
    Been trying to understand promQL, grafana explorer but looks like it need clear understanding to achieve this.

Do I really need to be wizard of promQL to achieve this or it is something I can easily do ?

Hi @anayx,

Welcome to the :grafana: community support forums !!

We are excited that you joined our OSS community. Please read about some of the FAQs in the community :slight_smile:

What is your datasource as from the above it seems clear that you are using Telegraf but are you also using Prometheus as the main Datasource?

Yes, I am running telegraf in pull mode ie. like regular node_exporter and then prometheous is scrapping data and storing it.

Thanks for this info !

I have updated the post and moved it to Prometheus category so that community users can help you out.

Welcome @anayx

I would think that as a minimum, the metrics you’ll need are node_network_receive_bytes_total and node_network_transmit_bytes_total and then a query such as this to calculate the total bandwidth for all network interfaces. More about irate here and a blog post from several years ago here that may help.

sum(irate(node_network_receive_bytes_total[1m])) + sum(irate(node_network_transmit_bytes_total[1m]))