diff --git a/examples/MANUAL.md b/examples/MANUAL.md index 27774e5c..c9ecd0de 100644 --- a/examples/MANUAL.md +++ b/examples/MANUAL.md @@ -101,18 +101,6 @@ is provided so the application can be easily adapted to any environment. This mode can also be combined with a "test database" in InfluxDB to give yourself a "test config file" you may run ad-hoc to test changes. - max_errors default: 0 - If you restart the UniFI controller, the poller will lose access until - it is restarted. Specifying a number greater than -1 for max_errors will - cause the poller to exit when it reaches the error count specified. - This problematic condition can be triggered by InfluxDB having issues - too. Generally only 1 error per interval is created, but if more than one - backend is having issues > 1 error could be generated per interval. Once - the poller exits, it is expected that something will restart it - automatically so it gets back in line; something is usually systemd, - docker or launchd. The default setting of 0 will cause an exit after - just 1 error. Recommended values are 0-5. - influx_url default: http://127.0.0.1:8086 This is the URL where the Influx web server is available. diff --git a/examples/up.conf.example b/examples/up.conf.example index 5be538f1..ae6497e7 100644 --- a/examples/up.conf.example +++ b/examples/up.conf.example @@ -31,12 +31,6 @@ quiet = false # or a simple crontab to keep the timings accurate on UniFi Poller run intervals. mode = "influx" -# If the poller experiences an error from the UniFi controller or from InfluxDB -# it will exit. If you do not want it to exit, change max_errors to -1. You can -# adjust the config to tolerate more errors by setting this to a higher value. -# Recommend setting this between 0 and 5. See man page for more explanation. -max_errors = 0 - # InfluxDB does not require auth by default, so the user/password are probably unimportant. influx_url = "http://127.0.0.1:8086" influx_user = "unifi" diff --git a/examples/up.json.example b/examples/up.json.example index 7b2701b5..e59ec7c3 100644 --- a/examples/up.json.example +++ b/examples/up.json.example @@ -4,7 +4,6 @@ "debug": false, "quiet": false, "mode": "influx", - "max_errors": 0, "influx_url": "http://127.0.0.1:8086", "influx_user": "unifi", "influx_pass": "unifi", diff --git a/examples/up.xml.example b/examples/up.xml.example index b7464c94..87f1cac5 100644 --- a/examples/up.xml.example +++ b/examples/up.xml.example @@ -48,14 +48,6 @@ --> influx - - 0 - diff --git a/examples/up.yaml.example b/examples/up.yaml.example index bd7300b6..1042c4e1 100644 --- a/examples/up.yaml.example +++ b/examples/up.yaml.example @@ -32,12 +32,6 @@ quiet: false # or a simple crontab to keep the timings accurate on UniFi Poller run intervals. mode: "influx" -# If the poller experiences an error from the UniFi controller or from InfluxDB -# it will exit. If you do not want it to exit, change max_errors to -1. You can -# adjust the config to tolerate more errors by setting this to a higher value. -# Recommend setting this between 0 and 5. See man page for more explanation. -max_errors: 0 - # InfluxDB does not require auth by default, so the user/password are probably unimportant. influx_url: "http://127.0.0.1:8086" influx_user: "unifi" diff --git a/unifipoller/config.go b/unifipoller/config.go index fcc453ec..12ccf535 100644 --- a/unifipoller/config.go +++ b/unifipoller/config.go @@ -69,7 +69,6 @@ type Metrics struct { // This is all of the data stored in the config file. // Any with explicit defaults have _omitempty on json and toml tags. type Config struct { - MaxErrors int `json:"max_errors" toml:"max_errors" xml:"max_errors" yaml:"max_errors" env:"MAX_ERRORS"` Interval Duration `json:"interval,_omitempty" toml:"interval,_omitempty" xml:"interval" yaml:"interval" env:"POLLING_INTERVAL"` Debug bool `json:"debug" toml:"debug" xml:"debug" yaml:"debug" env:"DEBUG_MODE"` Quiet bool `json:"quiet,_omitempty" toml:"quiet,_omitempty" xml:"quiet" yaml:"quiet" env:"QUIET_MODE"` diff --git a/unifipoller/helpers.go b/unifipoller/helpers.go index c2e0fce4..8adf54be 100644 --- a/unifipoller/helpers.go +++ b/unifipoller/helpers.go @@ -11,7 +11,7 @@ import ( func (u *UnifiPoller) LogError(err error, prefix string) { if err != nil { u.errorCount++ - _ = log.Output(2, fmt.Sprintf("[ERROR] (%v/%v) %v: %v", u.errorCount, u.Config.MaxErrors, prefix, err)) + _ = log.Output(2, fmt.Sprintf("[ERROR] %v: %v", prefix, err)) } } diff --git a/unifipoller/unifi.go b/unifipoller/unifi.go index 85bb19c6..82fb040c 100644 --- a/unifipoller/unifi.go +++ b/unifipoller/unifi.go @@ -62,9 +62,8 @@ func (u *UnifiPoller) PollController() error { // Only run this if the authentication procedure didn't return error. _ = u.CollectAndReport() } - if u.Config.MaxErrors >= 0 && u.errorCount > u.Config.MaxErrors { - return fmt.Errorf("reached maximum error count, stopping poller (%d > %d)", - u.errorCount, u.Config.MaxErrors) + if u.errorCount > 0 { + return fmt.Errorf("controller or influxdb errors, stopping poller") } } return nil