diff --git a/go.mod b/go.mod index 6f10945e..9edc239d 100644 --- a/go.mod +++ b/go.mod @@ -35,7 +35,7 @@ require ( github.com/matttproud/golang_protobuf_extensions v1.0.4 // indirect github.com/prometheus/client_model v0.4.0 // indirect github.com/prometheus/procfs v0.10.1 // indirect - github.com/unpoller/unifi v0.3.4 + github.com/unpoller/unifi v0.3.5 golang.org/x/sys v0.10.0 // indirect google.golang.org/protobuf v1.30.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect diff --git a/go.sum b/go.sum index cc751a19..2c03ba49 100644 --- a/go.sum +++ b/go.sum @@ -75,8 +75,8 @@ github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UV github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA= github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk= -github.com/unpoller/unifi v0.3.4 h1:xFagB13HNFnvA3vdDwTg3mubq0LPl+0/qqMnKAki6QA= -github.com/unpoller/unifi v0.3.4/go.mod h1:Vea8cfAjs6vR8UbZm1AtiRk6AKxp01SxGdbdBTGkM1Y= +github.com/unpoller/unifi v0.3.5 h1:C1JSL05TnZoH64wwxRbjv+5iP+GnpQUXz0bZiSJgtt0= +github.com/unpoller/unifi v0.3.5/go.mod h1:Vea8cfAjs6vR8UbZm1AtiRk6AKxp01SxGdbdBTGkM1Y= github.com/valyala/bytebufferpool v1.0.0/go.mod h1:6bBcMArwyJ5K/AmCkWv1jt77kVWyCJ6HpOuEn7z0Csc= github.com/valyala/fasttemplate v1.0.1/go.mod h1:UQGH1tvbgY+Nz5t2n7tXsz52dQxojPUpymEIMZ47gx8= github.com/valyala/fasttemplate v1.2.1/go.mod h1:KHLXt3tVN2HBp8eijSv/kGJopbvo7S+qRAEEKiv+SiQ= diff --git a/pkg/datadogunifi/clients.go b/pkg/datadogunifi/clients.go index 5262886e..b1c671f9 100644 --- a/pkg/datadogunifi/clients.go +++ b/pkg/datadogunifi/clients.go @@ -42,28 +42,28 @@ func (u *DatadogUnifi) batchClient(r report, s *unifi.Client) { // nolint: funle powerSaveEnabled = 1.0 } data := map[string]float64{ - "anomalies": float64(s.Anomalies), + "anomalies": s.Anomalies.Val, "channel": s.Channel.Val, "satisfaction": s.Satisfaction.Val, - "bytes_r": float64(s.BytesR), - "ccq": float64(s.Ccq), - "noise": float64(s.Noise), + "bytes_r": s.BytesR.Val, + "ccq": s.Ccq.Val, + "noise": s.Noise.Val, "powersave_enabled": powerSaveEnabled, - "roam_count": float64(s.RoamCount), - "rssi": float64(s.Rssi), + "roam_count": s.RoamCount.Val, + "rssi": s.Rssi.Val, "rx_bytes": s.RxBytes.Val, "rx_bytes_r": s.RxBytesR.Val, "rx_packets": s.RxPackets.Val, - "rx_rate": float64(s.RxRate), - "signal": float64(s.Signal), + "rx_rate": s.RxRate.Val, + "signal": s.Signal.Val, "tx_bytes": s.TxBytes.Val, "tx_bytes_r": s.TxBytesR.Val, "tx_packets": s.TxPackets.Val, - "tx_retries": float64(s.TxRetries), + "tx_retries": s.TxRetries.Val, "tx_power": s.TxPower.Val, "tx_rate": s.TxRate.Val, - "uptime": float64(s.Uptime), - "wifi_tx_attempts": float64(s.WifiTxAttempts), + "uptime": s.Uptime.Val, + "wifi_tx_attempts": s.WifiTxAttempts.Val, "wired_rx_bytes": s.WiredRxBytes.Val, "wired_rx_bytes-r": s.WiredRxBytesR.Val, "wired_rx_packets": s.WiredRxPackets.Val, diff --git a/pkg/inputunifi/updateweb.go b/pkg/inputunifi/updateweb.go index 40b9872e..a6ae8c8d 100644 --- a/pkg/inputunifi/updateweb.go +++ b/pkg/inputunifi/updateweb.go @@ -100,8 +100,8 @@ func formatClients(c *Controller, clients []*unifi.Client) (d webserver.Clients) DeviceMAC: deviceMAC, Rx: client.RxBytes.Int64(), Tx: client.TxBytes.Int64(), - Since: time.Unix(client.FirstSeen, 0), - Last: time.Unix(client.LastSeen, 0), + Since: time.Unix(client.FirstSeen.Int64(), 0), + Last: time.Unix(client.LastSeen.Int64(), 0), }) } diff --git a/pkg/promunifi/clients.go b/pkg/promunifi/clients.go index 9ca0d5a6..4404d10d 100644 --- a/pkg/promunifi/clients.go +++ b/pkg/promunifi/clients.go @@ -126,7 +126,7 @@ func (u *promUnifi) exportClient(r report, c *unifi.Client) { r.send([]*metric{ {u.Client.Anomalies, counter, c.Anomalies, labelW}, - {u.Client.CCQ, gauge, float64(c.Ccq) / 1000.0, labelW}, + {u.Client.CCQ, gauge, c.Ccq.Val / 1000.0, labelW}, {u.Client.Satisfaction, gauge, c.Satisfaction.Val / 100.0, labelW}, {u.Client.Noise, gauge, c.Noise, labelW}, {u.Client.RoamCount, counter, c.RoamCount, labelW}, @@ -135,7 +135,7 @@ func (u *promUnifi) exportClient(r report, c *unifi.Client) { {u.Client.TxPower, gauge, c.TxPower, labelW}, {u.Client.TxRate, gauge, c.TxRate.Val * 1000, labelW}, {u.Client.WifiTxAttempts, counter, c.WifiTxAttempts, labelW}, - {u.Client.RxRate, gauge, c.RxRate * 1000, labelW}, + {u.Client.RxRate, gauge, c.RxRate.Val * 1000, labelW}, {u.Client.TxRetries, counter, c.TxRetries, labels}, {u.Client.TxBytes, counter, c.TxBytes, labels}, {u.Client.TxBytesR, gauge, c.TxBytesR, labels},