diff --git a/main.go b/main.go index faa7448..e77d294 100644 --- a/main.go +++ b/main.go @@ -26,6 +26,8 @@ import ( "sort" "bytes" "errors" + "strings" + "strconv" "github.com/namsral/flag" "github.com/prometheus/client_golang/prometheus" @@ -188,7 +190,8 @@ func (fc *FritzboxCollector) ReportMetric(ch chan<- prometheus.Metric, m *Metric lval = "" } - labels[i] = fmt.Sprintf("%v", lval) + // convert tolower to avoid problems with labels like hostname + labels[i] = strings.ToLower(fmt.Sprintf("%v", lval)) } } @@ -273,7 +276,28 @@ func (fc *FritzboxCollector) Collect(ch chan<- prometheus.Metric) { } if aa.IsIndex { - // TODO handle index iterations + sval := fmt.Sprintf("%v", value) + count, err := strconv.Atoi(sval) + if err != nil { + fmt.Println(err.Error()) + collect_errors.Inc() + continue + } + + for i:=0; i