From 41eb73ae8c754225fc19c6ec9661dcddf8204fe9 Mon Sep 17 00:00:00 2001 From: davidnewhall2 Date: Sat, 30 Nov 2019 01:45:42 -0800 Subject: [PATCH] move pkgs, update readme, add two more metrics to influx client --- integrations/influxunifi/README.md | 11 +++++++---- integrations/influxunifi/examples/MANUAL.md | 1 + integrations/influxunifi/examples/up.conf.example | 2 +- integrations/influxunifi/examples/up.xml.example | 2 +- integrations/influxunifi/examples/up.yaml.example | 2 +- integrations/influxunifi/main.go | 2 +- .../influxunifi/{ => pkg}/influxunifi/README.md | 0 .../influxunifi/{ => pkg}/influxunifi/clients.go | 2 ++ integrations/influxunifi/{ => pkg}/influxunifi/ids.go | 0 .../influxunifi/{ => pkg}/influxunifi/metrics.go | 2 +- .../influxunifi/{ => pkg}/influxunifi/site.go | 0 integrations/influxunifi/{ => pkg}/influxunifi/uap.go | 0 integrations/influxunifi/{ => pkg}/influxunifi/udm.go | 0 integrations/influxunifi/{ => pkg}/influxunifi/usg.go | 0 integrations/influxunifi/{ => pkg}/influxunifi/usw.go | 0 integrations/influxunifi/{ => pkg}/metrics/metrics.go | 0 .../influxunifi/{ => pkg}/poller/build_macos.go | 0 .../influxunifi/{ => pkg}/poller/build_unix.go | 0 .../influxunifi/{ => pkg}/poller/build_windows.go | 0 integrations/influxunifi/{ => pkg}/poller/config.go | 0 integrations/influxunifi/{ => pkg}/poller/dumper.go | 0 integrations/influxunifi/{ => pkg}/poller/helpers.go | 0 integrations/influxunifi/{ => pkg}/poller/influx.go | 4 ++-- .../influxunifi/{ => pkg}/poller/prometheus.go | 4 ++-- integrations/influxunifi/{ => pkg}/poller/start.go | 0 integrations/influxunifi/{ => pkg}/poller/unifi.go | 2 +- .../influxunifi/{ => pkg}/promunifi/README.md | 0 .../influxunifi/{ => pkg}/promunifi/clients.go | 0 .../influxunifi/{ => pkg}/promunifi/collector.go | 2 +- integrations/influxunifi/{ => pkg}/promunifi/loops.go | 0 .../influxunifi/{ => pkg}/promunifi/report.go | 2 +- integrations/influxunifi/{ => pkg}/promunifi/site.go | 0 integrations/influxunifi/{ => pkg}/promunifi/uap.go | 0 integrations/influxunifi/{ => pkg}/promunifi/udm.go | 0 integrations/influxunifi/{ => pkg}/promunifi/usg.go | 0 integrations/influxunifi/{ => pkg}/promunifi/usw.go | 0 36 files changed, 22 insertions(+), 16 deletions(-) rename integrations/influxunifi/{ => pkg}/influxunifi/README.md (100%) rename integrations/influxunifi/{ => pkg}/influxunifi/clients.go (97%) rename integrations/influxunifi/{ => pkg}/influxunifi/ids.go (100%) rename integrations/influxunifi/{ => pkg}/influxunifi/metrics.go (97%) rename integrations/influxunifi/{ => pkg}/influxunifi/site.go (100%) rename integrations/influxunifi/{ => pkg}/influxunifi/uap.go (100%) rename integrations/influxunifi/{ => pkg}/influxunifi/udm.go (100%) rename integrations/influxunifi/{ => pkg}/influxunifi/usg.go (100%) rename integrations/influxunifi/{ => pkg}/influxunifi/usw.go (100%) rename integrations/influxunifi/{ => pkg}/metrics/metrics.go (100%) rename integrations/influxunifi/{ => pkg}/poller/build_macos.go (100%) rename integrations/influxunifi/{ => pkg}/poller/build_unix.go (100%) rename integrations/influxunifi/{ => pkg}/poller/build_windows.go (100%) rename integrations/influxunifi/{ => pkg}/poller/config.go (100%) rename integrations/influxunifi/{ => pkg}/poller/dumper.go (100%) rename integrations/influxunifi/{ => pkg}/poller/helpers.go (100%) rename integrations/influxunifi/{ => pkg}/poller/influx.go (95%) rename integrations/influxunifi/{ => pkg}/poller/prometheus.go (95%) rename integrations/influxunifi/{ => pkg}/poller/start.go (100%) rename integrations/influxunifi/{ => pkg}/poller/unifi.go (98%) rename integrations/influxunifi/{ => pkg}/promunifi/README.md (100%) rename integrations/influxunifi/{ => pkg}/promunifi/clients.go (100%) rename integrations/influxunifi/{ => pkg}/promunifi/collector.go (98%) rename integrations/influxunifi/{ => pkg}/promunifi/loops.go (100%) rename integrations/influxunifi/{ => pkg}/promunifi/report.go (96%) rename integrations/influxunifi/{ => pkg}/promunifi/site.go (100%) rename integrations/influxunifi/{ => pkg}/promunifi/uap.go (100%) rename integrations/influxunifi/{ => pkg}/promunifi/udm.go (100%) rename integrations/influxunifi/{ => pkg}/promunifi/usg.go (100%) rename integrations/influxunifi/{ => pkg}/promunifi/usw.go (100%) diff --git a/integrations/influxunifi/README.md b/integrations/influxunifi/README.md index c2ca2d6a..721c0e6e 100644 --- a/integrations/influxunifi/README.md +++ b/integrations/influxunifi/README.md @@ -3,7 +3,7 @@ [![discord](https://badgen.net/badge/icon/Discord?color=0011ff&label&icon=https://simpleicons.now.sh/discord/eee "Ubiquiti Discord")](https://discord.gg/KnyKYt2) [![twitter](https://badgen.net/twitter/follow/TwitchCaptain?icon=https://simpleicons.now.sh/twitter/0099ff&label=TwitchCaptain&color=0116ff "TwitchCaptain @ Twitter")](https://twitter.com/TwitchCaptain) -[![grafana](https://badgen.net/https/golift.io/bd/grafana/dashboard-downloads/10414,10415,10416,10417,10418?icon=https://simpleicons.now.sh/grafana/ED7F38&color=0011ff "Grafana Dashboard Downloads")](http://grafana.com/dashboards?search=unifi-poller) +[![grafana](https://badgen.net/https/golift.io/bd/grafana/dashboard-downloads/10414,10415,10416,10417,10418,11314,11315?icon=https://simpleicons.now.sh/grafana/ED7F38&color=0011ff "Grafana Dashboard Downloads")](http://grafana.com/dashboards?search=unifi-poller) [![pulls](https://badgen.net/docker/pulls/golift/unifi-poller?icon=https://simpleicons.now.sh/docker/38B1ED&label=pulls&color=0011ff "Docker Pulls")](https://hub.docker.com/r/golift/unifi-poller) [![DLs](https://img.shields.io/github/downloads/davidnewhall/unifi-poller/total.svg?logo=github&color=0116ff "GitHub Downloads")](https://www.somsubhra.com/github-release-stats/?username=davidnewhall&repository=unifi-poller) @@ -12,9 +12,12 @@ [![stars](https://badgen.net/github/stars/davidnewhall/unifi-poller?icon=https://simpleicons.now.sh/macys/fab&label=&color=0099ee "GitHub Stars")](https://github.com/davidnewhall/unifi-poller) [![travis](https://badgen.net/travis/davidnewhall/unifi-poller?icon=travis&label=build "Travis Build")](https://travis-ci.org/davidnewhall/unifi-poller) -Collect your UniFi controller data and export it to an InfluxDB instance. -[Five Grafana Dashboards](http://grafana.com/dashboards?search=unifi-poller) -included; with screenshots. Updated 2019. +Collect your UniFi controller data and report it to an InfluxDB instance, +or export it for Prometheus collection. Prometheus support is new, and much +of the documentation still needs to be updated. 11/30/2019 +[Seven Grafana Dashboards](http://grafana.com/dashboards?search=unifi-poller) +included; with screenshots. Five for InfluxDB and two for Prometheus, although +three more Prometheus dashboards are coming! ## Installation diff --git a/integrations/influxunifi/examples/MANUAL.md b/integrations/influxunifi/examples/MANUAL.md index 4648bc4c..75188ec4 100644 --- a/integrations/influxunifi/examples/MANUAL.md +++ b/integrations/influxunifi/examples/MANUAL.md @@ -148,6 +148,7 @@ is provided so the application can be easily adapted to any environment. Detection System data. IDS and IPS are the same data set. This is off by default because most controllers do not have this enabled. It also creates a lot of new metrics from controllers with a lot of IDS entries. + IDS data does not contain metrics, so this doesn't work with Prometheus. reauthenticate default: false Setting this parameter to true will make UniFi Poller send a new login diff --git a/integrations/influxunifi/examples/up.conf.example b/integrations/influxunifi/examples/up.conf.example index 0f1b3041..eb4fb0f2 100644 --- a/integrations/influxunifi/examples/up.conf.example +++ b/integrations/influxunifi/examples/up.conf.example @@ -56,7 +56,7 @@ unifi_user = "influx" unifi_pass = "4BB9345C-2341-48D7-99F5-E01B583FF77F" unifi_url = "https://127.0.0.1:8443" -# Enable collection of Intrusion Detection System Data. +# Enable collection of Intrusion Detection System Data (InfluxDB only). # Only useful if IDS or IPS are enabled on one of the sites. collect_ids = false diff --git a/integrations/influxunifi/examples/up.xml.example b/integrations/influxunifi/examples/up.xml.example index 3022948b..325f12d4 100644 --- a/integrations/influxunifi/examples/up.xml.example +++ b/integrations/influxunifi/examples/up.xml.example @@ -79,7 +79,7 @@ https://127.0.0.1:8443 false diff --git a/integrations/influxunifi/examples/up.yaml.example b/integrations/influxunifi/examples/up.yaml.example index 4dfe2e67..00e75fba 100644 --- a/integrations/influxunifi/examples/up.yaml.example +++ b/integrations/influxunifi/examples/up.yaml.example @@ -57,7 +57,7 @@ unifi_user: "influx" unifi_pass: "" unifi_url: "https://127.0.0.1:8443" -# Enable collection of Intrusion Detection System Data. +# Enable collection of Intrusion Detection System Data (InfluxDB only). # Only useful if IDS or IPS are enabled on one of the sites. collect_ids: false diff --git a/integrations/influxunifi/main.go b/integrations/influxunifi/main.go index f98e65c4..332bfd5d 100644 --- a/integrations/influxunifi/main.go +++ b/integrations/influxunifi/main.go @@ -3,7 +3,7 @@ package main import ( "log" - "github.com/davidnewhall/unifi-poller/poller" + "github.com/davidnewhall/unifi-poller/pkg/poller" ) // Keep it simple. diff --git a/integrations/influxunifi/influxunifi/README.md b/integrations/influxunifi/pkg/influxunifi/README.md similarity index 100% rename from integrations/influxunifi/influxunifi/README.md rename to integrations/influxunifi/pkg/influxunifi/README.md diff --git a/integrations/influxunifi/influxunifi/clients.go b/integrations/influxunifi/pkg/influxunifi/clients.go similarity index 97% rename from integrations/influxunifi/influxunifi/clients.go rename to integrations/influxunifi/pkg/influxunifi/clients.go index 5a57331b..8e35f282 100644 --- a/integrations/influxunifi/influxunifi/clients.go +++ b/integrations/influxunifi/pkg/influxunifi/clients.go @@ -56,6 +56,7 @@ func ClientPoints(c *unifi.Client, now time.Time) ([]*influx.Point, error) { "essid": c.Essid, "bssid": c.Bssid, "radio_desc": c.RadioDescription, + "satisfaction": c.Satisfaction.Val, "hostname": c.Hostname, "dpi_stats_last_updated": c.DpiStatsLastUpdated, "last_seen_by_uap": c.LastSeenByUAP, @@ -84,6 +85,7 @@ func ClientPoints(c *unifi.Client, now time.Time) ([]*influx.Point, error) { "tx_bytes": c.TxBytes, "tx_bytes_r": c.TxBytesR, "tx_packets": c.TxPackets, + "tx_retries": c.TxRetries, "tx_power": c.TxPower, "tx_rate": c.TxRate, "uptime": c.Uptime, diff --git a/integrations/influxunifi/influxunifi/ids.go b/integrations/influxunifi/pkg/influxunifi/ids.go similarity index 100% rename from integrations/influxunifi/influxunifi/ids.go rename to integrations/influxunifi/pkg/influxunifi/ids.go diff --git a/integrations/influxunifi/influxunifi/metrics.go b/integrations/influxunifi/pkg/influxunifi/metrics.go similarity index 97% rename from integrations/influxunifi/influxunifi/metrics.go rename to integrations/influxunifi/pkg/influxunifi/metrics.go index 3919c8c7..f4a8c86b 100644 --- a/integrations/influxunifi/influxunifi/metrics.go +++ b/integrations/influxunifi/pkg/influxunifi/metrics.go @@ -3,7 +3,7 @@ package influxunifi import ( - "github.com/davidnewhall/unifi-poller/metrics" + "github.com/davidnewhall/unifi-poller/pkg/metrics" client "github.com/influxdata/influxdb1-client/v2" ) diff --git a/integrations/influxunifi/influxunifi/site.go b/integrations/influxunifi/pkg/influxunifi/site.go similarity index 100% rename from integrations/influxunifi/influxunifi/site.go rename to integrations/influxunifi/pkg/influxunifi/site.go diff --git a/integrations/influxunifi/influxunifi/uap.go b/integrations/influxunifi/pkg/influxunifi/uap.go similarity index 100% rename from integrations/influxunifi/influxunifi/uap.go rename to integrations/influxunifi/pkg/influxunifi/uap.go diff --git a/integrations/influxunifi/influxunifi/udm.go b/integrations/influxunifi/pkg/influxunifi/udm.go similarity index 100% rename from integrations/influxunifi/influxunifi/udm.go rename to integrations/influxunifi/pkg/influxunifi/udm.go diff --git a/integrations/influxunifi/influxunifi/usg.go b/integrations/influxunifi/pkg/influxunifi/usg.go similarity index 100% rename from integrations/influxunifi/influxunifi/usg.go rename to integrations/influxunifi/pkg/influxunifi/usg.go diff --git a/integrations/influxunifi/influxunifi/usw.go b/integrations/influxunifi/pkg/influxunifi/usw.go similarity index 100% rename from integrations/influxunifi/influxunifi/usw.go rename to integrations/influxunifi/pkg/influxunifi/usw.go diff --git a/integrations/influxunifi/metrics/metrics.go b/integrations/influxunifi/pkg/metrics/metrics.go similarity index 100% rename from integrations/influxunifi/metrics/metrics.go rename to integrations/influxunifi/pkg/metrics/metrics.go diff --git a/integrations/influxunifi/poller/build_macos.go b/integrations/influxunifi/pkg/poller/build_macos.go similarity index 100% rename from integrations/influxunifi/poller/build_macos.go rename to integrations/influxunifi/pkg/poller/build_macos.go diff --git a/integrations/influxunifi/poller/build_unix.go b/integrations/influxunifi/pkg/poller/build_unix.go similarity index 100% rename from integrations/influxunifi/poller/build_unix.go rename to integrations/influxunifi/pkg/poller/build_unix.go diff --git a/integrations/influxunifi/poller/build_windows.go b/integrations/influxunifi/pkg/poller/build_windows.go similarity index 100% rename from integrations/influxunifi/poller/build_windows.go rename to integrations/influxunifi/pkg/poller/build_windows.go diff --git a/integrations/influxunifi/poller/config.go b/integrations/influxunifi/pkg/poller/config.go similarity index 100% rename from integrations/influxunifi/poller/config.go rename to integrations/influxunifi/pkg/poller/config.go diff --git a/integrations/influxunifi/poller/dumper.go b/integrations/influxunifi/pkg/poller/dumper.go similarity index 100% rename from integrations/influxunifi/poller/dumper.go rename to integrations/influxunifi/pkg/poller/dumper.go diff --git a/integrations/influxunifi/poller/helpers.go b/integrations/influxunifi/pkg/poller/helpers.go similarity index 100% rename from integrations/influxunifi/poller/helpers.go rename to integrations/influxunifi/pkg/poller/helpers.go diff --git a/integrations/influxunifi/poller/influx.go b/integrations/influxunifi/pkg/poller/influx.go similarity index 95% rename from integrations/influxunifi/poller/influx.go rename to integrations/influxunifi/pkg/poller/influx.go index d428bdb8..1eb2bb83 100644 --- a/integrations/influxunifi/poller/influx.go +++ b/integrations/influxunifi/pkg/poller/influx.go @@ -4,8 +4,8 @@ import ( "crypto/tls" "fmt" - "github.com/davidnewhall/unifi-poller/influxunifi" - "github.com/davidnewhall/unifi-poller/metrics" + "github.com/davidnewhall/unifi-poller/pkg/influxunifi" + "github.com/davidnewhall/unifi-poller/pkg/metrics" influx "github.com/influxdata/influxdb1-client/v2" ) diff --git a/integrations/influxunifi/poller/prometheus.go b/integrations/influxunifi/pkg/poller/prometheus.go similarity index 95% rename from integrations/influxunifi/poller/prometheus.go rename to integrations/influxunifi/pkg/poller/prometheus.go index ae2daa63..88502dc9 100644 --- a/integrations/influxunifi/poller/prometheus.go +++ b/integrations/influxunifi/pkg/poller/prometheus.go @@ -6,8 +6,8 @@ import ( "strings" "time" - "github.com/davidnewhall/unifi-poller/metrics" - "github.com/davidnewhall/unifi-poller/promunifi" + "github.com/davidnewhall/unifi-poller/pkg/metrics" + "github.com/davidnewhall/unifi-poller/pkg/promunifi" "github.com/prometheus/client_golang/prometheus" "github.com/prometheus/client_golang/prometheus/promhttp" ) diff --git a/integrations/influxunifi/poller/start.go b/integrations/influxunifi/pkg/poller/start.go similarity index 100% rename from integrations/influxunifi/poller/start.go rename to integrations/influxunifi/pkg/poller/start.go diff --git a/integrations/influxunifi/poller/unifi.go b/integrations/influxunifi/pkg/poller/unifi.go similarity index 98% rename from integrations/influxunifi/poller/unifi.go rename to integrations/influxunifi/pkg/poller/unifi.go index 54135923..c431f252 100644 --- a/integrations/influxunifi/poller/unifi.go +++ b/integrations/influxunifi/pkg/poller/unifi.go @@ -5,7 +5,7 @@ import ( "strings" "time" - "github.com/davidnewhall/unifi-poller/metrics" + "github.com/davidnewhall/unifi-poller/pkg/metrics" "golift.io/unifi" ) diff --git a/integrations/influxunifi/promunifi/README.md b/integrations/influxunifi/pkg/promunifi/README.md similarity index 100% rename from integrations/influxunifi/promunifi/README.md rename to integrations/influxunifi/pkg/promunifi/README.md diff --git a/integrations/influxunifi/promunifi/clients.go b/integrations/influxunifi/pkg/promunifi/clients.go similarity index 100% rename from integrations/influxunifi/promunifi/clients.go rename to integrations/influxunifi/pkg/promunifi/clients.go diff --git a/integrations/influxunifi/promunifi/collector.go b/integrations/influxunifi/pkg/promunifi/collector.go similarity index 98% rename from integrations/influxunifi/promunifi/collector.go rename to integrations/influxunifi/pkg/promunifi/collector.go index 25cfd370..42a821cf 100644 --- a/integrations/influxunifi/promunifi/collector.go +++ b/integrations/influxunifi/pkg/promunifi/collector.go @@ -8,7 +8,7 @@ import ( "sync" "time" - "github.com/davidnewhall/unifi-poller/metrics" + "github.com/davidnewhall/unifi-poller/pkg/metrics" "github.com/prometheus/client_golang/prometheus" "golift.io/unifi" ) diff --git a/integrations/influxunifi/promunifi/loops.go b/integrations/influxunifi/pkg/promunifi/loops.go similarity index 100% rename from integrations/influxunifi/promunifi/loops.go rename to integrations/influxunifi/pkg/promunifi/loops.go diff --git a/integrations/influxunifi/promunifi/report.go b/integrations/influxunifi/pkg/promunifi/report.go similarity index 96% rename from integrations/influxunifi/promunifi/report.go rename to integrations/influxunifi/pkg/promunifi/report.go index 016d3db8..4262a546 100644 --- a/integrations/influxunifi/promunifi/report.go +++ b/integrations/influxunifi/pkg/promunifi/report.go @@ -4,7 +4,7 @@ import ( "fmt" "time" - "github.com/davidnewhall/unifi-poller/metrics" + "github.com/davidnewhall/unifi-poller/pkg/metrics" "github.com/prometheus/client_golang/prometheus" ) diff --git a/integrations/influxunifi/promunifi/site.go b/integrations/influxunifi/pkg/promunifi/site.go similarity index 100% rename from integrations/influxunifi/promunifi/site.go rename to integrations/influxunifi/pkg/promunifi/site.go diff --git a/integrations/influxunifi/promunifi/uap.go b/integrations/influxunifi/pkg/promunifi/uap.go similarity index 100% rename from integrations/influxunifi/promunifi/uap.go rename to integrations/influxunifi/pkg/promunifi/uap.go diff --git a/integrations/influxunifi/promunifi/udm.go b/integrations/influxunifi/pkg/promunifi/udm.go similarity index 100% rename from integrations/influxunifi/promunifi/udm.go rename to integrations/influxunifi/pkg/promunifi/udm.go diff --git a/integrations/influxunifi/promunifi/usg.go b/integrations/influxunifi/pkg/promunifi/usg.go similarity index 100% rename from integrations/influxunifi/promunifi/usg.go rename to integrations/influxunifi/pkg/promunifi/usg.go diff --git a/integrations/influxunifi/promunifi/usw.go b/integrations/influxunifi/pkg/promunifi/usw.go similarity index 100% rename from integrations/influxunifi/promunifi/usw.go rename to integrations/influxunifi/pkg/promunifi/usw.go