Grafana is not showing correct network usage

  • What Grafana version and what operating system are you using?

    • com.docker.compose.version 2.39.4
      I use it on a Oracle ARM instance
  • What are you trying to achieve?

    • Getting it to show the correct network usage.
  • How are you trying to achieve it?

    • Network Download
      ```
      sum by (instance) (

      irate(node_network_receive_bytes_total{

      job=“node”, instance=“$instance”,

      device=~“^(enp|ens|eno|eth|bond|wlp).*”

      }[$__rate_interval]) * 8

    )
    ```
    Network Upload
    ```
    sum by (instance) (

    irate(node_network_transmit_bytes_total{

    job="node", instance="$instance",
    
    device=\~"^(enp|ens|eno|eth|bond|wlp).\*"
    

    }[$__rate_interval]) * 8

    )
    ```

  • What happened?
    It only shows :
    Down: 725 b/s
    Up: 7.29 kb/s
    even if there is a stream running

  • What did you expect to happen?
    Show the correct network usage

  • Can you copy/paste the configuration(s) that you are having problems with?
    I guess it’s this part

    • Network Download
      ```
      sum by (instance) (

      irate(node_network_receive_bytes_total{

      job=“node”, instance=“$instance”,

      device=~“^(enp|ens|eno|eth|bond|wlp).*”

      }[$__rate_interval]) * 8

    )
    ```
    Network Upload
    ```
    sum by (instance) (

    irate(node_network_transmit_bytes_total{

    job="node", instance="$instance",
    
    device=\~"^(enp|ens|eno|eth|bond|wlp).\*"
    

    }[$__rate_interval]) * 8

    )
    ```

My compose file:
```
services:

plex:

image: lscr.io/linuxserver/plex:latest

container_name: plex_nostop

hostname: plex

environment:

  - PUID=${PUID}

  - PGID=${GUID}

  - TZ=${TZ}

  - VERSION=docker

  - PLEX_CLAIM=claim-7Jf5T8R8pSwmUsQX7Fyy

ports:

  - 32400:32400        

tmpfs:

  - /transcode:size=8G      

volumes:

  - ${DOCKERCONFDIR}/plex:/config

  - ${SOURCEPATH}:/media

restart: unless-stopped

healthcheck:

  test: curl --connect-timeout 15 --silent --show-error --fail http://localhost:32400/identity

  interval: 1m

  timeout: 30s

  retries: 3

  start_period: 1m   

prometheus-plex-exporter:

  container_name: prometheus-plex-exporter

  image: ghcr.io/timothystewart6/prometheus-plex-exporter:latest

  pull_policy: always

  restart: unless-stopped

  depends_on:

    - plex

  env_file:

    - /home/ubuntu/docker/data/plexmonitoring/plex-prometheus-exporter/.env

  \# ports:

  \# - 9000:9000/tcp

  security_opt:

    - no-new-privileges:true

prometheus:

image: prom/prometheus:latest

container_name: prometheus

pull_policy: always

restart: unless-stopped

extra_hosts:

  - "host.docker.internal:host-gateway" # Allows access to host network from container

env_file:

  - /home/ubuntu/docker/data/plexmonitoring/prometheus/.env

user: "1001:1001"

ports:

  - 9090:9090/tcp

security_opt:

  - no-new-privileges:true

volumes:

  - ${PLEX_MONITOR}/prometheus/config/prometheus.yml:/etc/prometheus/prometheus.yml:ro

  - ${PLEX_MONITOR}/prometheus/config/rules:/etc/prometheus/rules:ro

  - ${PLEX_MONITOR}/prometheus/data/:/prometheus



command:

  - --config.file=/etc/prometheus/prometheus.yml

  - --storage.tsdb.path=/prometheus

  - --storage.tsdb.retention.time=30d

  - --web.enable-lifecycle    

  - --web.enable-admin-api

node_exporter:

image: quay.io/prometheus/node-exporter:latest

container_name: node_exporter

hostname: node_exporter

pull_policy: always

restart: unless-stopped

#network_mode: host

env_file:

  - /home/ubuntu/docker/data/plexmonitoring/node-exporter/.env

ports:

  - 9100:9100

security_opt:

  - no-new-privileges:true

command:

  - '--path.rootfs=/host'

  - '--path.procfs=/host/proc'

  - '--path.sysfs=/host/sys'

  - '--collector.cpu.info'

pid: host

volumes:

  - /:/host:ro,rslave

  - /proc:/host/proc:ro

  - /sys:/host/sys:ro

grafana:

image: grafana/grafana:latest

container_name: grafana

pull_policy: always

restart: unless-stopped

depends_on:

  - prometheus

env_file:

  - /home/ubuntu/docker/data/plexmonitoring/grafana/.env

user: "1001:1001"

ports:

  - 3000:3000/tcp

security_opt:

  - no-new-privileges:true

volumes:

  - ${PLEX_MONITOR}/grafana/data:/var/lib/grafana

  - ${PLEX_MONITOR}/grafana/provisioning/datasources:/etc/grafana/provisioning/datasources

  - ${PLEX_MONITOR}/grafana/provisioning/dashboards:/etc/grafana/provisioning/dashboards

cadvisor:

image: gcr.io/cadvisor/cadvisor:latest

container_name: cadvisor

pull_policy: always

restart: unless-stopped

env_file:

  - /home/ubuntu/docker/data/plexmonitoring/cadvisor/.env

volumes:

  - /:/rootfs:ro

  - /var/run:/var/run:ro

  - /sys:/sys:ro

  - /var/lib/docker/:/var/lib/docker:ro

  - /dev/disk/:/dev/disk:ro      

networks:

default:

name: skynet

external: true      

```

The tutorial is found here: timothystewart6/plex-monitoring-stack: A Plex Stack with Monitoring

My vnstat shows these

I would say that most likely this is not a Grafana issue, but rather something with Prometheus query.

You can try:

  • changing irate to rate
  • checking that device regex is correct and includes all the necessary devices

If it helps here is the media-server.json

View paste HLCIDXCJNOGGHRWTM475HWGHIU

So I think your queries are more or less correct. Please notice that irate function takes a per-second rate between the last two points. I guess that you have your data scraped every 15 seconds, so the data you provide was more or less “I had 7 something kb/s in the last 15 seconds”. It’s not the cumulative data, only current one. The screenshot from the netstat shows (I think) the cumulative data that was sent in a period of time.

1 Like