Merge pull request #522 from patbos/upgradable

Fix for upgradable metric for Prometheus
This commit is contained in:
Cody Lee 2023-02-25 16:17:03 -06:00 committed by GitHub
commit ee13b84f8e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
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},
})
}