Fix stale threshold

This commit is contained in:
Robert Jacob 2020-06-21 18:04:42 +02:00
parent 3d98195772
commit b757b59f9f
2 changed files with 4 additions and 3 deletions

View file

@ -138,7 +138,7 @@ func (c *netatmoCollector) collectData(ch chan<- prometheus.Metric, device *neta
date := time.Unix(*data.LastMeasure, 0) date := time.Unix(*data.LastMeasure, 0)
if time.Since(date) > c.staleThreshold { if time.Since(date) > c.staleThreshold {
c.log.Warnf("Data is stale: %s > %s", time.Since(date), c.staleThreshold) c.log.Warnf("Data is stale for %s: %s > %s", moduleName, time.Since(date), c.staleThreshold)
return return
} }

View file

@ -38,6 +38,7 @@ func main() {
metrics := &netatmoCollector{ metrics := &netatmoCollector{
log: log, log: log,
client: client, client: client,
staleThreshold: cfg.StaleDuration,
} }
prometheus.MustRegister(metrics) prometheus.MustRegister(metrics)