mirror of
https://github.com/eko/pihole-exporter.git
synced 2024-11-21 11:05:22 +01:00
Merge pull request #148 from jmherbst/warn-missing-auth
Adding warning logging if full metrics set is not available.
This commit is contained in:
commit
f275c78577
@ -125,6 +125,12 @@ func (c *Client) setMetrics(stats *Stats) {
|
|||||||
}
|
}
|
||||||
metrics.Status.WithLabelValues(c.config.PIHoleHostname).Set(float64(isEnabled))
|
metrics.Status.WithLabelValues(c.config.PIHoleHostname).Set(float64(isEnabled))
|
||||||
|
|
||||||
|
// Pi-Hole returns a subset of stats when Auth is missing or incorrect.
|
||||||
|
// This provides a warning to users that metrics are not complete.
|
||||||
|
if len(stats.TopQueries) == 0 {
|
||||||
|
log.Warnf("Invalid Authentication - Some metrics may be missing. Please confirm your PI-Hole API token / Password for %s", c.config.PIHoleHostname)
|
||||||
|
}
|
||||||
|
|
||||||
for domain, value := range stats.TopQueries {
|
for domain, value := range stats.TopQueries {
|
||||||
metrics.TopQueries.WithLabelValues(c.config.PIHoleHostname, domain).Set(float64(value))
|
metrics.TopQueries.WithLabelValues(c.config.PIHoleHostname, domain).Set(float64(value))
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user