diff --git a/.gitignore b/.gitignore index a8c71744..9ad81108 100644 --- a/.gitignore +++ b/.gitignore @@ -9,3 +9,6 @@ .DS_Store *~ /package_build +/release +/unifi-poller.macos +/unifi-poller.linux diff --git a/Gopkg.lock b/Gopkg.lock index 1095c158..2e5236ab 100644 --- a/Gopkg.lock +++ b/Gopkg.lock @@ -2,12 +2,12 @@ [[projects]] - digest = "1:dbd1c953926f2aca29aeb24f13af5875a3b31f09ed7093cb18a5409d4b9fc9f1" + digest = "1:91639d25b5400abb27afc5d4e201898f157a239d508dd98bcac2858fdea6869a" name = "github.com/golift/unifi" packages = ["."] pruneopts = "UT" - revision = "034a62e1cb6ef13e724cfab9b8f87dbb130d493c" - version = "v2.0.0" + revision = "a88e9234a418f7880d4da4e651899bb5a7185ec7" + version = "v2.0.1" [[projects]] branch = "master" @@ -63,6 +63,7 @@ "github.com/golift/unifi", "github.com/influxdata/influxdb1-client/v2", "github.com/naoina/toml", + "github.com/pkg/errors", "github.com/spf13/pflag", ] solver-name = "gps-cdcl" diff --git a/cmd/unifi-poller/main.go b/cmd/unifi-poller/main.go index e6d4c5d9..01da5525 100644 --- a/cmd/unifi-poller/main.go +++ b/cmd/unifi-poller/main.go @@ -131,7 +131,6 @@ func (c *Config) PollUnifiController(controller *unifi.Unifi, infdb influx.Clien logErrors([]error{err}, "influx.NewBatchPoints") continue } - // Batch all the points. if errs := batchPoints(devices, clients, bp); errs != nil && hasErr(errs) { logErrors(errs, "asset.Points()") @@ -167,7 +166,7 @@ func filterSites(controller *unifi.Unifi, filter []string) ([]unifi.Site, error) } // batchPoints combines all device and client data into influxdb data points. -func batchPoints(devices *unifi.Devices, clients *unifi.Clients, batchPoints influx.BatchPoints) (errs []error) { +func batchPoints(devices *unifi.Devices, clients *unifi.Clients, bp influx.BatchPoints) (errs []error) { process := func(asset Asset) error { if asset == nil { return nil @@ -176,7 +175,7 @@ func batchPoints(devices *unifi.Devices, clients *unifi.Clients, batchPoints inf if err != nil { return err } - batchPoints.AddPoints(influxPoints) + bp.AddPoints(influxPoints) return nil } if devices != nil {