Fix for upgradable metric for Prometheus

This commit is contained in:
Patrik Boström 2023-02-25 22:46:26 +01:00
parent 8809e30b20
commit d4dc0d76d6
No known key found for this signature in database
GPG Key ID: FED8033A712DBBF3
2 changed files with 7 additions and 0 deletions

View File

@ -332,6 +332,12 @@ func (u *promUnifi) exportMetrics(r report, ch chan<- prometheus.Metric, ourChan
ch <- r.export(m, float64(v))
case int:
ch <- r.export(m, float64(v))
case bool:
if v {
ch <- r.export(m, 1)
} else {
ch <- r.export(m, 0)
}
default:
r.error(ch, m.Desc, fmt.Sprintf("not a number: %v", m.Value))
}

View File

@ -231,6 +231,7 @@ func (u *promUnifi) exportUAP(r report, d *unifi.UAP) {
r.send([]*metric{
{u.Device.Info, gauge, 1.0, append(labels, infoLabels...)},
{u.Device.Uptime, gauge, d.Uptime, labels},
{u.Device.Upgradeable, gauge, d.Upgradable.Val, labels},
})
}