Add network bonding collector
This collector exposes two metrics: - net_bonding_slaves: configured slaves per bonding interface - net_bonding_slaves_active: currently active slaves per bonding interface
This commit is contained in:
parent
b03ff7cb9b
commit
0bf0f67503
10 changed files with 123 additions and 0 deletions
23
collector/bonding_test.go
Normal file
23
collector/bonding_test.go
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
package collector
|
||||
|
||||
import (
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestBonding(t *testing.T) {
|
||||
bondingStats, err := readBondingStats("fixtures/bonding")
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if bondingStats["bond0"][0] != 0 || bondingStats["bond0"][1] != 0 {
|
||||
t.Fatal("bond0 in unexpected state")
|
||||
}
|
||||
|
||||
t.Logf("int: %v", bondingStats["int"])
|
||||
if bondingStats["int"][0] != 2 || bondingStats["int"][1] != 1 {
|
||||
t.Fatal("int in unexpected state")
|
||||
}
|
||||
if bondingStats["dmz"][0] != 2 || bondingStats["dmz"][1] != 2 {
|
||||
t.Fatal("dmz in unexpected state")
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue