Browse Source

added modelname metric and limited lowercase labels to hostname and macaddress

pull/4/head
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 = "" lval = ""
} }
// convert tolower to avoid problems with labels like hostname // convert hostname and MAC tolower to avoid problems with labels
labels[i] = strings.ToLower(fmt.Sprintf("%v", lval)) 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" "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", "service": "urn:dslforum-org:service:LANEthernetInterfaceConfig:1",
"action": "GetStatistics", "action": "GetStatistics",

Loading…
Cancel
Save