Monitoring network inerface not working

According to this video tutorial I’ve set up some cpu, memory and network monitoring entities, which all work fine except the networking ones.
As described in the video tutorial, when executing the ip addr command, the output should be something like eth0 or similiar. In my case, it gives me back eth0@if21, which won’t work. When I put in into the config.yaml file like this…

# Sensors:
sensor:
  - platform: systemmonitor
    resources:
      - type: throughput_network_in
        arg: eth0@if21
      - type: throughput_network_out
        arg: eth0@if21

…the entities show up like this:

I’ve also tried to set it between quotation marks like this:
arg: 'eth0@if21'
and also by using unicode for the @ char like this:
arg: 'eth0%40if21'
but that also won’t work.
Also just adding
arg: eth0
won’t work.

Any suggestions what else to try?
Thank you in advance!

What is the output of:

ip addr | grep en

1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN qlen 1000

I’m not sure if the installed nginx proxy add-on is causing the issue. I have configured it like this within the configuration.yaml file:

# NGINX Docker configuration:
http:
  use_x_forwarded_for: true
  trusted_proxies:
    - 172.30.33.0/24

What is the output of:

ip addr
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN qlen 1000
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
       valid_lft forever preferred_lft forever
20: eth0@if21: <BROADCAST,MULTICAST,UP,LOWER_UP,M-DOWN> mtu 1500 qdisc noqueue state UP
    link/ether 02:42:ac:1e:21:01 brd ff:ff:ff:ff:ff:ff
    inet 172.30.33.1/23 brd 172.30.33.255 scope global eth0
       valid_lft forever preferred_lft forever

Are you using a virtual machine?

Did you try:

sensor:
  - platform: systemmonitor
    resources:
      - type: throughput_network_in
        arg: if21
      - type: throughput_network_out
        arg: if21

Tried it now with your suggestion and it also says Unknown.

Yes, I’m on a virtual machine, aarch64 on ESXi ARM.

What does ifconfig return?

eth0      Link encap:Ethernet  HWaddr 02:42:AC:1E:21:01
          inet addr:172.30.33.1  Bcast:172.30.33.255  Mask:255.255.254.0
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:13066 errors:0 dropped:0 overruns:0 frame:0
          TX packets:2695 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:4041237 (3.8 MiB)  TX bytes:1959366 (1.8 MiB)

lo        Link encap:Local Loopback
          inet addr:127.0.0.1  Mask:255.0.0.0
          UP LOOPBACK RUNNING  MTU:65536  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)

Then it should just be:

sensor:
  - platform: systemmonitor
    resources:
      - type: throughput_network_in
        arg: eth0
      - type: throughput_network_out
        arg: eth0

just stumbling over this too… no more ipv4 address after having move from aRpi4 to a mini PC.

check the system/network tab and see:

so figured I need to set the argument to:

     - type: ipv4_address
        arg: enp2s0

However, this doesn’t create the sensor either…

I am also missing out on the processor_temperature sensor btw. that has no arguments, so we’re lost there I guess.

Docs say this needs a hardware sensor, and that should be there, because I can do

  - platform: command_line
    name: Cpu temp (read)
    command: >
      read -r val </sys/class/thermal/thermal_zone0/temp;echo ${val}
    value_template: >
      {{value|multiply(0.001)|round(1)}}
    unit_of_measurement: °C

returns in cli are partially identical to the ones popcorn boy reports, bit perfect almost…

Don’t indent arg:

sorry for that, it was a c&p error, but correct in my config:

  - platform: systemmonitor
    resources:
      - type: disk_use
        arg: /home
      - type: disk_use_percent
        arg: /home
      - type: disk_free
        arg: /home
#      - type: network_in
#        arg: eth0
#      - type: network_out
#        arg: eth0
#      - type: packets_in
#        arg: eth0
#      - type: packets_out
#        arg: eth0
#      - type: load_1m
#      - type: load_5m
#      - type: load_15m

      - type: processor_temperature
      - type: processor_use
#      - type: process
#        arg: octave-cli
      - type: memory_free
      - type: memory_use_percent
      - type: memory_use
      - type: swap_use_percent
      - type: swap_use
      - type: swap_free
      - type: last_boot
      - type: ipv4_address
        arg: eth0

What shows on the Settings > System > Network page?

Screenshot 2022-06-18 at 11-39-43 Settings – Home Assistant

2 Likes

Oh well, that was it!
Scrolling down to Network adapter on the page you mentioned showed the following different NIC interface description:


So I tried the following for my configuration.yaml:

# Sensors:
sensor:
  - platform: systemmonitor
    resources:
      - type: throughput_network_in
        arg: enp2s0
      - type: throughput_network_out
        arg: enp2s0

And boom, it worked:

So is that an issue at all that should be sent as an issue ticket to GitHub?

5 Likes

What version number of Home Assistant are you running?

aarch64 vmdk image

did you also try that on the ipv4 sensor? I did, and it didnt create the sensor.
which is not a real deal breaker, because there’s a core local_ip sensor, but still

Sorry but I don’t really get what you mean. I have ipv6 disabled and only ipv4 enabled and the two sensors are being created as you can see on the screenshot above. Maybe I just misunderstand your question.

What I mentioned: You wrote about moving from a Raspi Pi over to a mini PC. I assume you did the migration by restoring from a full backup, which I also did a few weeks ago, just the other way round: I moved from a x86_64 system to aarch64 version of Home Assistant. Maybe the issue of NIC name inconsistencies is being created when migrating from one system to another?

I meant to ask did you also add

      - type: ipv4_address
        arg: enp2s0

to the system_monitor config.

all other configured sensors work, as posted above, so I dont think it has to do with migration.