Merge pull request #161 from unifi-poller/dn2_gomod
v2: Add gomod support
This commit is contained in:
		
						commit
						218802e3a9
					
				| 
						 | 
					@ -25,10 +25,8 @@ export BINARY GHUSER HBREPO MAINT VENDOR DESC GOLANGCI_LINT_ARGS CONFIG_FILE LIC
 | 
				
			||||||
# Fix the repo if it doesn't match the binary name.
 | 
					# Fix the repo if it doesn't match the binary name.
 | 
				
			||||||
# Provide a better URL if one exists.
 | 
					# Provide a better URL if one exists.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# Used as go import path in docker and homebrew builds.
 | 
					 | 
				
			||||||
IMPORT_PATH="github.com/${GHUSER}/${BINARY}"
 | 
					 | 
				
			||||||
# Used for source links and wiki links.
 | 
					# Used for source links and wiki links.
 | 
				
			||||||
SOURCE_URL="https://${IMPORT_PATH}"
 | 
					SOURCE_URL="https://github.com/${GHUSER}/${BINARY}"
 | 
				
			||||||
# Used for documentation links.
 | 
					# Used for documentation links.
 | 
				
			||||||
URL="${SOURCE_URL}"
 | 
					URL="${SOURCE_URL}"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -40,9 +38,7 @@ ITERATION=$(git rev-list --count --all || echo 0)
 | 
				
			||||||
DATE="$(date -u +%Y-%m-%dT%H:%M:%SZ)"
 | 
					DATE="$(date -u +%Y-%m-%dT%H:%M:%SZ)"
 | 
				
			||||||
COMMIT="$(git rev-parse --short HEAD || echo 0)"
 | 
					COMMIT="$(git rev-parse --short HEAD || echo 0)"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# Used by homebrew downloads.
 | 
					 | 
				
			||||||
#SOURCE_PATH=https://codeload.${IMPORT_PATH}/tar.gz/v${VERSION}
 | 
					 | 
				
			||||||
# This is a custom download path for homebrew formula.
 | 
					# This is a custom download path for homebrew formula.
 | 
				
			||||||
SOURCE_PATH=https://golift.io/${BINARY}/archive/v${VERSION}.tar.gz
 | 
					SOURCE_PATH=https://golift.io/${BINARY}/archive/v${VERSION}.tar.gz
 | 
				
			||||||
 | 
					
 | 
				
			||||||
export IMPORT_PATH SOURCE_URL URL VVERSION VERSION ITERATION DATE COMMIT SOURCE_PATH
 | 
					export SOURCE_URL URL VVERSION VERSION ITERATION DATE COMMIT SOURCE_PATH
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1,177 +0,0 @@
 | 
				
			||||||
# This file is autogenerated, do not edit; changes may be undone by the next 'dep ensure'.
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
[[projects]]
 | 
					 | 
				
			||||||
  digest = "1:9f3b30d9f8e0d7040f729b82dcbc8f0dead820a133b3147ce355fc451f32d761"
 | 
					 | 
				
			||||||
  name = "github.com/BurntSushi/toml"
 | 
					 | 
				
			||||||
  packages = ["."]
 | 
					 | 
				
			||||||
  pruneopts = "UT"
 | 
					 | 
				
			||||||
  revision = "3012a1dbe2e4bd1391d42b32f0577cb7bbc7f005"
 | 
					 | 
				
			||||||
  version = "v0.3.1"
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
[[projects]]
 | 
					 | 
				
			||||||
  digest = "1:d6afaeed1502aa28e80a4ed0981d570ad91b2579193404256ce672ed0a609e0d"
 | 
					 | 
				
			||||||
  name = "github.com/beorn7/perks"
 | 
					 | 
				
			||||||
  packages = ["quantile"]
 | 
					 | 
				
			||||||
  pruneopts = "UT"
 | 
					 | 
				
			||||||
  revision = "37c8de3658fcb183f997c4e13e8337516ab753e6"
 | 
					 | 
				
			||||||
  version = "v1.0.1"
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
[[projects]]
 | 
					 | 
				
			||||||
  digest = "1:ffe9824d294da03b391f44e1ae8281281b4afc1bdaa9588c9097785e3af10cec"
 | 
					 | 
				
			||||||
  name = "github.com/davecgh/go-spew"
 | 
					 | 
				
			||||||
  packages = ["spew"]
 | 
					 | 
				
			||||||
  pruneopts = "UT"
 | 
					 | 
				
			||||||
  revision = "8991bc29aa16c548c550c7ff78260e27b9ab7c73"
 | 
					 | 
				
			||||||
  version = "v1.1.1"
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
[[projects]]
 | 
					 | 
				
			||||||
  digest = "1:573ca21d3669500ff845bdebee890eb7fc7f0f50c59f2132f2a0c6b03d85086a"
 | 
					 | 
				
			||||||
  name = "github.com/golang/protobuf"
 | 
					 | 
				
			||||||
  packages = ["proto"]
 | 
					 | 
				
			||||||
  pruneopts = "UT"
 | 
					 | 
				
			||||||
  revision = "6c65a5562fc06764971b7c5d05c76c75e84bdbf7"
 | 
					 | 
				
			||||||
  version = "v1.3.2"
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
[[projects]]
 | 
					 | 
				
			||||||
  branch = "master"
 | 
					 | 
				
			||||||
  digest = "1:00e5ad58045d6d2a6c9e65d1809ff2594bc396e911712ae892a93976fdece115"
 | 
					 | 
				
			||||||
  name = "github.com/influxdata/influxdb1-client"
 | 
					 | 
				
			||||||
  packages = [
 | 
					 | 
				
			||||||
    "models",
 | 
					 | 
				
			||||||
    "pkg/escape",
 | 
					 | 
				
			||||||
    "v2",
 | 
					 | 
				
			||||||
  ]
 | 
					 | 
				
			||||||
  pruneopts = "UT"
 | 
					 | 
				
			||||||
  revision = "8bf82d3c094dc06be9da8e5bf9d3589b6ea032ae"
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
[[projects]]
 | 
					 | 
				
			||||||
  digest = "1:ff5ebae34cfbf047d505ee150de27e60570e8c394b3b8fdbb720ff6ac71985fc"
 | 
					 | 
				
			||||||
  name = "github.com/matttproud/golang_protobuf_extensions"
 | 
					 | 
				
			||||||
  packages = ["pbutil"]
 | 
					 | 
				
			||||||
  pruneopts = "UT"
 | 
					 | 
				
			||||||
  revision = "c12348ce28de40eed0136aa2b644d0ee0650e56c"
 | 
					 | 
				
			||||||
  version = "v1.0.1"
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
[[projects]]
 | 
					 | 
				
			||||||
  digest = "1:0028cb19b2e4c3112225cd871870f2d9cf49b9b4276531f03438a88e94be86fe"
 | 
					 | 
				
			||||||
  name = "github.com/pmezard/go-difflib"
 | 
					 | 
				
			||||||
  packages = ["difflib"]
 | 
					 | 
				
			||||||
  pruneopts = "UT"
 | 
					 | 
				
			||||||
  revision = "792786c7400a136282c1664665ae0a8db921c6c2"
 | 
					 | 
				
			||||||
  version = "v1.0.0"
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
[[projects]]
 | 
					 | 
				
			||||||
  digest = "1:eb04f69c8991e52eff33c428bd729e04208bf03235be88e4df0d88497c6861b9"
 | 
					 | 
				
			||||||
  name = "github.com/prometheus/client_golang"
 | 
					 | 
				
			||||||
  packages = [
 | 
					 | 
				
			||||||
    "prometheus",
 | 
					 | 
				
			||||||
    "prometheus/internal",
 | 
					 | 
				
			||||||
    "prometheus/promhttp",
 | 
					 | 
				
			||||||
  ]
 | 
					 | 
				
			||||||
  pruneopts = "UT"
 | 
					 | 
				
			||||||
  revision = "170205fb58decfd011f1550d4cfb737230d7ae4f"
 | 
					 | 
				
			||||||
  version = "v1.1.0"
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
[[projects]]
 | 
					 | 
				
			||||||
  digest = "1:982be0b5396e16a663697899ce69cc7b1e71ddcae4153af157578d4dc9bc3f88"
 | 
					 | 
				
			||||||
  name = "github.com/prometheus/client_model"
 | 
					 | 
				
			||||||
  packages = ["go"]
 | 
					 | 
				
			||||||
  pruneopts = "UT"
 | 
					 | 
				
			||||||
  revision = "d1d2010b5beead3fa1c5f271a5cf626e40b3ad6e"
 | 
					 | 
				
			||||||
  version = "v0.1.0"
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
[[projects]]
 | 
					 | 
				
			||||||
  digest = "1:7dec9ab2db741c280b89b142b08ea142824152c5f40fb1f90c35b6ef7a694456"
 | 
					 | 
				
			||||||
  name = "github.com/prometheus/common"
 | 
					 | 
				
			||||||
  packages = [
 | 
					 | 
				
			||||||
    "expfmt",
 | 
					 | 
				
			||||||
    "internal/bitbucket.org/ww/goautoneg",
 | 
					 | 
				
			||||||
    "model",
 | 
					 | 
				
			||||||
    "version",
 | 
					 | 
				
			||||||
  ]
 | 
					 | 
				
			||||||
  pruneopts = "UT"
 | 
					 | 
				
			||||||
  revision = "287d3e634a1e550c9e463dd7e5a75a422c614505"
 | 
					 | 
				
			||||||
  version = "v0.7.0"
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
[[projects]]
 | 
					 | 
				
			||||||
  digest = "1:ec0ff4bd619a67065e34d6477711ed0117e335f99059a4c508e0fe21cfe7b304"
 | 
					 | 
				
			||||||
  name = "github.com/prometheus/procfs"
 | 
					 | 
				
			||||||
  packages = [
 | 
					 | 
				
			||||||
    ".",
 | 
					 | 
				
			||||||
    "internal/fs",
 | 
					 | 
				
			||||||
    "internal/util",
 | 
					 | 
				
			||||||
  ]
 | 
					 | 
				
			||||||
  pruneopts = "UT"
 | 
					 | 
				
			||||||
  revision = "6d489fc7f1d9cd890a250f3ea3431b1744b9623f"
 | 
					 | 
				
			||||||
  version = "v0.0.8"
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
[[projects]]
 | 
					 | 
				
			||||||
  digest = "1:524b71991fc7d9246cc7dc2d9e0886ccb97648091c63e30eef619e6862c955dd"
 | 
					 | 
				
			||||||
  name = "github.com/spf13/pflag"
 | 
					 | 
				
			||||||
  packages = ["."]
 | 
					 | 
				
			||||||
  pruneopts = "UT"
 | 
					 | 
				
			||||||
  revision = "2e9d26c8c37aae03e3f9d4e90b7116f5accb7cab"
 | 
					 | 
				
			||||||
  version = "v1.0.5"
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
[[projects]]
 | 
					 | 
				
			||||||
  digest = "1:8548c309c65a85933a625be5e7d52b6ac927ca30c56869fae58123b8a77a75e1"
 | 
					 | 
				
			||||||
  name = "github.com/stretchr/testify"
 | 
					 | 
				
			||||||
  packages = ["assert"]
 | 
					 | 
				
			||||||
  pruneopts = "UT"
 | 
					 | 
				
			||||||
  revision = "221dbe5ed46703ee255b1da0dec05086f5035f62"
 | 
					 | 
				
			||||||
  version = "v1.4.0"
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
[[projects]]
 | 
					 | 
				
			||||||
  branch = "master"
 | 
					 | 
				
			||||||
  digest = "1:0ca5ac8aedc2fd9cb63c90acbd71c0cba8ddb61dfcca58b96cf41550689bf56d"
 | 
					 | 
				
			||||||
  name = "golang.org/x/sys"
 | 
					 | 
				
			||||||
  packages = ["windows"]
 | 
					 | 
				
			||||||
  pruneopts = "UT"
 | 
					 | 
				
			||||||
  revision = "c709ea063b76879dc9915358f55d4d77c16ab6d5"
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
[[projects]]
 | 
					 | 
				
			||||||
  branch = "master"
 | 
					 | 
				
			||||||
  digest = "1:89262a29b1c07290b1de8245b27ec0b8f24b1ca1205b1cd95e4a6b911caf11d7"
 | 
					 | 
				
			||||||
  name = "golift.io/cnfg"
 | 
					 | 
				
			||||||
  packages = [
 | 
					 | 
				
			||||||
    ".",
 | 
					 | 
				
			||||||
    "cnfgfile",
 | 
					 | 
				
			||||||
  ]
 | 
					 | 
				
			||||||
  pruneopts = "UT"
 | 
					 | 
				
			||||||
  revision = "bec8d8f51fc47101055ada9d952348522682ca16"
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
[[projects]]
 | 
					 | 
				
			||||||
  branch = "master"
 | 
					 | 
				
			||||||
  digest = "1:13b9e827c1f958ffe31554d57940495010eef89928697f6c6beae78a750ee637"
 | 
					 | 
				
			||||||
  name = "golift.io/unifi"
 | 
					 | 
				
			||||||
  packages = ["."]
 | 
					 | 
				
			||||||
  pruneopts = "UT"
 | 
					 | 
				
			||||||
  revision = "4d78625be4cd448ea2db35c63a40b451e7d0df99"
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
[[projects]]
 | 
					 | 
				
			||||||
  digest = "1:b75b3deb2bce8bc079e16bb2aecfe01eb80098f5650f9e93e5643ca8b7b73737"
 | 
					 | 
				
			||||||
  name = "gopkg.in/yaml.v2"
 | 
					 | 
				
			||||||
  packages = ["."]
 | 
					 | 
				
			||||||
  pruneopts = "UT"
 | 
					 | 
				
			||||||
  revision = "1f64d6156d11335c3f22d9330b0ad14fc1e789ce"
 | 
					 | 
				
			||||||
  version = "v2.2.7"
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
[solve-meta]
 | 
					 | 
				
			||||||
  analyzer-name = "dep"
 | 
					 | 
				
			||||||
  analyzer-version = 1
 | 
					 | 
				
			||||||
  input-imports = [
 | 
					 | 
				
			||||||
    "github.com/BurntSushi/toml",
 | 
					 | 
				
			||||||
    "github.com/influxdata/influxdb1-client/v2",
 | 
					 | 
				
			||||||
    "github.com/prometheus/client_golang/prometheus",
 | 
					 | 
				
			||||||
    "github.com/prometheus/client_golang/prometheus/promhttp",
 | 
					 | 
				
			||||||
    "github.com/prometheus/common/version",
 | 
					 | 
				
			||||||
    "github.com/spf13/pflag",
 | 
					 | 
				
			||||||
    "github.com/stretchr/testify/assert",
 | 
					 | 
				
			||||||
    "golift.io/cnfg",
 | 
					 | 
				
			||||||
    "golift.io/cnfg/cnfgfile",
 | 
					 | 
				
			||||||
    "golift.io/unifi",
 | 
					 | 
				
			||||||
    "gopkg.in/yaml.v2",
 | 
					 | 
				
			||||||
  ]
 | 
					 | 
				
			||||||
  solver-name = "gps-cdcl"
 | 
					 | 
				
			||||||
  solver-version = 1
 | 
					 | 
				
			||||||
							
								
								
									
										18
									
								
								Gopkg.toml
								
								
								
								
							
							
						
						
									
										18
									
								
								Gopkg.toml
								
								
								
								
							| 
						 | 
					@ -1,18 +0,0 @@
 | 
				
			||||||
# dep configuration file
 | 
					 | 
				
			||||||
#
 | 
					 | 
				
			||||||
# Refer to https://golang.github.io/dep/docs/Gopkg.toml.html
 | 
					 | 
				
			||||||
# for detailed Gopkg.toml documentation.
 | 
					 | 
				
			||||||
#
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
[prune]
 | 
					 | 
				
			||||||
  go-tests = true
 | 
					 | 
				
			||||||
  unused-packages = true
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
# TODO: remove this!!!
 | 
					 | 
				
			||||||
[[constraint]]
 | 
					 | 
				
			||||||
  name = "golift.io/unifi"
 | 
					 | 
				
			||||||
  branch = "master"
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
[[constraint]]
 | 
					 | 
				
			||||||
  name = "golift.io/cnfg"
 | 
					 | 
				
			||||||
  branch = "master"
 | 
					 | 
				
			||||||
							
								
								
									
										19
									
								
								Makefile
								
								
								
								
							
							
						
						
									
										19
									
								
								Makefile
								
								
								
								
							| 
						 | 
					@ -46,10 +46,10 @@ endef
 | 
				
			||||||
PLUGINS:=$(patsubst plugins/%/main.go,%,$(wildcard plugins/*/main.go))
 | 
					PLUGINS:=$(patsubst plugins/%/main.go,%,$(wildcard plugins/*/main.go))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
VERSION_LDFLAGS:= \
 | 
					VERSION_LDFLAGS:= \
 | 
				
			||||||
  -X $(IMPORT_PATH)/vendor/github.com/prometheus/common/version.Branch=$(TRAVIS_BRANCH) \
 | 
					  -X github.com/prometheus/common/version.Branch=$(TRAVIS_BRANCH) \
 | 
				
			||||||
  -X $(IMPORT_PATH)/vendor/github.com/prometheus/common/version.BuildDate=$(DATE) \
 | 
					  -X github.com/prometheus/common/version.BuildDate=$(DATE) \
 | 
				
			||||||
  -X $(IMPORT_PATH)/vendor/github.com/prometheus/common/version.Revision=$(COMMIT) \
 | 
					  -X github.com/prometheus/common/version.Revision=$(COMMIT) \
 | 
				
			||||||
  -X $(IMPORT_PATH)/vendor/github.com/prometheus/common/version.Version=$(VERSION)-$(ITERATION)
 | 
					  -X github.com/prometheus/common/version.Version=$(VERSION)-$(ITERATION)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# Makefile targets follow.
 | 
					# Makefile targets follow.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -231,7 +231,6 @@ docker:
 | 
				
			||||||
		--build-arg "VENDOR=$(VENDOR)" \
 | 
							--build-arg "VENDOR=$(VENDOR)" \
 | 
				
			||||||
		--build-arg "AUTHOR=$(MAINT)" \
 | 
							--build-arg "AUTHOR=$(MAINT)" \
 | 
				
			||||||
		--build-arg "BINARY=$(BINARY)" \
 | 
							--build-arg "BINARY=$(BINARY)" \
 | 
				
			||||||
		--build-arg "IMPORT_PATH=$(IMPORT_PATH)" \
 | 
					 | 
				
			||||||
		--build-arg "SOURCE_URL=$(SOURCE_URL)" \
 | 
							--build-arg "SOURCE_URL=$(SOURCE_URL)" \
 | 
				
			||||||
		--build-arg "CONFIG_FILE=$(CONFIG_FILE)" \
 | 
							--build-arg "CONFIG_FILE=$(CONFIG_FILE)" \
 | 
				
			||||||
		--tag $(BINARY) .
 | 
							--tag $(BINARY) .
 | 
				
			||||||
| 
						 | 
					@ -250,7 +249,6 @@ $(BINARY).rb: v$(VERSION).tar.gz.sha256 init/homebrew/$(FORMULA).rb.tmpl
 | 
				
			||||||
		-e "s/{{SHA256}}/$(shell head -c64 $<)/g" \
 | 
							-e "s/{{SHA256}}/$(shell head -c64 $<)/g" \
 | 
				
			||||||
		-e "s/{{Desc}}/$(DESC)/g" \
 | 
							-e "s/{{Desc}}/$(DESC)/g" \
 | 
				
			||||||
		-e "s%{{URL}}%$(URL)%g" \
 | 
							-e "s%{{URL}}%$(URL)%g" \
 | 
				
			||||||
		-e "s%{{IMPORT_PATH}}%$(IMPORT_PATH)%g" \
 | 
					 | 
				
			||||||
		-e "s%{{SOURCE_PATH}}%$(SOURCE_PATH)%g" \
 | 
							-e "s%{{SOURCE_PATH}}%$(SOURCE_PATH)%g" \
 | 
				
			||||||
		-e "s%{{SOURCE_URL}}%$(SOURCE_URL)%g" \
 | 
							-e "s%{{SOURCE_URL}}%$(SOURCE_URL)%g" \
 | 
				
			||||||
		-e "s%{{CONFIG_FILE}}%$(CONFIG_FILE)%g" \
 | 
							-e "s%{{CONFIG_FILE}}%$(CONFIG_FILE)%g" \
 | 
				
			||||||
| 
						 | 
					@ -283,12 +281,13 @@ lint:
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# This is safe; recommended even.
 | 
					# This is safe; recommended even.
 | 
				
			||||||
dep: vendor
 | 
					dep: vendor
 | 
				
			||||||
vendor: Gopkg.*
 | 
					vendor: go.mod go.sum
 | 
				
			||||||
	dep ensure --vendor-only
 | 
						go mod vendor
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# Don't run this unless you're ready to debug untested vendored dependencies.
 | 
					# Don't run this unless you're ready to debug untested vendored dependencies.
 | 
				
			||||||
deps:
 | 
					deps: update vendor
 | 
				
			||||||
	dep ensure --update
 | 
					update:
 | 
				
			||||||
 | 
						go get -u -d
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# Homebrew stuff. macOS only.
 | 
					# Homebrew stuff. macOS only.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -61,6 +61,7 @@
 | 
				
			||||||
  pass       = "unifipoller"
 | 
					  pass       = "unifipoller"
 | 
				
			||||||
  sites      = ["all"]
 | 
					  sites      = ["all"]
 | 
				
			||||||
  save_ids   = false
 | 
					  save_ids   = false
 | 
				
			||||||
 | 
					  save_dpi   = false
 | 
				
			||||||
  save_sites = true
 | 
					  save_sites = true
 | 
				
			||||||
  verify_ssl = false
 | 
					  verify_ssl = false
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -85,6 +86,14 @@
 | 
				
			||||||
  # Only useful if IDS or IPS are enabled on one of the sites.
 | 
					  # Only useful if IDS or IPS are enabled on one of the sites.
 | 
				
			||||||
  save_ids = false
 | 
					  save_ids = false
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  # Enable collection of Deep Packet Inspection data. This data breaks down traffic
 | 
				
			||||||
 | 
					  # types for each client and site, it powers a dedicated DPI dashboard.
 | 
				
			||||||
 | 
					  # Enabling this adds roughly 150 data points per client.  That's 6000 metrics for
 | 
				
			||||||
 | 
					  # 40 clients.  This adds a little bit of poller run time per interval and causes
 | 
				
			||||||
 | 
					  # more API requests to your controller(s). Don't let these "cons" sway you:
 | 
				
			||||||
 | 
					  # it's cool data. Please provide feedback on your experience with this feature.
 | 
				
			||||||
 | 
					  save_dpi = false
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  # Enable collection of site data. This data powers the Network Sites dashboard.
 | 
					  # Enable collection of site data. This data powers the Network Sites dashboard.
 | 
				
			||||||
  # It's not valuable to everyone and setting this to false will save resources.
 | 
					  # It's not valuable to everyone and setting this to false will save resources.
 | 
				
			||||||
  save_sites = true
 | 
					  save_sites = true
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -30,6 +30,7 @@
 | 
				
			||||||
      "url":       "https://127.0.0.1:8443",
 | 
					      "url":       "https://127.0.0.1:8443",
 | 
				
			||||||
      "sites":     ["all"],
 | 
					      "sites":     ["all"],
 | 
				
			||||||
      "save_ids":   false,
 | 
					      "save_ids":   false,
 | 
				
			||||||
 | 
					      "save_dpi":   false,
 | 
				
			||||||
      "save_sites": true,
 | 
					      "save_sites": true,
 | 
				
			||||||
      "verify_ssl": false
 | 
					      "verify_ssl": false
 | 
				
			||||||
    },
 | 
					    },
 | 
				
			||||||
| 
						 | 
					@ -40,6 +41,7 @@
 | 
				
			||||||
       "pass": "unifipoller",
 | 
					       "pass": "unifipoller",
 | 
				
			||||||
       "url": "https://127.0.0.1:8443",
 | 
					       "url": "https://127.0.0.1:8443",
 | 
				
			||||||
       "sites": ["all"],
 | 
					       "sites": ["all"],
 | 
				
			||||||
 | 
					       "save_dpi": false,
 | 
				
			||||||
       "save_ids": false,
 | 
					       "save_ids": false,
 | 
				
			||||||
       "save_sites": true,
 | 
					       "save_sites": true,
 | 
				
			||||||
       "verify_ssl": false
 | 
					       "verify_ssl": false
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -32,6 +32,7 @@
 | 
				
			||||||
      <url>https://127.0.0.1:8443</url>
 | 
					      <url>https://127.0.0.1:8443</url>
 | 
				
			||||||
      <verify_ssl>false</verify_ssl>
 | 
					      <verify_ssl>false</verify_ssl>
 | 
				
			||||||
      <save_ids>false</save_ids>
 | 
					      <save_ids>false</save_ids>
 | 
				
			||||||
 | 
					      <save_dpi>false</save_dpi>
 | 
				
			||||||
      <save_sites>true</save_sites>
 | 
					      <save_sites>true</save_sites>
 | 
				
			||||||
    </default>
 | 
					    </default>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -43,6 +44,7 @@
 | 
				
			||||||
      <url>https://127.0.0.1:8443</url>
 | 
					      <url>https://127.0.0.1:8443</url>
 | 
				
			||||||
      <verify_ssl>false</verify_ssl>
 | 
					      <verify_ssl>false</verify_ssl>
 | 
				
			||||||
      <save_ids>false</save_ids>
 | 
					      <save_ids>false</save_ids>
 | 
				
			||||||
 | 
					      <save_dpi>false</save_dpi>
 | 
				
			||||||
      <save_sites>true</save_sites>
 | 
					      <save_sites>true</save_sites>
 | 
				
			||||||
    </controller>
 | 
					    </controller>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -34,6 +34,7 @@ unifi:
 | 
				
			||||||
      - all
 | 
					      - all
 | 
				
			||||||
    verify_ssl: false
 | 
					    verify_ssl: false
 | 
				
			||||||
    save_ids:   false
 | 
					    save_ids:   false
 | 
				
			||||||
 | 
					    save_dpi:   false
 | 
				
			||||||
    save_sites: true
 | 
					    save_sites: true
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -42,9 +43,10 @@ unifi:
 | 
				
			||||||
    - role: ""
 | 
					    - role: ""
 | 
				
			||||||
      user: "unifipoller"
 | 
					      user: "unifipoller"
 | 
				
			||||||
      pass: "unifipoller"
 | 
					      pass: "unifipoller"
 | 
				
			||||||
      url: "https://127.0.0.1:8443"
 | 
					      url:  "https://127.0.0.1:8443"
 | 
				
			||||||
      sites:
 | 
					      sites:
 | 
				
			||||||
        - all
 | 
					        - all
 | 
				
			||||||
      verify_ssl: false
 | 
					      verify_ssl: false
 | 
				
			||||||
      save_ids: false
 | 
					      save_ids:   false
 | 
				
			||||||
 | 
					      save_dpi:   false
 | 
				
			||||||
      save_sites: true
 | 
					      save_sites: true
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -0,0 +1,13 @@
 | 
				
			||||||
 | 
					module github.com/davidnewhall/unifi-poller
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					go 1.13
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					require (
 | 
				
			||||||
 | 
						github.com/BurntSushi/toml v0.3.1 // indirect
 | 
				
			||||||
 | 
						github.com/influxdata/influxdb1-client v0.0.0-20191209144304-8bf82d3c094d
 | 
				
			||||||
 | 
						github.com/prometheus/client_golang v1.3.0
 | 
				
			||||||
 | 
						github.com/prometheus/common v0.7.0
 | 
				
			||||||
 | 
						github.com/spf13/pflag v1.0.5
 | 
				
			||||||
 | 
						golift.io/cnfg v0.0.5
 | 
				
			||||||
 | 
						golift.io/unifi v0.0.400
 | 
				
			||||||
 | 
					)
 | 
				
			||||||
| 
						 | 
					@ -0,0 +1,91 @@
 | 
				
			||||||
 | 
					github.com/BurntSushi/toml v0.3.1 h1:WXkYYl6Yr3qBf1K79EBnL4mak0OimBfB0XUf9Vl28OQ=
 | 
				
			||||||
 | 
					github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU=
 | 
				
			||||||
 | 
					github.com/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc=
 | 
				
			||||||
 | 
					github.com/alecthomas/template v0.0.0-20190718012654-fb15b899a751/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc=
 | 
				
			||||||
 | 
					github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0=
 | 
				
			||||||
 | 
					github.com/alecthomas/units v0.0.0-20190717042225-c3de453c63f4/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0=
 | 
				
			||||||
 | 
					github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973/go.mod h1:Dwedo/Wpr24TaqPxmxbtue+5NUziq4I4S80YR8gNf3Q=
 | 
				
			||||||
 | 
					github.com/beorn7/perks v1.0.0/go.mod h1:KWe93zE9D1o94FZ5RNwFwVgaQK1VOXiVxmqh+CedLV8=
 | 
				
			||||||
 | 
					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/cespare/xxhash/v2 v2.1.1 h1:6MnRN8NT7+YBpUIWxHtefFZOKTAPgGjpQSxqLNn0+qY=
 | 
				
			||||||
 | 
					github.com/cespare/xxhash/v2 v2.1.1/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs=
 | 
				
			||||||
 | 
					github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
 | 
				
			||||||
 | 
					github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
 | 
				
			||||||
 | 
					github.com/go-kit/kit v0.8.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as=
 | 
				
			||||||
 | 
					github.com/go-kit/kit v0.9.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as=
 | 
				
			||||||
 | 
					github.com/go-logfmt/logfmt v0.3.0/go.mod h1:Qt1PoO58o5twSAckw1HlFXLmHsOX5/0LbT9GBnD5lWE=
 | 
				
			||||||
 | 
					github.com/go-logfmt/logfmt v0.4.0/go.mod h1:3RMwSq7FuexP4Kalkev3ejPJsZTpXXBr9+V4qmtdjCk=
 | 
				
			||||||
 | 
					github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY=
 | 
				
			||||||
 | 
					github.com/gogo/protobuf v1.1.1/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ=
 | 
				
			||||||
 | 
					github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
 | 
				
			||||||
 | 
					github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
 | 
				
			||||||
 | 
					github.com/golang/protobuf v1.3.2 h1:6nsPYzhq5kReh6QImI3k5qWzO4PEbvbIW2cwSfR/6xs=
 | 
				
			||||||
 | 
					github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
 | 
				
			||||||
 | 
					github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU=
 | 
				
			||||||
 | 
					github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg=
 | 
				
			||||||
 | 
					github.com/influxdata/influxdb1-client v0.0.0-20191209144304-8bf82d3c094d h1:/WZQPMZNsjZ7IlCpsLGdQBINg5bxKQ1K1sh6awxLtkA=
 | 
				
			||||||
 | 
					github.com/influxdata/influxdb1-client v0.0.0-20191209144304-8bf82d3c094d/go.mod h1:qj24IKcXYK6Iy9ceXlo3Tc+vtHo9lIhSX5JddghvEPo=
 | 
				
			||||||
 | 
					github.com/json-iterator/go v1.1.6/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCVDaaPEHmU=
 | 
				
			||||||
 | 
					github.com/json-iterator/go v1.1.8/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4=
 | 
				
			||||||
 | 
					github.com/julienschmidt/httprouter v1.2.0/go.mod h1:SYymIcj16QtmaHHD7aYtjjsJG7VTCxuUUipMqKk8s4w=
 | 
				
			||||||
 | 
					github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ=
 | 
				
			||||||
 | 
					github.com/kr/logfmt v0.0.0-20140226030751-b84e30acd515/go.mod h1:+0opPa2QZZtGFBFZlji/RkVcI2GknAs/DXo4wKdlNEc=
 | 
				
			||||||
 | 
					github.com/matttproud/golang_protobuf_extensions v1.0.1 h1:4hp9jkHxhMHkqkrB3Ix0jegS5sx/RkqARlsWZ6pIwiU=
 | 
				
			||||||
 | 
					github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0=
 | 
				
			||||||
 | 
					github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q=
 | 
				
			||||||
 | 
					github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q=
 | 
				
			||||||
 | 
					github.com/modern-go/reflect2 v0.0.0-20180701023420-4b7aa43c6742/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0=
 | 
				
			||||||
 | 
					github.com/modern-go/reflect2 v1.0.1/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0=
 | 
				
			||||||
 | 
					github.com/mwitkow/go-conntrack v0.0.0-20161129095857-cc309e4a2223/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U=
 | 
				
			||||||
 | 
					github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
 | 
				
			||||||
 | 
					github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
 | 
				
			||||||
 | 
					github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
 | 
				
			||||||
 | 
					github.com/prometheus/client_golang v0.9.1/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw=
 | 
				
			||||||
 | 
					github.com/prometheus/client_golang v1.0.0/go.mod h1:db9x61etRT2tGnBNRi70OPL5FsnadC4Ky3P0J6CfImo=
 | 
				
			||||||
 | 
					github.com/prometheus/client_golang v1.3.0 h1:miYCvYqFXtl/J9FIy8eNpBfYthAEFg+Ys0XyUVEcDsc=
 | 
				
			||||||
 | 
					github.com/prometheus/client_golang v1.3.0/go.mod h1:hJaj2vgQTGQmVCsAACORcieXFeDPbaTKGT+JTgUa3og=
 | 
				
			||||||
 | 
					github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo=
 | 
				
			||||||
 | 
					github.com/prometheus/client_model v0.0.0-20190129233127-fd36f4220a90/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA=
 | 
				
			||||||
 | 
					github.com/prometheus/client_model v0.1.0 h1:ElTg5tNp4DqfV7UQjDqv2+RJlNzsDtvNAWccbItceIE=
 | 
				
			||||||
 | 
					github.com/prometheus/client_model v0.1.0/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA=
 | 
				
			||||||
 | 
					github.com/prometheus/common v0.4.1/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4=
 | 
				
			||||||
 | 
					github.com/prometheus/common v0.7.0 h1:L+1lyG48J1zAQXA3RBX/nG/B3gjlHq0zTt2tlbJLyCY=
 | 
				
			||||||
 | 
					github.com/prometheus/common v0.7.0/go.mod h1:DjGbpBbp5NYNiECxcL/VnbXCCaQpKd3tt26CguLLsqA=
 | 
				
			||||||
 | 
					github.com/prometheus/procfs v0.0.0-20181005140218-185b4288413d/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk=
 | 
				
			||||||
 | 
					github.com/prometheus/procfs v0.0.2/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsTZCD3I8kEA=
 | 
				
			||||||
 | 
					github.com/prometheus/procfs v0.0.8 h1:+fpWZdT24pJBiqJdAwYBjPSk+5YmQzYNPYzQsdzLkt8=
 | 
				
			||||||
 | 
					github.com/prometheus/procfs v0.0.8/go.mod h1:7Qr8sr6344vo1JqZ6HhLceV9o3AJ1Ff+GxbHq6oeK9A=
 | 
				
			||||||
 | 
					github.com/sirupsen/logrus v1.2.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo=
 | 
				
			||||||
 | 
					github.com/sirupsen/logrus v1.4.2/go.mod h1:tLMulIdttU9McNUspp0xgXVQah82FyeX6MwdIuYE2rE=
 | 
				
			||||||
 | 
					github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA=
 | 
				
			||||||
 | 
					github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg=
 | 
				
			||||||
 | 
					github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
 | 
				
			||||||
 | 
					github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
 | 
				
			||||||
 | 
					github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs=
 | 
				
			||||||
 | 
					github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
 | 
				
			||||||
 | 
					github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4=
 | 
				
			||||||
 | 
					golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4=
 | 
				
			||||||
 | 
					golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
 | 
				
			||||||
 | 
					golang.org/x/net v0.0.0-20181114220301-adae6a3d119a/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
 | 
				
			||||||
 | 
					golang.org/x/net v0.0.0-20190613194153-d28f0bde5980/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
 | 
				
			||||||
 | 
					golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
 | 
				
			||||||
 | 
					golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
 | 
				
			||||||
 | 
					golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
 | 
				
			||||||
 | 
					golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
 | 
				
			||||||
 | 
					golang.org/x/sys v0.0.0-20181116152217-5ac8a444bdc5/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
 | 
				
			||||||
 | 
					golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
 | 
				
			||||||
 | 
					golang.org/x/sys v0.0.0-20190422165155-953cdadca894/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
 | 
				
			||||||
 | 
					golang.org/x/sys v0.0.0-20191220142924-d4481acd189f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
 | 
				
			||||||
 | 
					golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
 | 
				
			||||||
 | 
					golift.io/cnfg v0.0.5 h1:HnMU8Z9C/igKvir1dqaHx5BPuNGZrp99FCtdJyP2Z4I=
 | 
				
			||||||
 | 
					golift.io/cnfg v0.0.5/go.mod h1:ScFDIJg/rJGHbRaed/i7g1lBhywEjB0JiP2uZr3xC3A=
 | 
				
			||||||
 | 
					golift.io/unifi v0.0.400 h1:r8FlE+p+zmm8jnQdT367H2aGVMTgxZTrHSwbsHBcayA=
 | 
				
			||||||
 | 
					golift.io/unifi v0.0.400/go.mod h1:4BjegFlwA3am3mPlY0qHAnSKli4eexLQV42QKaRx9OY=
 | 
				
			||||||
 | 
					golift.io/unifi v4.1.6+incompatible h1:Yhb/+obX2vT9i6PElGislSuQ1WUtOf+l+sRjVxlY6nM=
 | 
				
			||||||
 | 
					golift.io/unifi v4.1.6+incompatible/go.mod h1:Zjw57ZAzTzCMw784pE8CdCFgkYSzVZzmJ++WUttbjto=
 | 
				
			||||||
 | 
					gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw=
 | 
				
			||||||
 | 
					gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
 | 
				
			||||||
 | 
					gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
 | 
				
			||||||
 | 
					gopkg.in/yaml.v2 v2.2.2 h1:ZCJp+EgiOT7lHqUV2J862kp8Qj64Jo6az82+3Td9dZw=
 | 
				
			||||||
 | 
					gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
 | 
				
			||||||
| 
						 | 
					@ -9,23 +9,17 @@ ARG BUILD_DATE=0
 | 
				
			||||||
ARG COMMIT=0
 | 
					ARG COMMIT=0
 | 
				
			||||||
ARG VERSION=unknown
 | 
					ARG VERSION=unknown
 | 
				
			||||||
ARG BINARY=application-builder
 | 
					ARG BINARY=application-builder
 | 
				
			||||||
ARG IMPORT_PATH=github.com/golift/application-builder
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
FROM golang:stretch as builder
 | 
					FROM golang:stretch as builder
 | 
				
			||||||
ARG ARCH
 | 
					ARG ARCH
 | 
				
			||||||
ARG OS
 | 
					ARG OS
 | 
				
			||||||
ARG BINARY
 | 
					ARG BINARY
 | 
				
			||||||
ARG IMPORT_PATH
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
RUN mkdir -p $GOPATH/pkg/mod $GOPATH/bin $GOPATH/src/${IMPORT_PATH}
 | 
					RUN mkdir -p $GOPATH/pkg/mod $GOPATH/bin $GOPATH/src /${BINARY}
 | 
				
			||||||
RUN apt-get update \
 | 
					COPY . /${BINARY}
 | 
				
			||||||
  && apt-get install -y curl  \
 | 
					WORKDIR /${BINARY}
 | 
				
			||||||
  && curl https://raw.githubusercontent.com/golang/dep/master/install.sh | sh
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
COPY . $GOPATH/src/${IMPORT_PATH}
 | 
					RUN go mod vendor \
 | 
				
			||||||
WORKDIR $GOPATH/src/${IMPORT_PATH}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
RUN dep ensure --vendor-only \
 | 
					 | 
				
			||||||
  && CGO_ENABLED=0 make ${BINARY}.${ARCH}.${OS}
 | 
					  && CGO_ENABLED=0 make ${BINARY}.${ARCH}.${OS}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
FROM scratch
 | 
					FROM scratch
 | 
				
			||||||
| 
						 | 
					@ -36,7 +30,6 @@ ARG COMMIT
 | 
				
			||||||
ARG VERSION
 | 
					ARG VERSION
 | 
				
			||||||
ARG LICENSE=MIT
 | 
					ARG LICENSE=MIT
 | 
				
			||||||
ARG BINARY
 | 
					ARG BINARY
 | 
				
			||||||
ARG IMPORT_PATH
 | 
					 | 
				
			||||||
ARG SOURCE_URL=http://github.com/golift/application-builder
 | 
					ARG SOURCE_URL=http://github.com/golift/application-builder
 | 
				
			||||||
ARG URL=http://github.com/golift/application-builder
 | 
					ARG URL=http://github.com/golift/application-builder
 | 
				
			||||||
ARG DESC=application-builder
 | 
					ARG DESC=application-builder
 | 
				
			||||||
| 
						 | 
					@ -58,8 +51,8 @@ LABEL org.opencontainers.image.created="${BUILD_DATE}" \
 | 
				
			||||||
      org.opencontainers.image.licenses="${LICENSE}" \
 | 
					      org.opencontainers.image.licenses="${LICENSE}" \
 | 
				
			||||||
      org.opencontainers.image.version="${VERSION}"
 | 
					      org.opencontainers.image.version="${VERSION}"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
COPY --from=builder /go/src/${IMPORT_PATH}/${BINARY}.${ARCH}.${OS} /image
 | 
					COPY --from=builder /${BINARY}/${BINARY}.${ARCH}.${OS} /image
 | 
				
			||||||
COPY --from=builder /go/src/${IMPORT_PATH}/examples/${CONFIG_FILE}.example /etc/${BINARY}/${CONFIG_FILE}
 | 
					COPY --from=builder /${BINARY}/examples/${CONFIG_FILE}.example /etc/${BINARY}/${CONFIG_FILE}
 | 
				
			||||||
COPY --from=builder /etc/ssl /etc/ssl
 | 
					COPY --from=builder /etc/ssl /etc/ssl
 | 
				
			||||||
 | 
					
 | 
				
			||||||
VOLUME [ "/etc/${BINARY}" ]
 | 
					VOLUME [ "/etc/${BINARY}" ]
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -28,7 +28,6 @@ for build in $BUILDS; do
 | 
				
			||||||
    --build-arg "VENDOR=${VENDOR}" \
 | 
					    --build-arg "VENDOR=${VENDOR}" \
 | 
				
			||||||
    --build-arg "AUTHOR=${MAINT}" \
 | 
					    --build-arg "AUTHOR=${MAINT}" \
 | 
				
			||||||
    --build-arg "BINARY=${BINARY}" \
 | 
					    --build-arg "BINARY=${BINARY}" \
 | 
				
			||||||
    --build-arg "IMPORT_PATH=${IMPORT_PATH}" \
 | 
					 | 
				
			||||||
    --build-arg "SOURCE_URL=${SOURCE_URL}" \
 | 
					    --build-arg "SOURCE_URL=${SOURCE_URL}" \
 | 
				
			||||||
    --build-arg "CONFIG_FILE=${CONFIG_FILE}" \
 | 
					    --build-arg "CONFIG_FILE=${CONFIG_FILE}" \
 | 
				
			||||||
    --tag "${IMAGE_NAME}_${os}_${name}" \
 | 
					    --tag "${IMAGE_NAME}_${os}_${name}" \
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1,7 +1,6 @@
 | 
				
			||||||
# Homebrew Formula Template. Built by Makefile: `make fomula`
 | 
					# Homebrew Formula Template. Built by Makefile: `make fomula`
 | 
				
			||||||
# This is part of Application Builder.
 | 
					# This is part of Application Builder.
 | 
				
			||||||
# https://github.com/golift/application-builder
 | 
					# https://github.com/golift/application-builder
 | 
				
			||||||
# This file is used when FORMULA is set to 'service'.
 | 
					 | 
				
			||||||
class {{Class}} < Formula
 | 
					class {{Class}} < Formula
 | 
				
			||||||
  desc "{{Desc}}"
 | 
					  desc "{{Desc}}"
 | 
				
			||||||
  homepage "{{URL}}"
 | 
					  homepage "{{URL}}"
 | 
				
			||||||
| 
						 | 
					@ -13,14 +12,11 @@ class {{Class}} < Formula
 | 
				
			||||||
  depends_on "dep"
 | 
					  depends_on "dep"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  def install
 | 
					  def install
 | 
				
			||||||
    ENV["GOPATH"] = buildpath
 | 
					    bin_path = buildpath/"#{name}"
 | 
				
			||||||
 | 
					    # Copy all files from their current location to buildpath/#{name}
 | 
				
			||||||
    bin_path = buildpath/"src/{{IMPORT_PATH}}"
 | 
					 | 
				
			||||||
    # Copy all files from their current location (GOPATH root)
 | 
					 | 
				
			||||||
    # to $GOPATH/src/{{IMPORT_PATH}}
 | 
					 | 
				
			||||||
    bin_path.install Dir["*",".??*"]
 | 
					    bin_path.install Dir["*",".??*"]
 | 
				
			||||||
    cd bin_path do
 | 
					    cd bin_path do
 | 
				
			||||||
      system "dep", "ensure", "--vendor-only"
 | 
					      system "make" "vendor"
 | 
				
			||||||
      system "make", "install", "VERSION=#{version}", "ITERATION={{Iter}}", "PREFIX=#{prefix}", "ETC=#{etc}"
 | 
					      system "make", "install", "VERSION=#{version}", "ITERATION={{Iter}}", "PREFIX=#{prefix}", "ETC=#{etc}"
 | 
				
			||||||
      # If this fails, the user gets a nice big warning about write permissions on their
 | 
					      # If this fails, the user gets a nice big warning about write permissions on their
 | 
				
			||||||
      # #{var}/log folder. The alternative could be letting the app silently fail
 | 
					      # #{var}/log folder. The alternative could be letting the app silently fail
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -71,3 +71,25 @@ func (u *InfluxUnifi) batchClient(r report, s *unifi.Client) {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	r.send(&metric{Table: "clients", Tags: tags, Fields: fields})
 | 
						r.send(&metric{Table: "clients", Tags: tags, Fields: fields})
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					func (u *InfluxUnifi) batchClientDPI(r report, s *unifi.DPITable) {
 | 
				
			||||||
 | 
						for _, dpi := range s.ByApp {
 | 
				
			||||||
 | 
							r.send(&metric{
 | 
				
			||||||
 | 
								Table: "clientdpi",
 | 
				
			||||||
 | 
								Tags: map[string]string{
 | 
				
			||||||
 | 
									"category":    unifi.DPICats.Get(dpi.Cat),
 | 
				
			||||||
 | 
									"application": unifi.DPIApps.GetApp(dpi.Cat, dpi.App),
 | 
				
			||||||
 | 
									"name":        s.Name,
 | 
				
			||||||
 | 
									"mac":         s.MAC,
 | 
				
			||||||
 | 
									"site_name":   s.SiteName,
 | 
				
			||||||
 | 
									"source":      s.SourceName,
 | 
				
			||||||
 | 
								},
 | 
				
			||||||
 | 
								Fields: map[string]interface{}{
 | 
				
			||||||
 | 
									"tx_packets": dpi.TxPackets,
 | 
				
			||||||
 | 
									"rx_packets": dpi.RxPackets,
 | 
				
			||||||
 | 
									"tx_bytes":   dpi.TxBytes,
 | 
				
			||||||
 | 
									"rx_bytes":   dpi.RxBytes,
 | 
				
			||||||
 | 
								}},
 | 
				
			||||||
 | 
							)
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -194,6 +194,16 @@ func (u *InfluxUnifi) loopPoints(r report) {
 | 
				
			||||||
	r.add()
 | 
						r.add()
 | 
				
			||||||
	r.add()
 | 
						r.add()
 | 
				
			||||||
	r.add()
 | 
						r.add()
 | 
				
			||||||
 | 
						r.add()
 | 
				
			||||||
 | 
						r.add()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						go func() {
 | 
				
			||||||
 | 
							defer r.done()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							for _, s := range m.SitesDPI {
 | 
				
			||||||
 | 
								u.batchSiteDPI(r, s)
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
						}()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	go func() {
 | 
						go func() {
 | 
				
			||||||
		defer r.done()
 | 
							defer r.done()
 | 
				
			||||||
| 
						 | 
					@ -203,6 +213,14 @@ func (u *InfluxUnifi) loopPoints(r report) {
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
	}()
 | 
						}()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						go func() {
 | 
				
			||||||
 | 
							defer r.done()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							for _, s := range m.ClientsDPI {
 | 
				
			||||||
 | 
								u.batchClientDPI(r, s)
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
						}()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	go func() {
 | 
						go func() {
 | 
				
			||||||
		defer r.done()
 | 
							defer r.done()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -219,15 +237,14 @@ func (u *InfluxUnifi) loopPoints(r report) {
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
	}()
 | 
						}()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if m.Devices == nil {
 | 
					 | 
				
			||||||
		return
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	u.loopDevicePoints(r)
 | 
						u.loopDevicePoints(r)
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
func (u *InfluxUnifi) loopDevicePoints(r report) {
 | 
					func (u *InfluxUnifi) loopDevicePoints(r report) {
 | 
				
			||||||
	m := r.metrics()
 | 
						m := r.metrics()
 | 
				
			||||||
 | 
						if m.Devices == nil {
 | 
				
			||||||
 | 
							return
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	r.add()
 | 
						r.add()
 | 
				
			||||||
	r.add()
 | 
						r.add()
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -56,3 +56,23 @@ func (u *InfluxUnifi) batchSite(r report, s *unifi.Site) {
 | 
				
			||||||
		r.send(&metric{Table: "subsystems", Tags: tags, Fields: fields})
 | 
							r.send(&metric{Table: "subsystems", Tags: tags, Fields: fields})
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					func (u *InfluxUnifi) batchSiteDPI(r report, s *unifi.DPITable) {
 | 
				
			||||||
 | 
						for _, dpi := range s.ByApp {
 | 
				
			||||||
 | 
							r.send(&metric{
 | 
				
			||||||
 | 
								Table: "sitedpi",
 | 
				
			||||||
 | 
								Tags: map[string]string{
 | 
				
			||||||
 | 
									"category":    unifi.DPICats.Get(dpi.Cat),
 | 
				
			||||||
 | 
									"application": unifi.DPIApps.GetApp(dpi.Cat, dpi.App),
 | 
				
			||||||
 | 
									"site_name":   s.SiteName,
 | 
				
			||||||
 | 
									"source":      s.SourceName,
 | 
				
			||||||
 | 
								},
 | 
				
			||||||
 | 
								Fields: map[string]interface{}{
 | 
				
			||||||
 | 
									"tx_packets": dpi.TxPackets,
 | 
				
			||||||
 | 
									"rx_packets": dpi.RxPackets,
 | 
				
			||||||
 | 
									"tx_bytes":   dpi.TxBytes,
 | 
				
			||||||
 | 
									"rx_bytes":   dpi.RxBytes,
 | 
				
			||||||
 | 
								}},
 | 
				
			||||||
 | 
							)
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -80,6 +80,16 @@ func (u *InputUnifi) pollController(c *Controller) (*poller.Metrics, error) {
 | 
				
			||||||
		return m, fmt.Errorf("unifi.GetSites(%v): %v", c.URL, err)
 | 
							return m, fmt.Errorf("unifi.GetSites(%v): %v", c.URL, err)
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						if c.SaveDPI {
 | 
				
			||||||
 | 
							if m.SitesDPI, err = c.Unifi.GetSiteDPI(m.Sites); err != nil {
 | 
				
			||||||
 | 
								return m, fmt.Errorf("unifi.GetSiteDPI(%v): %v", c.URL, err)
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							if m.ClientsDPI, err = c.Unifi.GetClientsDPI(m.Sites); err != nil {
 | 
				
			||||||
 | 
								return m, fmt.Errorf("unifi.GetClientsDPI(%v): %v", c.URL, err)
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if c.SaveIDS {
 | 
						if c.SaveIDS {
 | 
				
			||||||
		m.IDSList, err = c.Unifi.GetIDS(m.Sites, time.Now().Add(2*time.Minute), time.Now())
 | 
							m.IDSList, err = c.Unifi.GetIDS(m.Sites, time.Now().Add(2*time.Minute), time.Now())
 | 
				
			||||||
		if err != nil {
 | 
							if err != nil {
 | 
				
			||||||
| 
						 | 
					@ -132,12 +142,24 @@ func (u *InputUnifi) augmentMetrics(c *Controller, metrics *poller.Metrics) *pol
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	// These come blank, so set them here.
 | 
						// These come blank, so set them here.
 | 
				
			||||||
	for i, c := range metrics.Clients {
 | 
						for i, c := range metrics.Clients {
 | 
				
			||||||
 | 
							if devices[c.Mac] = c.Name; c.Name == "" {
 | 
				
			||||||
 | 
								devices[c.Mac] = c.Hostname
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		metrics.Clients[i].SwName = devices[c.SwMac]
 | 
							metrics.Clients[i].SwName = devices[c.SwMac]
 | 
				
			||||||
		metrics.Clients[i].ApName = devices[c.ApMac]
 | 
							metrics.Clients[i].ApName = devices[c.ApMac]
 | 
				
			||||||
		metrics.Clients[i].GwName = devices[c.GwMac]
 | 
							metrics.Clients[i].GwName = devices[c.GwMac]
 | 
				
			||||||
		metrics.Clients[i].RadioDescription = bssdIDs[metrics.Clients[i].Bssid] + metrics.Clients[i].RadioProto
 | 
							metrics.Clients[i].RadioDescription = bssdIDs[metrics.Clients[i].Bssid] + metrics.Clients[i].RadioProto
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						for i := range metrics.ClientsDPI {
 | 
				
			||||||
 | 
							// Name on Client DPI data also comes blank, find it based on MAC address.
 | 
				
			||||||
 | 
							metrics.ClientsDPI[i].Name = devices[metrics.ClientsDPI[i].MAC]
 | 
				
			||||||
 | 
							if metrics.ClientsDPI[i].Name == "" {
 | 
				
			||||||
 | 
								metrics.ClientsDPI[i].Name = metrics.ClientsDPI[i].MAC
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if !*c.SaveSites {
 | 
						if !*c.SaveSites {
 | 
				
			||||||
		metrics.Sites = nil
 | 
							metrics.Sites = nil
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -33,6 +33,7 @@ type InputUnifi struct {
 | 
				
			||||||
type Controller struct {
 | 
					type Controller struct {
 | 
				
			||||||
	VerifySSL bool         `json:"verify_ssl" toml:"verify_ssl" xml:"verify_ssl" yaml:"verify_ssl"`
 | 
						VerifySSL bool         `json:"verify_ssl" toml:"verify_ssl" xml:"verify_ssl" yaml:"verify_ssl"`
 | 
				
			||||||
	SaveIDS   bool         `json:"save_ids" toml:"save_ids" xml:"save_ids" yaml:"save_ids"`
 | 
						SaveIDS   bool         `json:"save_ids" toml:"save_ids" xml:"save_ids" yaml:"save_ids"`
 | 
				
			||||||
 | 
						SaveDPI   bool         `json:"save_dpi" toml:"save_dpi" xml:"save_dpi" yaml:"save_dpi"`
 | 
				
			||||||
	SaveSites *bool        `json:"save_sites" toml:"save_sites" xml:"save_sites" yaml:"save_sites"`
 | 
						SaveSites *bool        `json:"save_sites" toml:"save_sites" xml:"save_sites" yaml:"save_sites"`
 | 
				
			||||||
	Role      string       `json:"role" toml:"role" xml:"role,attr" yaml:"role"`
 | 
						Role      string       `json:"role" toml:"role" xml:"role,attr" yaml:"role"`
 | 
				
			||||||
	User      string       `json:"user" toml:"user" xml:"user" yaml:"user"`
 | 
						User      string       `json:"user" toml:"user" xml:"user" yaml:"user"`
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -49,6 +49,8 @@ type Metrics struct {
 | 
				
			||||||
	unifi.IDSList
 | 
						unifi.IDSList
 | 
				
			||||||
	unifi.Clients
 | 
						unifi.Clients
 | 
				
			||||||
	*unifi.Devices
 | 
						*unifi.Devices
 | 
				
			||||||
 | 
						SitesDPI   []*unifi.DPITable
 | 
				
			||||||
 | 
						ClientsDPI []*unifi.DPITable
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// Config represents the core library input data.
 | 
					// Config represents the core library input data.
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -95,23 +95,7 @@ func (u *UnifiPoller) Metrics() (*Metrics, bool, error) {
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		ok = true
 | 
							ok = true
 | 
				
			||||||
 | 
							metrics = AppendMetrics(metrics, m)
 | 
				
			||||||
		metrics.Sites = append(metrics.Sites, m.Sites...)
 | 
					 | 
				
			||||||
		metrics.Clients = append(metrics.Clients, m.Clients...)
 | 
					 | 
				
			||||||
		metrics.IDSList = append(metrics.IDSList, m.IDSList...)
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
		if m.Devices == nil {
 | 
					 | 
				
			||||||
			continue
 | 
					 | 
				
			||||||
		}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
		if metrics.Devices == nil {
 | 
					 | 
				
			||||||
			metrics.Devices = &unifi.Devices{}
 | 
					 | 
				
			||||||
		}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
		metrics.UAPs = append(metrics.UAPs, m.UAPs...)
 | 
					 | 
				
			||||||
		metrics.USGs = append(metrics.USGs, m.USGs...)
 | 
					 | 
				
			||||||
		metrics.USWs = append(metrics.USWs, m.USWs...)
 | 
					 | 
				
			||||||
		metrics.UDMs = append(metrics.UDMs, m.UDMs...)
 | 
					 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	var err error
 | 
						var err error
 | 
				
			||||||
| 
						 | 
					@ -158,7 +142,9 @@ func (u *UnifiPoller) MetricsFrom(filter *Filter) (*Metrics, bool, error) {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// AppendMetrics combined the metrics from two sources.
 | 
					// AppendMetrics combined the metrics from two sources.
 | 
				
			||||||
func AppendMetrics(existing *Metrics, m *Metrics) *Metrics {
 | 
					func AppendMetrics(existing *Metrics, m *Metrics) *Metrics {
 | 
				
			||||||
 | 
						existing.SitesDPI = append(existing.SitesDPI, m.SitesDPI...)
 | 
				
			||||||
	existing.Sites = append(existing.Sites, m.Sites...)
 | 
						existing.Sites = append(existing.Sites, m.Sites...)
 | 
				
			||||||
 | 
						existing.ClientsDPI = append(existing.ClientsDPI, m.ClientsDPI...)
 | 
				
			||||||
	existing.Clients = append(existing.Clients, m.Clients...)
 | 
						existing.Clients = append(existing.Clients, m.Clients...)
 | 
				
			||||||
	existing.IDSList = append(existing.IDSList, m.IDSList...)
 | 
						existing.IDSList = append(existing.IDSList, m.IDSList...)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -6,44 +6,43 @@ import (
 | 
				
			||||||
)
 | 
					)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
type uclient struct {
 | 
					type uclient struct {
 | 
				
			||||||
	Anomalies         *prometheus.Desc
 | 
						Anomalies      *prometheus.Desc
 | 
				
			||||||
	BytesR            *prometheus.Desc
 | 
						BytesR         *prometheus.Desc
 | 
				
			||||||
	CCQ               *prometheus.Desc
 | 
						CCQ            *prometheus.Desc
 | 
				
			||||||
	Satisfaction      *prometheus.Desc
 | 
						Satisfaction   *prometheus.Desc
 | 
				
			||||||
	Noise             *prometheus.Desc
 | 
						Noise          *prometheus.Desc
 | 
				
			||||||
	RoamCount         *prometheus.Desc
 | 
						RoamCount      *prometheus.Desc
 | 
				
			||||||
	RSSI              *prometheus.Desc
 | 
						RSSI           *prometheus.Desc
 | 
				
			||||||
	RxBytes           *prometheus.Desc
 | 
						RxBytes        *prometheus.Desc
 | 
				
			||||||
	RxBytesR          *prometheus.Desc
 | 
						RxBytesR       *prometheus.Desc
 | 
				
			||||||
	RxPackets         *prometheus.Desc
 | 
						RxPackets      *prometheus.Desc
 | 
				
			||||||
	RxRate            *prometheus.Desc
 | 
						RxRate         *prometheus.Desc
 | 
				
			||||||
	Signal            *prometheus.Desc
 | 
						Signal         *prometheus.Desc
 | 
				
			||||||
	TxBytes           *prometheus.Desc
 | 
						TxBytes        *prometheus.Desc
 | 
				
			||||||
	TxBytesR          *prometheus.Desc
 | 
						TxBytesR       *prometheus.Desc
 | 
				
			||||||
	TxPackets         *prometheus.Desc
 | 
						TxPackets      *prometheus.Desc
 | 
				
			||||||
	TxRetries         *prometheus.Desc
 | 
						TxRetries      *prometheus.Desc
 | 
				
			||||||
	TxPower           *prometheus.Desc
 | 
						TxPower        *prometheus.Desc
 | 
				
			||||||
	TxRate            *prometheus.Desc
 | 
						TxRate         *prometheus.Desc
 | 
				
			||||||
	Uptime            *prometheus.Desc
 | 
						Uptime         *prometheus.Desc
 | 
				
			||||||
	WifiTxAttempts    *prometheus.Desc
 | 
						WifiTxAttempts *prometheus.Desc
 | 
				
			||||||
	WiredRxBytes      *prometheus.Desc
 | 
						WiredRxBytes   *prometheus.Desc
 | 
				
			||||||
	WiredRxBytesR     *prometheus.Desc
 | 
						WiredRxBytesR  *prometheus.Desc
 | 
				
			||||||
	WiredRxPackets    *prometheus.Desc
 | 
						WiredRxPackets *prometheus.Desc
 | 
				
			||||||
	WiredTxBytes      *prometheus.Desc
 | 
						WiredTxBytes   *prometheus.Desc
 | 
				
			||||||
	WiredTxBytesR     *prometheus.Desc
 | 
						WiredTxBytesR  *prometheus.Desc
 | 
				
			||||||
	WiredTxPackets    *prometheus.Desc
 | 
						WiredTxPackets *prometheus.Desc
 | 
				
			||||||
	DpiStatsApp       *prometheus.Desc
 | 
						DPITxPackets   *prometheus.Desc
 | 
				
			||||||
	DpiStatsCat       *prometheus.Desc
 | 
						DPIRxPackets   *prometheus.Desc
 | 
				
			||||||
	DpiStatsRxBytes   *prometheus.Desc
 | 
						DPITxBytes     *prometheus.Desc
 | 
				
			||||||
	DpiStatsRxPackets *prometheus.Desc
 | 
						DPIRxBytes     *prometheus.Desc
 | 
				
			||||||
	DpiStatsTxBytes   *prometheus.Desc
 | 
					 | 
				
			||||||
	DpiStatsTxPackets *prometheus.Desc
 | 
					 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
func descClient(ns string) *uclient {
 | 
					func descClient(ns string) *uclient {
 | 
				
			||||||
	labels := []string{"name", "mac", "site_name", "gw_name", "sw_name", "vlan",
 | 
						labels := []string{"name", "mac", "site_name", "gw_name", "sw_name", "vlan",
 | 
				
			||||||
		"ip", "oui", "network", "sw_port", "ap_name", "source", "wired"}
 | 
							"ip", "oui", "network", "sw_port", "ap_name", "source", "wired"}
 | 
				
			||||||
	labelW := append([]string{"radio_name", "radio", "radio_proto", "channel", "essid", "bssid", "radio_desc"}, labels...)
 | 
						labelW := append([]string{"radio_name", "radio", "radio_proto", "channel", "essid", "bssid", "radio_desc"}, labels...)
 | 
				
			||||||
 | 
						labelDPI := []string{"name", "mac", "site_name", "source", "category", "application"}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	return &uclient{
 | 
						return &uclient{
 | 
				
			||||||
		Anomalies:      prometheus.NewDesc(ns+"anomalies", "Client Anomalies", labelW, nil),
 | 
							Anomalies:      prometheus.NewDesc(ns+"anomalies", "Client Anomalies", labelW, nil),
 | 
				
			||||||
| 
						 | 
					@ -66,20 +65,25 @@ func descClient(ns string) *uclient {
 | 
				
			||||||
		TxRate:         prometheus.NewDesc(ns+"radio_transmit_rate_bps", "Client Transmit Rate", labelW, nil),
 | 
							TxRate:         prometheus.NewDesc(ns+"radio_transmit_rate_bps", "Client Transmit Rate", labelW, nil),
 | 
				
			||||||
		WifiTxAttempts: prometheus.NewDesc(ns+"wifi_attempts_transmit_total", "Client Wifi Transmit Attempts", labelW, nil),
 | 
							WifiTxAttempts: prometheus.NewDesc(ns+"wifi_attempts_transmit_total", "Client Wifi Transmit Attempts", labelW, nil),
 | 
				
			||||||
		Uptime:         prometheus.NewDesc(ns+"uptime_seconds", "Client Uptime", labelW, nil),
 | 
							Uptime:         prometheus.NewDesc(ns+"uptime_seconds", "Client Uptime", labelW, nil),
 | 
				
			||||||
		/* needs more "looking into"
 | 
							DPITxPackets:   prometheus.NewDesc(ns+"dpi_transmit_packets", "Client DPI Transmit Packets", labelDPI, nil),
 | 
				
			||||||
		DpiStatsApp:       prometheus.NewDesc(ns+"dpi_stats_app",
 | 
							DPIRxPackets:   prometheus.NewDesc(ns+"dpi_receive_packets", "Client DPI Receive Packets", labelDPI, nil),
 | 
				
			||||||
		"Client DPI Stats App", labels, nil),
 | 
							DPITxBytes:     prometheus.NewDesc(ns+"dpi_transmit_bytes", "Client DPI Transmit Bytes", labelDPI, nil),
 | 
				
			||||||
		DpiStatsCat:       prometheus.NewDesc(ns+"dpi_stats_cat",
 | 
							DPIRxBytes:     prometheus.NewDesc(ns+"dpi_receive_bytes", "Client DPI Receive Bytes", labelDPI, nil),
 | 
				
			||||||
		"Client DPI Stats Cat", labels, nil),
 | 
						}
 | 
				
			||||||
		DpiStatsRxBytes:   prometheus.NewDesc(ns+"dpi_stats_receive_bytes_total",
 | 
					}
 | 
				
			||||||
		"Client DPI Stats Receive Bytes", labels, nil),
 | 
					
 | 
				
			||||||
		DpiStatsRxPackets: prometheus.NewDesc(ns+"dpi_stats_receive_packets_total",
 | 
					func (u *promUnifi) exportClientDPI(r report, s *unifi.DPITable) {
 | 
				
			||||||
		"Client DPI Stats Receive Packets", labels, nil),
 | 
						for _, dpi := range s.ByApp {
 | 
				
			||||||
		DpiStatsTxBytes:   prometheus.NewDesc(ns+"dpi_stats_transmit_bytes_total",
 | 
							labelDPI := []string{s.Name, s.MAC, s.SiteName, s.SourceName,
 | 
				
			||||||
		"Client DPI Stats Transmit Bytes", labels, nil),
 | 
								unifi.DPICats.Get(dpi.Cat), unifi.DPIApps.GetApp(dpi.Cat, dpi.App)}
 | 
				
			||||||
		DpiStatsTxPackets: prometheus.NewDesc(ns+"dpi_stats_transmit_packets_total",
 | 
					
 | 
				
			||||||
		"Client DPI Stats Transmit Packets", labels, nil),
 | 
							// log.Println(labelDPI, dpi.Cat, dpi.App, dpi.TxBytes, dpi.RxBytes, dpi.TxPackets, dpi.RxPackets)
 | 
				
			||||||
		*/
 | 
							r.send([]*metric{
 | 
				
			||||||
 | 
								{u.Client.DPITxPackets, gauge, dpi.TxPackets, labelDPI},
 | 
				
			||||||
 | 
								{u.Client.DPIRxPackets, gauge, dpi.RxPackets, labelDPI},
 | 
				
			||||||
 | 
								{u.Client.DPITxBytes, gauge, dpi.TxBytes, labelDPI},
 | 
				
			||||||
 | 
								{u.Client.DPIRxBytes, gauge, dpi.RxBytes, labelDPI},
 | 
				
			||||||
 | 
							})
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -130,12 +134,3 @@ func (u *promUnifi) exportClient(r report, c *unifi.Client) {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	r.send([]*metric{{u.Client.Uptime, gauge, c.Uptime, labelW}})
 | 
						r.send([]*metric{{u.Client.Uptime, gauge, c.Uptime, labelW}})
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					 | 
				
			||||||
/* needs more "looking into"
 | 
					 | 
				
			||||||
{u.Client.DpiStatsApp, gauge, c.DpiStats.App, labels},
 | 
					 | 
				
			||||||
{u.Client.DpiStatsCat, gauge, c.DpiStats.Cat, labels},
 | 
					 | 
				
			||||||
{u.Client.DpiStatsRxBytes, counter, c.DpiStats.RxBytes, labels},
 | 
					 | 
				
			||||||
{u.Client.DpiStatsRxPackets, counter, c.DpiStats.RxPackets, labels},
 | 
					 | 
				
			||||||
{u.Client.DpiStatsTxBytes, counter, c.DpiStats.TxBytes, labels},
 | 
					 | 
				
			||||||
{u.Client.DpiStatsTxPackets, counter, c.DpiStats.TxPackets, labels},
 | 
					 | 
				
			||||||
*/
 | 
					 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -277,6 +277,8 @@ func (u *promUnifi) loopExports(r report) {
 | 
				
			||||||
	r.add()
 | 
						r.add()
 | 
				
			||||||
	r.add()
 | 
						r.add()
 | 
				
			||||||
	r.add()
 | 
						r.add()
 | 
				
			||||||
 | 
						r.add()
 | 
				
			||||||
 | 
						r.add()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	go func() {
 | 
						go func() {
 | 
				
			||||||
		defer r.done()
 | 
							defer r.done()
 | 
				
			||||||
| 
						 | 
					@ -286,6 +288,30 @@ func (u *promUnifi) loopExports(r report) {
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
	}()
 | 
						}()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						go func() {
 | 
				
			||||||
 | 
							defer r.done()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							for _, s := range m.SitesDPI {
 | 
				
			||||||
 | 
								u.exportSiteDPI(r, s)
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
						}()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						go func() {
 | 
				
			||||||
 | 
							defer r.done()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							for _, c := range m.Clients {
 | 
				
			||||||
 | 
								u.exportClient(r, c)
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
						}()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						go func() {
 | 
				
			||||||
 | 
							defer r.done()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							for _, c := range m.ClientsDPI {
 | 
				
			||||||
 | 
								u.exportClientDPI(r, c)
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
						}()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	go func() {
 | 
						go func() {
 | 
				
			||||||
		defer r.done()
 | 
							defer r.done()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -317,12 +343,4 @@ func (u *promUnifi) loopExports(r report) {
 | 
				
			||||||
			u.exportUSW(r, d)
 | 
								u.exportUSW(r, d)
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
	}()
 | 
						}()
 | 
				
			||||||
 | 
					 | 
				
			||||||
	go func() {
 | 
					 | 
				
			||||||
		defer r.done()
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
		for _, c := range m.Clients {
 | 
					 | 
				
			||||||
			u.exportClient(r, c)
 | 
					 | 
				
			||||||
		}
 | 
					 | 
				
			||||||
	}()
 | 
					 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -31,10 +31,15 @@ type site struct {
 | 
				
			||||||
	RemoteUserTxBytes     *prometheus.Desc
 | 
						RemoteUserTxBytes     *prometheus.Desc
 | 
				
			||||||
	RemoteUserRxPackets   *prometheus.Desc
 | 
						RemoteUserRxPackets   *prometheus.Desc
 | 
				
			||||||
	RemoteUserTxPackets   *prometheus.Desc
 | 
						RemoteUserTxPackets   *prometheus.Desc
 | 
				
			||||||
 | 
						DPITxPackets          *prometheus.Desc
 | 
				
			||||||
 | 
						DPIRxPackets          *prometheus.Desc
 | 
				
			||||||
 | 
						DPITxBytes            *prometheus.Desc
 | 
				
			||||||
 | 
						DPIRxBytes            *prometheus.Desc
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
func descSite(ns string) *site {
 | 
					func descSite(ns string) *site {
 | 
				
			||||||
	labels := []string{"subsystem", "status", "site_name", "source"}
 | 
						labels := []string{"subsystem", "status", "site_name", "source"}
 | 
				
			||||||
 | 
						labelDPI := []string{"category", "application", "site_name", "source"}
 | 
				
			||||||
	nd := prometheus.NewDesc
 | 
						nd := prometheus.NewDesc
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	return &site{
 | 
						return &site{
 | 
				
			||||||
| 
						 | 
					@ -63,6 +68,24 @@ func descSite(ns string) *site {
 | 
				
			||||||
		RemoteUserTxBytes:     nd(ns+"remote_user_transmit_bytes_total", "Remote Users Transmit Bytes", labels, nil),
 | 
							RemoteUserTxBytes:     nd(ns+"remote_user_transmit_bytes_total", "Remote Users Transmit Bytes", labels, nil),
 | 
				
			||||||
		RemoteUserRxPackets:   nd(ns+"remote_user_receive_packets_total", "Remote Users Receive Packets", labels, nil),
 | 
							RemoteUserRxPackets:   nd(ns+"remote_user_receive_packets_total", "Remote Users Receive Packets", labels, nil),
 | 
				
			||||||
		RemoteUserTxPackets:   nd(ns+"remote_user_transmit_packets_total", "Remote Users Transmit Packets", labels, nil),
 | 
							RemoteUserTxPackets:   nd(ns+"remote_user_transmit_packets_total", "Remote Users Transmit Packets", labels, nil),
 | 
				
			||||||
 | 
							DPITxPackets:          nd(ns+"dpi_transmit_packets", "Site DPI Transmit Packets", labelDPI, nil),
 | 
				
			||||||
 | 
							DPIRxPackets:          nd(ns+"dpi_receive_packets", "Site DPI Receive Packets", labelDPI, nil),
 | 
				
			||||||
 | 
							DPITxBytes:            nd(ns+"dpi_transmit_bytes", "Site DPI Transmit Bytes", labelDPI, nil),
 | 
				
			||||||
 | 
							DPIRxBytes:            nd(ns+"dpi_receive_bytes", "Site DPI Receive Bytes", labelDPI, nil),
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					func (u *promUnifi) exportSiteDPI(r report, s *unifi.DPITable) {
 | 
				
			||||||
 | 
						for _, dpi := range s.ByApp {
 | 
				
			||||||
 | 
							labelDPI := []string{unifi.DPICats.Get(dpi.Cat), unifi.DPIApps.GetApp(dpi.Cat, dpi.App), s.SiteName, s.SourceName}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							//	log.Println(labelsDPI, dpi.Cat, dpi.App, dpi.TxBytes, dpi.RxBytes, dpi.TxPackets, dpi.RxPackets)
 | 
				
			||||||
 | 
							r.send([]*metric{
 | 
				
			||||||
 | 
								{u.Site.DPITxPackets, gauge, dpi.TxPackets, labelDPI},
 | 
				
			||||||
 | 
								{u.Site.DPIRxPackets, gauge, dpi.RxPackets, labelDPI},
 | 
				
			||||||
 | 
								{u.Site.DPITxBytes, gauge, dpi.TxBytes, labelDPI},
 | 
				
			||||||
 | 
								{u.Site.DPIRxBytes, gauge, dpi.RxBytes, labelDPI},
 | 
				
			||||||
 | 
							})
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue