Bond: Monitor bond mii_status not link operstate (#1124)

With a bond interface the state of the slave interface from the bond's
point of view is reflected in `mii_status` and is independent of the
link's `operstate`.

When a bond is monitored with `miimon`, `mii_status` will reflect the
state of the physical link as configured via the operator.

When a bond is monitored via `arp_interval` the `mii_status` will
reflect the results of the bond ARP checking.  This means the link can
be down from the bond's point of view, but up from a physical
connection point of view.

If a bond is not monitored via miimon or arp, the `mii_status` should
likely be always `up`, however I have observed a case where this is not
true and the `operstate` is `up` while `mii_status` is `down`.  Kernel
bond documentation stresses that a bond should not be configured without
one of `mii_mon` or `arp_interval` configured however.

This change results in the metric 'node_bonding_active' matching the
up/down state of the bond's point of view rather than operstate.

Signed-off-by: Sachi King <nakato@nakato.io>
This commit is contained in:
Sachi King 2019-02-10 21:00:04 +11:00 committed by Ben Kochie
commit 18fc512fc4
3 changed files with 36 additions and 2 deletions

View file

@ -704,6 +704,14 @@ Mode: 644
Directory: sys/class/net/dmz/slave_eth0
Mode: 755
# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Directory: sys/class/net/dmz/slave_eth0/bonding_slave
Mode: 755
# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Path: sys/class/net/dmz/slave_eth0/bonding_slave/mii_status
Lines: 1
up
Mode: 644
# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Path: sys/class/net/dmz/slave_eth0/operstate
Lines: 1
up
@ -712,6 +720,14 @@ Mode: 644
Directory: sys/class/net/dmz/slave_eth4
Mode: 755
# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Directory: sys/class/net/dmz/slave_eth4/bonding_slave
Mode: 755
# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Path: sys/class/net/dmz/slave_eth4/bonding_slave/mii_status
Lines: 1
up
Mode: 644
# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Path: sys/class/net/dmz/slave_eth4/operstate
Lines: 1
up
@ -860,6 +876,14 @@ Mode: 644
Directory: sys/class/net/int/slave_eth1
Mode: 755
# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Directory: sys/class/net/int/slave_eth1/bonding_slave
Mode: 755
# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Path: sys/class/net/int/slave_eth1/bonding_slave/mii_status
Lines: 1
down
Mode: 644
# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Path: sys/class/net/int/slave_eth1/operstate
Lines: 1
down
@ -868,6 +892,14 @@ Mode: 644
Directory: sys/class/net/int/slave_eth5
Mode: 755
# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Directory: sys/class/net/int/slave_eth5/bonding_slave
Mode: 755
# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Path: sys/class/net/int/slave_eth5/bonding_slave/mii_status
Lines: 1
up
Mode: 644
# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Path: sys/class/net/int/slave_eth5/operstate
Lines: 1
up