From 4e48247f5443c30f28f6a860075341ca6bb1abdb Mon Sep 17 00:00:00 2001 From: davidnewhall2 Date: Sun, 15 Dec 2019 13:15:00 -0800 Subject: [PATCH] fix tests --- .metadata.sh | 2 +- pkg/poller/start.go | 2 +- pkg/promunifi/collector.go | 8 ++++---- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/.metadata.sh b/.metadata.sh index 11ba0838..c4b30be1 100755 --- a/.metadata.sh +++ b/.metadata.sh @@ -11,7 +11,7 @@ HBREPO="golift/homebrew-mugs" MAINT="David Newhall II " VENDOR="Go Lift " DESC="Polls a UniFi controller, exports metrics to InfluxDB and Prometheus" -GOLANGCI_LINT_ARGS="--enable-all -D gochecknoglobals -D dupl -D lll -D funlen -D wsl -e G402" +GOLANGCI_LINT_ARGS="--enable-all -D gochecknoglobals -D dupl -D lll -D funlen -D wsl -e G402 -D gochecknoinits" # Example must exist at examples/$CONFIG_FILE.example CONFIG_FILE="up.conf" LICENSE="MIT" diff --git a/pkg/poller/start.go b/pkg/poller/start.go index 7893f32f..cd293b2f 100644 --- a/pkg/poller/start.go +++ b/pkg/poller/start.go @@ -91,7 +91,7 @@ func (u *UnifiPoller) Run() error { u.Logf("Polling UniFi Controller at %s v%s as user %s. Sites: %v", c.URL, c.Unifi.ServerVersion, c.User, c.Sites) default: - u.LogErrorf("Controller Auth or Connection failed, but continuing to retry! %s: %v", c.URL, err) + u.LogErrorf("Controller Auth or Connection failed, but continuing to retry! %s: %v", c.Name, err) } } diff --git a/pkg/promunifi/collector.go b/pkg/promunifi/collector.go index 61c8db81..e999ac3f 100644 --- a/pkg/promunifi/collector.go +++ b/pkg/promunifi/collector.go @@ -44,16 +44,16 @@ type Prometheus struct { // Config is the input (config file) data used to initialize this output plugin. type Config struct { - Disable bool `json:"disable" toml:"disable" xml:"disable" yaml:"disable"` // If non-empty, each of the collected metrics is prefixed by the // provided string and an underscore ("_"). - Namespace string `json:"namespace" toml:"namespace" xml:"namespace" yaml:"namespace"` + Namespace string `json:"namespace" toml:"namespace" xml:"namespace" yaml:"namespace"` + HTTPListen string `json:"http_listen" toml:"http_listen" xml:"http_listen" yaml:"http_listen"` // If true, any error encountered during collection is reported as an // invalid metric (see NewInvalidMetric). Otherwise, errors are ignored // and the collected metrics will be incomplete. Possibly, no metrics // will be collected at all. - ReportErrors bool `json:"report_errors" toml:"report_errors" xml:"report_errors" yaml:"report_errors"` - HTTPListen string `json:"http_listen" toml:"http_listen" xml:"http_listen" yaml:"http_listen"` + ReportErrors bool `json:"report_errors" toml:"report_errors" xml:"report_errors" yaml:"report_errors"` + Disable bool `json:"disable" toml:"disable" xml:"disable" yaml:"disable"` } type metric struct {