move pkgs, update readme, add two more metrics to influx client

This commit is contained in:
davidnewhall2 2019-11-30 01:45:42 -08:00
parent d052e699db
commit ebe05ec3e5
36 changed files with 22 additions and 16 deletions

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -79,7 +79,7 @@
<unifi_pass></unifi_pass>
<unifi_url>https://127.0.0.1:8443</unifi_url>
<!--
# 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</collect_ids>

View File

@ -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

View File

@ -3,7 +3,7 @@ package main
import (
"log"
"github.com/davidnewhall/unifi-poller/poller"
"github.com/davidnewhall/unifi-poller/pkg/poller"
)
// Keep it simple.

View File

@ -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,

View File

@ -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"
)

View File

@ -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"
)

View File

@ -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"
)

View File

@ -5,7 +5,7 @@ import (
"strings"
"time"
"github.com/davidnewhall/unifi-poller/metrics"
"github.com/davidnewhall/unifi-poller/pkg/metrics"
"golift.io/unifi"
)

View File

@ -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"
)

View File

@ -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"
)