Merge pull request #480 from unpoller/bugfix-395

Invalid Influx URL causes unhelpful panic
This commit is contained in:
Cody Lee 2022-12-21 20:46:11 -06:00 committed by GitHub
commit 2bb5b1bd13
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 7 additions and 0 deletions

View File

@ -5,6 +5,7 @@ package influxunifi
import (
"crypto/tls"
"fmt"
"net/url"
"os"
"strconv"
"strings"
@ -154,6 +155,12 @@ func (u *InfluxUnifi) Run(c poller.Collect) error {
var err error
u.setConfigDefaults()
_, err = url.Parse(u.Config.URL)
if err != nil {
u.LogErrorf("invalid influx URL: %v", err)
return err
}
if u.IsVersion2 {
// we're a version 2