From 8273aafaf4fe8d9c84f25bdbf223a2a30d1aac5c Mon Sep 17 00:00:00 2001 From: Cody Lee Date: Sun, 4 Dec 2022 20:44:52 -0600 Subject: [PATCH] update readme --- pkg/influxunifi/README.md | 44 ++++++++++++++++++++++++++++++++++--- pkg/influxunifi/influxdb.go | 4 ++-- 2 files changed, 43 insertions(+), 5 deletions(-) diff --git a/pkg/influxunifi/README.md b/pkg/influxunifi/README.md index 9edb84aa..8b13d46a 100644 --- a/pkg/influxunifi/README.md +++ b/pkg/influxunifi/README.md @@ -1,5 +1,43 @@ -# influxunifi - -## UnPoller Input Plugin +## UnPoller InfluxDB Plugin Collects UniFi data from a UniFi controller using the API. + +This is meant for InfluxDB users 1.8+ and 2.x series. + +## Configuration + +### InfluxDB 1.8+, 2.x + +```yaml +influxdb: + disable: false + # How often to poll UniFi and report to Datadog. + interval: "2m" + # the influxdb url to post data + url: http://somehost:1234 + # the secret auth token + auth_token: somesecret + # the influxdb org + org: my-org + # the influxdb bucket + bucket: my-bucket + # how many points to batch write per flush. + batch_size: 20 +``` + +### InfluxDB pre 1.8 + +```yaml +influxdb: + disable: false + # How often to poll UniFi and report to Datadog. + interval: "2m" + # the influxdb url to post data + url: http://somehost:1234 + # the database + db: mydb + # the influxdb api user + user: unifi + # the influxdb api password + pass: supersecret +``` diff --git a/pkg/influxunifi/influxdb.go b/pkg/influxunifi/influxdb.go index ccafd3de..9baf84c6 100644 --- a/pkg/influxunifi/influxdb.go +++ b/pkg/influxunifi/influxdb.go @@ -65,7 +65,7 @@ type InfluxDB struct { type InfluxUnifi struct { Collector poller.Collect influxV1 influxV1.Client - influxV2 influx.ClientInterface + influxV2 influx.Client LastCheck time.Time *InfluxDB } @@ -231,7 +231,7 @@ func (u *InfluxUnifi) ReportMetrics(m *poller.Metrics, e *poller.Events) (*Repor if u.Config.Version2 { // Make a new Influx Points Batcher. - r.writer = &u.influxV2.WriteAPI(u.Org, u.Bucket) + r.writer = u.influxV2.WriteAPI(u.Org, u.Bucket) go u.collect(r, r.ch) // Batch all the points.