Skip to content

Commit

Permalink
Sets ifAlias for uplink to actual ifAlias value on interface. (#17)
Browse files Browse the repository at this point in the history
  • Loading branch information
nkinkade authored Sep 23, 2020
1 parent f538650 commit 8c029ff
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions metrics/metrics.go
Original file line number Diff line number Diff line change
Expand Up @@ -74,15 +74,15 @@ func mustGetIfaces(client snmp.Client, machine string) map[string]map[string]str
ifDescrOid := createOID(ifDescrOidStub, iface)
oidMap, err := getOidsString(client, []string{ifDescrOid})
rtx.Must(err, "Failed to determine the machine interface ifDescr")
ifaces["machine"]["ifAlias"] = machine
ifaces["machine"]["ifAlias"] = val
ifaces["machine"]["ifDescr"] = oidMap[ifDescrOid]
ifaces["machine"]["iface"] = iface
}
if strings.HasPrefix(val, "uplink") {
ifDescrOid := createOID(ifDescrOidStub, iface)
oidMap, err := getOidsString(client, []string{ifDescrOid})
rtx.Must(err, "Failed to determine the uplink interface ifDescr")
ifaces["uplink"]["ifAlias"] = "uplink"
ifaces["uplink"]["ifAlias"] = val
ifaces["uplink"]["ifDescr"] = oidMap[ifDescrOid]
ifaces["uplink"]["iface"] = iface
}
Expand Down
4 changes: 2 additions & 2 deletions metrics/metrics_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ func Test_New(t *testing.T) {
name: "ifOutDiscards",
previousValue: 0,
scope: "uplink",
ifAlias: "uplink",
ifAlias: "uplink-10g",
ifDescr: "xe-0/0/45",
interval: archive.Model{
Experiment: "s1-abc0t.measurement-lab.org",
Expand All @@ -239,7 +239,7 @@ func Test_New(t *testing.T) {
name: "ifHCInOctets",
previousValue: 0,
scope: "uplink",
ifAlias: "uplink",
ifAlias: "uplink-10g",
ifDescr: "xe-0/0/45",
interval: archive.Model{
Experiment: "s1-abc0t.measurement-lab.org",
Expand Down

0 comments on commit 8c029ff

Please sign in to comment.