Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Jumping values in /api/4/network #3031

Open
ACrazyConcept opened this issue Nov 23, 2024 · 2 comments
Open

Jumping values in /api/4/network #3031

ACrazyConcept opened this issue Nov 23, 2024 · 2 comments

Comments

@ACrazyConcept
Copy link

Describe the bug
The values for bytes_recv_gauge and bytes_sent_gauge increases in large jumps with regular intervals. These jumps are not actual traffic.
I see the behavior both on an RPi4 and an Intel NUC.

To Reproduce
I have created a sensor in home-assistant that fetches the data from the api at /api/4/network.

[
  {
    "bytes_sent": 229609,
    "bytes_recv": 215685,
    "speed": 1048576000,
    "key": "interface_name",
    "interface_name": "eth0",
    "alias": null,
    "bytes_all": 445294,
    "time_since_update": 4.34731888771057,
    "bytes_recv_gauge": 3166404580666,
    "bytes_recv_rate_per_sec": 49613,
    "bytes_sent_gauge": 3061063472028,
    "bytes_sent_rate_per_sec": 52816,
    "bytes_all_gauge": 6227468052694,
    "bytes_all_rate_per_sec": 102429
  }
]
  - platform: rest
    resource: http://x.x.x.x:61208/api/4/network/interface_name/eth0
    name: eth0 out
    unique_id: eth0_out
    scan_interval: 60
    force_update: true
    value_template: >
      {%- set jsonObject = value_json['eth0'][0]  -%}
      {{ (jsonObject.bytes_sent_gauge | float / 1048576) | round(2) }}
    device_class: data_size
    unit_of_measurement: MiB
    state_class: total_increasing

Expected behavior
A smooth increase.

Screenshots
image

Environement (please complete the following information)

  • Operating System (lsb_release -a or OS name/version):
    Rpi:
    $ lsb_release -a
    No LSB modules are available.
    Distributor ID: Debian
    Description:    Debian GNU/Linux 12 (bookworm)
    Release:        12
    Codename:       bookworm
    
    NUC:
    # lsb_release -a
    LibreELEC (official): 12.0.1
    
  • Glances & psutil versions: 4.2.1 and 6.1.0 on both
  • How do you install Glances (Pypi package, script, package manager, source): Docker
  • Glances test: Everything OK or N/A
@nicolargo
Copy link
Owner

nicolargo commented Nov 27, 2024

Hi @ACrazyConcept

I can not reproduce on my side.

$ while true; do curl http://localhost:61208/api/4/network/bytes_recv_gauge/eno2; sleep 3; echo ""; done
{"bytes_recv_gauge":382759438024}
{"bytes_recv_gauge":382759441324}
{"bytes_recv_gauge":382759458926}
{"bytes_recv_gauge":382759463563}
{"bytes_recv_gauge":382759467921}
{"bytes_recv_gauge":382759502931}
{"bytes_recv_gauge":382759554358}
{"bytes_recv_gauge":382759587520}
{"bytes_recv_gauge":382759610123}
{"bytes_recv_gauge":382761712368}
{"bytes_recv_gauge":382761860882}
{"bytes_recv_gauge":382761910486}
{"bytes_recv_gauge":382761963454}
==> Open a page on my WebBrowser to generate trafics
{"bytes_recv_gauge":382763588594}
{"bytes_recv_gauge":382763591666}
{"bytes_recv_gauge":382763595034}
{"bytes_recv_gauge":382763598825}

Are you sure that you do not have any hidden trafic on your network ?

@ACrazyConcept
Copy link
Author

Hi @nicolargo

The jumps only happen intermittently so you might have to monitor it for a while. I don't really see a temporal pattern.
Although I guess I can't 100% rule out it is actual traffic, it seems strange.
I could maybe try to monitor the switch as well.
image

I made a test comparing Glances to Home Assistant System monitor. (same config as above.)
image

Raspberry Pi 4 Model B Rev 1.2
Distro......: Debian GNU/Linux 12 (bookworm)
Kernel......: Linux 6.6.62+rpt-rpi-v8

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants