update unifi to v0.3.5, fix flexint conversions
This commit is contained in:
		
							parent
							
								
									b2ef926f9d
								
							
						
					
					
						commit
						0e4affbcd5
					
				
							
								
								
									
										2
									
								
								go.mod
								
								
								
								
							
							
						
						
									
										2
									
								
								go.mod
								
								
								
								
							|  | @ -35,7 +35,7 @@ require ( | ||||||
| 	github.com/matttproud/golang_protobuf_extensions v1.0.4 // indirect | 	github.com/matttproud/golang_protobuf_extensions v1.0.4 // indirect | ||||||
| 	github.com/prometheus/client_model v0.4.0 // indirect | 	github.com/prometheus/client_model v0.4.0 // indirect | ||||||
| 	github.com/prometheus/procfs v0.10.1 // 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 | 	golang.org/x/sys v0.10.0 // indirect | ||||||
| 	google.golang.org/protobuf v1.30.0 // indirect | 	google.golang.org/protobuf v1.30.0 // indirect | ||||||
| 	gopkg.in/yaml.v3 v3.0.1 // indirect | 	gopkg.in/yaml.v3 v3.0.1 // indirect | ||||||
|  |  | ||||||
							
								
								
									
										4
									
								
								go.sum
								
								
								
								
							
							
						
						
									
										4
									
								
								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.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.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA= | ||||||
| github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk= | 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.5 h1:C1JSL05TnZoH64wwxRbjv+5iP+GnpQUXz0bZiSJgtt0= | ||||||
| github.com/unpoller/unifi v0.3.4/go.mod h1:Vea8cfAjs6vR8UbZm1AtiRk6AKxp01SxGdbdBTGkM1Y= | 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/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.0.1/go.mod h1:UQGH1tvbgY+Nz5t2n7tXsz52dQxojPUpymEIMZ47gx8= | ||||||
| github.com/valyala/fasttemplate v1.2.1/go.mod h1:KHLXt3tVN2HBp8eijSv/kGJopbvo7S+qRAEEKiv+SiQ= | github.com/valyala/fasttemplate v1.2.1/go.mod h1:KHLXt3tVN2HBp8eijSv/kGJopbvo7S+qRAEEKiv+SiQ= | ||||||
|  |  | ||||||
|  | @ -42,28 +42,28 @@ func (u *DatadogUnifi) batchClient(r report, s *unifi.Client) { // nolint: funle | ||||||
| 		powerSaveEnabled = 1.0 | 		powerSaveEnabled = 1.0 | ||||||
| 	} | 	} | ||||||
| 	data := map[string]float64{ | 	data := map[string]float64{ | ||||||
| 		"anomalies":         float64(s.Anomalies), | 		"anomalies":         s.Anomalies.Val, | ||||||
| 		"channel":           s.Channel.Val, | 		"channel":           s.Channel.Val, | ||||||
| 		"satisfaction":      s.Satisfaction.Val, | 		"satisfaction":      s.Satisfaction.Val, | ||||||
| 		"bytes_r":           float64(s.BytesR), | 		"bytes_r":           s.BytesR.Val, | ||||||
| 		"ccq":               float64(s.Ccq), | 		"ccq":               s.Ccq.Val, | ||||||
| 		"noise":             float64(s.Noise), | 		"noise":             s.Noise.Val, | ||||||
| 		"powersave_enabled": powerSaveEnabled, | 		"powersave_enabled": powerSaveEnabled, | ||||||
| 		"roam_count":        float64(s.RoamCount), | 		"roam_count":        s.RoamCount.Val, | ||||||
| 		"rssi":              float64(s.Rssi), | 		"rssi":              s.Rssi.Val, | ||||||
| 		"rx_bytes":          s.RxBytes.Val, | 		"rx_bytes":          s.RxBytes.Val, | ||||||
| 		"rx_bytes_r":        s.RxBytesR.Val, | 		"rx_bytes_r":        s.RxBytesR.Val, | ||||||
| 		"rx_packets":        s.RxPackets.Val, | 		"rx_packets":        s.RxPackets.Val, | ||||||
| 		"rx_rate":           float64(s.RxRate), | 		"rx_rate":           s.RxRate.Val, | ||||||
| 		"signal":            float64(s.Signal), | 		"signal":            s.Signal.Val, | ||||||
| 		"tx_bytes":          s.TxBytes.Val, | 		"tx_bytes":          s.TxBytes.Val, | ||||||
| 		"tx_bytes_r":        s.TxBytesR.Val, | 		"tx_bytes_r":        s.TxBytesR.Val, | ||||||
| 		"tx_packets":        s.TxPackets.Val, | 		"tx_packets":        s.TxPackets.Val, | ||||||
| 		"tx_retries":        float64(s.TxRetries), | 		"tx_retries":        s.TxRetries.Val, | ||||||
| 		"tx_power":          s.TxPower.Val, | 		"tx_power":          s.TxPower.Val, | ||||||
| 		"tx_rate":           s.TxRate.Val, | 		"tx_rate":           s.TxRate.Val, | ||||||
| 		"uptime":            float64(s.Uptime), | 		"uptime":            s.Uptime.Val, | ||||||
| 		"wifi_tx_attempts":  float64(s.WifiTxAttempts), | 		"wifi_tx_attempts":  s.WifiTxAttempts.Val, | ||||||
| 		"wired_rx_bytes":    s.WiredRxBytes.Val, | 		"wired_rx_bytes":    s.WiredRxBytes.Val, | ||||||
| 		"wired_rx_bytes-r":  s.WiredRxBytesR.Val, | 		"wired_rx_bytes-r":  s.WiredRxBytesR.Val, | ||||||
| 		"wired_rx_packets":  s.WiredRxPackets.Val, | 		"wired_rx_packets":  s.WiredRxPackets.Val, | ||||||
|  |  | ||||||
|  | @ -100,8 +100,8 @@ func formatClients(c *Controller, clients []*unifi.Client) (d webserver.Clients) | ||||||
| 			DeviceMAC:  deviceMAC, | 			DeviceMAC:  deviceMAC, | ||||||
| 			Rx:         client.RxBytes.Int64(), | 			Rx:         client.RxBytes.Int64(), | ||||||
| 			Tx:         client.TxBytes.Int64(), | 			Tx:         client.TxBytes.Int64(), | ||||||
| 			Since:      time.Unix(client.FirstSeen, 0), | 			Since:      time.Unix(client.FirstSeen.Int64(), 0), | ||||||
| 			Last:       time.Unix(client.LastSeen, 0), | 			Last:       time.Unix(client.LastSeen.Int64(), 0), | ||||||
| 		}) | 		}) | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -126,7 +126,7 @@ func (u *promUnifi) exportClient(r report, c *unifi.Client) { | ||||||
| 
 | 
 | ||||||
| 		r.send([]*metric{ | 		r.send([]*metric{ | ||||||
| 			{u.Client.Anomalies, counter, c.Anomalies, labelW}, | 			{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.Satisfaction, gauge, c.Satisfaction.Val / 100.0, labelW}, | ||||||
| 			{u.Client.Noise, gauge, c.Noise, labelW}, | 			{u.Client.Noise, gauge, c.Noise, labelW}, | ||||||
| 			{u.Client.RoamCount, counter, c.RoamCount, 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.TxPower, gauge, c.TxPower, labelW}, | ||||||
| 			{u.Client.TxRate, gauge, c.TxRate.Val * 1000, labelW}, | 			{u.Client.TxRate, gauge, c.TxRate.Val * 1000, labelW}, | ||||||
| 			{u.Client.WifiTxAttempts, counter, c.WifiTxAttempts, 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.TxRetries, counter, c.TxRetries, labels}, | ||||||
| 			{u.Client.TxBytes, counter, c.TxBytes, labels}, | 			{u.Client.TxBytes, counter, c.TxBytes, labels}, | ||||||
| 			{u.Client.TxBytesR, gauge, c.TxBytesR, labels}, | 			{u.Client.TxBytesR, gauge, c.TxBytesR, labels}, | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue