Merge pull request #693 from unpoller/unet-upgrade-8-1-113
catname on the IDS seems to sometimes be an array of strings
This commit is contained in:
		
						commit
						d3cc1400cd
					
				|  | @ -14,7 +14,7 @@ jobs: | |||
|   test: | ||||
|     strategy: | ||||
|       matrix: | ||||
|         go: ["1.20"] | ||||
|         go: ["stable"] | ||||
|         os: [ubuntu-latest, macos-latest, windows-latest] | ||||
|     runs-on: ${{ matrix.os }} | ||||
|     steps: | ||||
|  | @ -33,7 +33,7 @@ jobs: | |||
|   lint: | ||||
|     strategy: | ||||
|       matrix: | ||||
|         go: ["1.20"] | ||||
|         go: ["stable"] | ||||
|         os: [ubuntu-latest] | ||||
|     name: lint | ||||
|     runs-on: ${{ matrix.os }} | ||||
|  | @ -43,8 +43,9 @@ jobs: | |||
|         uses: actions/setup-go@v5 | ||||
|         with: | ||||
|           go-version: ${{ matrix.go }} | ||||
|           cache: false | ||||
|       - name: golangci-lint | ||||
|         uses: golangci/golangci-lint-action@v4 | ||||
|         with: | ||||
|           # Required: the version of golangci-lint is required and must be specified without patch version: we always use the latest patch version. | ||||
|           version: v1.53 | ||||
|           version: v1.54 | ||||
|  |  | |||
|  | @ -55,7 +55,7 @@ jobs: | |||
|         run: gem install package_cloud | ||||
|       - uses: actions/setup-go@v5 | ||||
|         with: | ||||
|           go-version: '>=1.20.5' | ||||
|           go-version: 'stable' | ||||
|           cache: true | ||||
|       # More assembly might be required: Docker logins, GPG, etc. It all depends | ||||
|       # on your needs. | ||||
|  |  | |||
							
								
								
									
										8
									
								
								go.mod
								
								
								
								
							
							
						
						
									
										8
									
								
								go.mod
								
								
								
								
							|  | @ -1,6 +1,8 @@ | |||
| module github.com/unpoller/unpoller | ||||
| 
 | ||||
| go 1.20 | ||||
| go 1.21 | ||||
| 
 | ||||
| toolchain go1.22.1 | ||||
| 
 | ||||
| require ( | ||||
| 	github.com/DataDog/datadog-go v4.8.3+incompatible | ||||
|  | @ -22,7 +24,7 @@ require ( | |||
| require ( | ||||
| 	github.com/Microsoft/go-winio v0.6.0 // indirect | ||||
| 	github.com/apapsch/go-jsonmerge/v2 v2.0.0 // indirect | ||||
| 	github.com/brianvoe/gofakeit/v6 v6.23.0 // indirect | ||||
| 	github.com/brianvoe/gofakeit/v6 v6.28.0 // indirect | ||||
| 	github.com/cespare/xxhash/v2 v2.2.0 // indirect | ||||
| 	github.com/davecgh/go-spew v1.1.1 // indirect | ||||
| 	github.com/google/uuid v1.3.1 // indirect | ||||
|  | @ -40,7 +42,7 @@ require ( | |||
| 	github.com/influxdata/influxdb-client-go/v2 v2.13.0 | ||||
| 	github.com/prometheus/client_model v0.5.0 // indirect | ||||
| 	github.com/prometheus/procfs v0.12.0 // indirect | ||||
| 	github.com/unpoller/unifi v0.3.15 | ||||
| 	github.com/unpoller/unifi v0.4.1 | ||||
| 	golang.org/x/sys v0.18.0 // indirect | ||||
| 	google.golang.org/protobuf v1.33.0 // indirect | ||||
| 	gopkg.in/yaml.v3 v3.0.1 | ||||
|  |  | |||
							
								
								
									
										14
									
								
								go.sum
								
								
								
								
							
							
						
						
									
										14
									
								
								go.sum
								
								
								
								
							|  | @ -10,8 +10,8 @@ github.com/apapsch/go-jsonmerge/v2 v2.0.0/go.mod h1:lvDnEdqiQrp0O42VQGgmlKpxL1AP | |||
| github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM= | ||||
| github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6rlkpw= | ||||
| github.com/bmatcuk/doublestar v1.1.1/go.mod h1:UD6OnuiIn0yFxxA2le/rnRU1G4RaI4UvFv1sNto9p6w= | ||||
| github.com/brianvoe/gofakeit/v6 v6.23.0 h1:pgVhyWpYq4e0GEVCh2gdZnS/nBX+8SnyTBliHg5xjks= | ||||
| github.com/brianvoe/gofakeit/v6 v6.23.0/go.mod h1:Ow6qC71xtwm79anlwKRlWZW6zVq9D2XHE4QSSMP/rU8= | ||||
| github.com/brianvoe/gofakeit/v6 v6.28.0 h1:Xib46XXuQfmlLS2EXRuJpqcw8St6qSZz75OUo0tgAW4= | ||||
| github.com/brianvoe/gofakeit/v6 v6.28.0/go.mod h1:Xj58BMSnFqcn/fAQeSK+/PLtC5kSb7FJIq4JyGa8vEs= | ||||
| github.com/cespare/xxhash/v2 v2.2.0 h1:DC2CZ1Ep5Y4k3ZQ899DldepgrayRUGE6BBZ/cd9Cj44= | ||||
| github.com/cespare/xxhash/v2 v2.2.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= | ||||
| github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= | ||||
|  | @ -19,6 +19,7 @@ github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSs | |||
| github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= | ||||
| github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= | ||||
| github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI= | ||||
| github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= | ||||
| github.com/google/uuid v1.3.1 h1:KjJaJ9iWZ3jOFZIf1Lqf4laDRCasjl0BCmnEGxkdLb4= | ||||
| github.com/google/uuid v1.3.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= | ||||
| github.com/gorilla/mux v1.8.1 h1:TuBL49tXwgrFYWhqrNgrUNEY92u81SPhu7sTdzQEiWY= | ||||
|  | @ -31,6 +32,7 @@ github.com/influxdata/line-protocol v0.0.0-20200327222509-2487e7298839 h1:W9WBk7 | |||
| github.com/influxdata/line-protocol v0.0.0-20200327222509-2487e7298839/go.mod h1:xaLFMmpvUxqXtVkUJfg9QmT88cDaCJ3ZKgdZ78oO8Qo= | ||||
| github.com/juju/gnuflag v0.0.0-20171113085948-2ce1bb71843d/go.mod h1:2PavIy+JPciBPrBUjwbNvtwB6RQlve+hkpll6QSNmOE= | ||||
| github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE= | ||||
| github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk= | ||||
| github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= | ||||
| github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= | ||||
| github.com/oapi-codegen/runtime v1.0.0 h1:P4rqFX5fMFWqRzY9M/3YF9+aPSPPB06IzP2P7oOxrWo= | ||||
|  | @ -48,16 +50,18 @@ github.com/prometheus/common v0.48.0/go.mod h1:0/KsvlIEfPQCQ5I2iNSAWKPZziNCvRs5E | |||
| github.com/prometheus/procfs v0.12.0 h1:jluTpSng7V9hY0O2R9DzzJHYb2xULk9VTR1V1R/k6Bo= | ||||
| github.com/prometheus/procfs v0.12.0/go.mod h1:pcuDEFsWDnvcgNzo4EEweacyhjeA9Zk3cnaOZAZEfOo= | ||||
| github.com/rogpeppe/go-internal v1.10.0 h1:TMyTOH3F/DB16zRVcYyreMH6GnZZrwQVAoYjRBZyWFQ= | ||||
| github.com/rogpeppe/go-internal v1.10.0/go.mod h1:UQnix2H7Ngw/k4C5ijL5+65zddjncjaFoBhdsK/akog= | ||||
| github.com/spf13/pflag v1.0.6-0.20201009195203-85dd5c8bc61c h1:zqmyTlQyufRC65JnImJ6H1Sf7BDj8bG31EV919NVEQc= | ||||
| github.com/spf13/pflag v1.0.6-0.20201009195203-85dd5c8bc61c/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= | ||||
| github.com/spkg/bom v0.0.0-20160624110644-59b7046e48ad/go.mod h1:qLr4V1qq6nMqFKkMo8ZTx3f+BZEkzsRUY10Xsm2mwU0= | ||||
| github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= | ||||
| github.com/stretchr/objx v0.5.2 h1:xuMeJ0Sdp5ZMRXx/aWO6RZxdr3beISkG5/G/aIRr3pY= | ||||
| github.com/stretchr/objx v0.5.2/go.mod h1:FRsXN1f5AsAjCGJKqEizvkpNtU+EGNCLh3NxZ/8L+MA= | ||||
| github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= | ||||
| github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg= | ||||
| github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= | ||||
| github.com/unpoller/unifi v0.3.15 h1:UsN1VhU1Ufy4VLGxQgE5Aq2GUhXgqzPLy2lgvKAEeyU= | ||||
| github.com/unpoller/unifi v0.3.15/go.mod h1:aubNKie2j5AcqW3G9m/th4G8SSULVgeDEr6gj4SVJzo= | ||||
| github.com/unpoller/unifi v0.4.1 h1:xqL62Z8Rz+fW4DIjafqKtoDRM2nOh09ZtImRFG3cfAk= | ||||
| github.com/unpoller/unifi v0.4.1/go.mod h1:ideaDhEllvH8j6sS1Xtjv6z38FXqLo9uG/3rmN4K1Bo= | ||||
| golang.org/x/crypto v0.21.0 h1:X31++rzVUdKhX5sWmSOFZxx8UW/ldWx55cbf08iNAMA= | ||||
| golang.org/x/crypto v0.21.0/go.mod h1:0BP7YvVV9gBbVKyeTG0Gyn+gZm94bibOW5BjDEYAOMs= | ||||
| golang.org/x/mod v0.7.0 h1:LapD9S96VoQRhi/GrNTqeBJFrUjs5UHCAtTlgwA5oZA= | ||||
|  | @ -65,6 +69,7 @@ golang.org/x/mod v0.7.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= | |||
| golang.org/x/net v0.22.0 h1:9sGLhx7iRIHEiX0oAJ3MRZMUCElJgy7Br1nO+AMN3Tc= | ||||
| golang.org/x/net v0.22.0/go.mod h1:JKghWKKOSdJwpW2GEx0Ja7fmaKnMsbu+MWVZTokSYmg= | ||||
| golang.org/x/sync v0.3.0 h1:ftCYgMx6zT/asHUrPw8BLLscYtGznsLAnjq5RH9P66E= | ||||
| golang.org/x/sync v0.3.0/go.mod h1:FU7BRWz2tNW+3quACPkgCx/L+uEAv1htQ0V83Z9Rj+Y= | ||||
| golang.org/x/sys v0.18.0 h1:DBdB3niSjOA/O0blCZBqDefyWNYveAYMNF1Wum0DYQ4= | ||||
| golang.org/x/sys v0.18.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= | ||||
| golang.org/x/term v0.18.0 h1:FcHjZXDMxI8mM3nwhX9HlKop4C0YQvCVCdwYl2wOtE8= | ||||
|  | @ -81,5 +86,6 @@ google.golang.org/protobuf v1.33.0 h1:uNO2rsAINq/JlFpSdYEKIZ0uKD/R9cpdv0T+yoGwGm | |||
| google.golang.org/protobuf v1.33.0/go.mod h1:c6P6GXX6sHbq/GpV6MGZEdwhWPcYBgnhAHhKbcUYpos= | ||||
| gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= | ||||
| gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= | ||||
| gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q= | ||||
| gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= | ||||
| gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= | ||||
|  |  | |||
|  | @ -54,7 +54,7 @@ func (u *DatadogUnifi) batchIDS(r report, i *unifi.IDS) { // nolint:dupl | |||
| 		"usg_ip":                i.USGIP, | ||||
| 		"proto":                 i.Proto, | ||||
| 		"key":                   i.Key, | ||||
| 		"catname":               i.Catname, | ||||
| 		"catname":               i.Catname.String(), | ||||
| 		"app_proto":             i.AppProto, | ||||
| 		"action":                i.InnerAlertAction, | ||||
| 	} | ||||
|  |  | |||
|  | @ -60,7 +60,7 @@ func (u *InfluxUnifi) batchIDS(r report, i *unifi.IDS) { // nolint:dupl | |||
| 			"usgip":      i.USGIP, | ||||
| 			"proto":      i.Proto, | ||||
| 			"key":        i.Key, | ||||
| 			"catname":    i.Catname, | ||||
| 			"catname":    i.Catname.String(), | ||||
| 			"app_proto":  i.AppProto, | ||||
| 			"action":     i.InnerAlertAction, | ||||
| 		}), | ||||
|  |  | |||
|  | @ -571,10 +571,10 @@ points: | |||
|       speedtest-status_xput_download: float | ||||
|       speedtest-status_xput_upload: float | ||||
|       state: float | ||||
|       storage_bar_pct: int | ||||
|       storage_bar_pct: float | ||||
|       storage_bar_size: float | ||||
|       storage_bar_used: float | ||||
|       storage_foo_pct: int | ||||
|       storage_foo_pct: float | ||||
|       storage_foo_size: float | ||||
|       storage_foo_used: float | ||||
|       system_uptime: float | ||||
|  |  | |||
|  | @ -71,7 +71,7 @@ func (u *InfluxUnifi) batchUDMstorage(storage []*unifi.Storage) map[string]any { | |||
| 		if t.Size.Val != 0 && t.Used.Val != 0 && t.Used.Val < t.Size.Val { | ||||
| 			output["storage_"+sanitizeName(t.Name)+"_pct"] = t.Used.Val / t.Size.Val * 100 //nolint:gomnd
 | ||||
| 		} else { | ||||
| 			output["storage_"+sanitizeName(t.Name)+"_pct"] = 0 | ||||
| 			output["storage_"+sanitizeName(t.Name)+"_pct"] = float64(0) | ||||
| 		} | ||||
| 	} | ||||
| 
 | ||||
|  |  | |||
|  | @ -24,7 +24,7 @@ func (r *Report) IDS(event *unifi.IDS, logs *Logs) { | |||
| 			"host":             event.Host, | ||||
| 			"site_name":        event.SiteName, | ||||
| 			"subsystem":        event.Subsystem, | ||||
| 			"category":         event.Catname, | ||||
| 			"category":         event.Catname.String(), | ||||
| 			"event_type":       event.EventType, | ||||
| 			"key":              event.Key, | ||||
| 			"app_protocol":     event.AppProto, | ||||
|  |  | |||
		Loading…
	
		Reference in New Issue