Skip to content

Zabbix eth0 speed is -1

Symptoms

.. in zabbix

Value of type "double" is not suitable for value type "Numeric (unsigned)". Value "-1000000"
.. on host
$ cat /sys/class/net/eth0/speed 
-1

$ ethtool eth0
Settings for eth0:
    Supported ports: [  ]
    Supported link modes:   Not reported
    Supported pause frame use: No
    Supports auto-negotiation: No
    Supported FEC modes: Not reported
    Advertised link modes:  Not reported
    Advertised pause frame use: No
    Advertised auto-negotiation: No
    Advertised FEC modes: Not reported
    Speed: Unknown!
    Duplex: Unknown! (255)
    Auto-negotiation: off
    Port: Other
    PHYAD: 0
    Transceiver: internal
    Link detected: yes

Checking

$ ls -l /sys/class/net/eth0
lrwxrwxrwx 1 root root 0 May  7 07:39 /sys/class/net/eth0 -> ../../devices/pci0000:00/0000:00:02.0/0000:01:00.0/virtio1/net/eth0

$ ethtool -i eth0
driver: virtio_net
version: 1.0.0
firmware-version: 
expansion-rom-version: 
bus-info: 0000:01:00.0
supports-statistics: yes
supports-test: no
supports-eeprom-access: no
supports-register-dump: no
supports-priv-flags: no

Conclusion

Virtio_net drivers can not show actual speed of device

Possible solution

Allow Zabbix agent to receive value with sign (-1) by setting preprocessing rule in Item prototype. and set Macro for Host with actual multiplier value.

Template Item prototype:

Customer multiplier = {$ETH_SPEED:"{#IFNAME}"}

item prototype

Macro in Template:

{$ETH_SPEED} = 1

Marco on host:

{$ETH_SPEED:"eth0"} = 1000

As result: example