Browse Source

added modelname metric and limited lowercase labels to hostname and macaddress

go-modules
sberk42 4 years ago
parent
commit
abd95b5c27
  1. 8
      main.go
  2. 18
      metrics.json

8
main.go

@ -190,8 +190,12 @@ func (fc *FritzboxCollector) ReportMetric(ch chan<- prometheus.Metric, m *Metric
lval = ""
}
// convert tolower to avoid problems with labels like hostname
labels[i] = strings.ToLower(fmt.Sprintf("%v", lval))
// convert hostname and MAC tolower to avoid problems with labels
if(l == "HostName" || l == "MACAddress" ) {
labels[i] = strings.ToLower(fmt.Sprintf("%v", lval))
} else {
labels[i] = fmt.Sprintf("%v", lval)
}
}
}

18
metrics.json

@ -249,6 +249,24 @@
},
"promType": "GaugeValue"
},
{
"service": "urn:dslforum-org:service:DeviceInfo:1",
"action": "GetInfo",
"result": "ModelName",
"promDesc": {
"fqName": "gateway_device_modelname",
"help": "gateway device model name",
"varLabels": [
"gateway",
"Description",
"ModelName",
"ProductClass",
"SoftwareVersion",
"HardwareVersion"
]
},
"promType": "GaugeValue"
},
{
"service": "urn:dslforum-org:service:LANEthernetInterfaceConfig:1",
"action": "GetStatistics",

Loading…
Cancel
Save