not sure how far I got..

This commit is contained in:
davidnewhall2
2019-12-13 14:17:28 -08:00
parent 1b31e1449e
commit b8d9ac9f88
9 changed files with 114 additions and 56 deletions

View File

@@ -33,6 +33,7 @@ type unifiDevice struct {
func descDevice(ns string) *unifiDevice {
labels := []string{"type", "site_name", "name"}
infoLabels := []string{"version", "model", "serial", "mac", "ip", "id", "bytes", "uptime"}
return &unifiDevice{
Info: prometheus.NewDesc(ns+"info", "Device Information", append(labels, infoLabels...), nil),
Uptime: prometheus.NewDesc(ns+"uptime_seconds", "Device Uptime", labels, nil),
@@ -63,6 +64,7 @@ func (u *promUnifi) exportUDM(r report, d *unifi.UDM) {
if !d.Adopted.Val || d.Locating.Val {
return
}
labels := []string{d.Type, d.SiteName, d.Name}
infoLabels := []string{d.Version, d.Model, d.Serial, d.Mac, d.IP, d.ID, d.Bytes.Txt, d.Uptime.Txt}
// Shared data (all devices do this).
@@ -80,6 +82,7 @@ func (u *promUnifi) exportUDM(r report, d *unifi.UDM) {
{u.Device.Info, gauge, 1.0, append(labels, infoLabels...)},
{u.Device.Uptime, gauge, d.Uptime, labels},
})
// Wireless Data - UDM (non-pro) only
if d.Stat.Ap != nil && d.VapTable != nil {
u.exportUAPstats(r, labels, d.Stat.Ap, d.BytesD, d.TxBytesD, d.RxBytesD, d.BytesR)
@@ -103,6 +106,7 @@ func (u *promUnifi) exportSTAcount(r report, labels []string, stas ...unifi.Flex
{u.Device.Counter, gauge, stas[0], append(labels, "user")},
{u.Device.Counter, gauge, stas[1], append(labels, "guest")},
})
if len(stas) > 2 {
r.send([]*metric{
{u.Device.Counter, gauge, stas[2], append(labels, "desktop")},