diff --git a/cmd/api.go b/cmd/api.go index 9e19979..87d9225 100644 --- a/cmd/api.go +++ b/cmd/api.go @@ -78,8 +78,6 @@ func init() { Msg("Can't bind flag ratelimit") return } - - setDeviceDefaults() } var apiCMD = &cobra.Command{ @@ -94,6 +92,8 @@ var apiCMD = &cobra.Command{ return err } + setDeviceDefaults() + if !(viper.GetString("api.format") == "json" || viper.GetString("format") == "xml") { return errors.New("invalid api format set") } diff --git a/config/codecommunicator/ceraos-ip10.go b/config/codecommunicator/ceraos-ip10.go index 2761aa2..7fc902a 100644 --- a/config/codecommunicator/ceraos-ip10.go +++ b/config/codecommunicator/ceraos-ip10.go @@ -27,7 +27,7 @@ func (c *ceraosIP10Communicator) GetInterfaces(ctx context.Context) ([]device.In } for i, inter := range subInterfaces { - if regex.MatchString(*inter.IfDescr) { + if inter.IfDescr != nil && regex.MatchString(*inter.IfDescr) { targetInterface = inter copy(subInterfaces[i:], subInterfaces[i+1:]) subInterfaces = subInterfaces[:len(subInterfaces)-1] @@ -41,7 +41,7 @@ func (c *ceraosIP10Communicator) GetInterfaces(ctx context.Context) ([]device.In } for i := range subInterfaces { - if regex.MatchString(*subInterfaces[i].IfDescr) { + if subInterfaces[i].IfDescr != nil && regex.MatchString(*subInterfaces[i].IfDescr) { subInterfaces[i].IfOperStatus = targetInterface.IfOperStatus subInterfaces[i].IfInOctets = targetInterface.IfInOctets subInterfaces[i].IfOutOctets = targetInterface.IfOutOctets diff --git a/doc/doc.go b/doc/doc.go index c38de45..1be40e1 100644 --- a/doc/doc.go +++ b/doc/doc.go @@ -28,4 +28,4 @@ package doc // Version specifies the current version. -const Version = "v0.3.2" +const Version = "v0.3.3" diff --git a/go.mod b/go.mod index 24f9038..32cdcd0 100644 --- a/go.mod +++ b/go.mod @@ -9,7 +9,7 @@ require ( github.com/gomodule/redigo v1.8.4 github.com/google/go-cmp v0.5.4 github.com/gosnmp/gosnmp v1.30.0 - github.com/inexio/go-monitoringplugin v1.0.6 + github.com/inexio/go-monitoringplugin v1.0.7 github.com/jmoiron/sqlx v1.2.0 github.com/labstack/echo/v4 v4.2.1 github.com/mitchellh/colorstring v0.0.0-20190213212951-d06e56a500db diff --git a/go.sum b/go.sum index 665e8f3..7b99f42 100644 --- a/go.sum +++ b/go.sum @@ -139,8 +139,8 @@ github.com/hashicorp/serf v0.8.2/go.mod h1:6hOLApaqBFA1NXqRQAsxw9QxuDEvNxSQRwA/J github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU= github.com/inconshreveable/mousetrap v1.0.0 h1:Z8tu5sraLXCXIcARxBp/8cbvlwVa7Z1NHg9XEKhtSvM= github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8= -github.com/inexio/go-monitoringplugin v1.0.6 h1:tnxWon7lMtbDjWf2LdvUiMcaJ8DnnJ8CqeF462qJ5bg= -github.com/inexio/go-monitoringplugin v1.0.6/go.mod h1:kzHRJGZ2iE/0IElB4NYI38h3h0HM5wqTTH7KyUCjkM8= +github.com/inexio/go-monitoringplugin v1.0.7 h1:Aj47aNEykRJkaH/zEVOxFRF7/ekGDjyy7JofFi9SvK4= +github.com/inexio/go-monitoringplugin v1.0.7/go.mod h1:kzHRJGZ2iE/0IElB4NYI38h3h0HM5wqTTH7KyUCjkM8= github.com/jmoiron/sqlx v1.2.0 h1:41Ip0zITnmWNR/vHV+S4m+VoUivnWY5E4OJfLZjCJMA= github.com/jmoiron/sqlx v1.2.0/go.mod h1:1FEQNm3xlJgrMD+FBdI9+xvCksHtbpVBBw5dYhBSsks= github.com/jonboulle/clockwork v0.1.0/go.mod h1:Ii8DK3G1RaLaWxj9trq07+26W01tbo22gdxWY5EU2bo=