Skip to content

Commit

Permalink
Not error if meraki response is 400 (#641)
Browse files Browse the repository at this point in the history
  • Loading branch information
i3149 authored Dec 8, 2023
1 parent 6a8bba1 commit 0779c49
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions pkg/inputs/snmp/x/meraki/meraki.go
Original file line number Diff line number Diff line change
Expand Up @@ -557,6 +557,9 @@ func (c *MerakiClient) getDeviceClientApplications(dur time.Duration, clients []
func (c *MerakiClient) getDeviceClients(dur time.Duration) ([]*kt.JCHF, error) {
networkDevs, err := c.getNetworkDevices()
if err != nil {
if strings.Contains(err.Error(), "(status 400)") { // There are no valid network devices to worry about here.
return nil, nil
}
return nil, err
}

Expand Down Expand Up @@ -829,6 +832,9 @@ func (c *MerakiClient) getUplinks(dur time.Duration) ([]*kt.JCHF, error) {
for _, org := range c.orgs {
err := getUplinkStatus("", org, &uplinks)
if err != nil {
if strings.Contains(err.Error(), "(status 400)") { // There are no valid uplinks to worry about here.
return nil, nil
}
return nil, err
}
}
Expand Down Expand Up @@ -1107,6 +1113,9 @@ func (c *MerakiClient) getVpnStatus(dur time.Duration) ([]*kt.JCHF, error) {
for _, org := range c.orgs {
err := getVpnStatus("", org, &vpns)
if err != nil {
if strings.Contains(err.Error(), "(status 400)") { // There are no valid vpns to worry about here.
return nil, nil
}
return nil, err
}
}
Expand Down Expand Up @@ -1275,6 +1284,9 @@ func (c *MerakiClient) getDeviceStatus(dur time.Duration) ([]*kt.JCHF, error) {
for _, org := range c.orgs {
err := getDeviceStatus("", org, &devices)
if err != nil {
if strings.Contains(err.Error(), "(status 400)") { // There are no valid devices to worry about here.
return nil, nil
}
return nil, err
}
}
Expand Down

0 comments on commit 0779c49

Please sign in to comment.