Skip to content

Commit 0779c49

Browse files
authored
Not error if meraki response is 400 (#641)
1 parent 6a8bba1 commit 0779c49

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

pkg/inputs/snmp/x/meraki/meraki.go

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -557,6 +557,9 @@ func (c *MerakiClient) getDeviceClientApplications(dur time.Duration, clients []
557557
func (c *MerakiClient) getDeviceClients(dur time.Duration) ([]*kt.JCHF, error) {
558558
networkDevs, err := c.getNetworkDevices()
559559
if err != nil {
560+
if strings.Contains(err.Error(), "(status 400)") { // There are no valid network devices to worry about here.
561+
return nil, nil
562+
}
560563
return nil, err
561564
}
562565

@@ -829,6 +832,9 @@ func (c *MerakiClient) getUplinks(dur time.Duration) ([]*kt.JCHF, error) {
829832
for _, org := range c.orgs {
830833
err := getUplinkStatus("", org, &uplinks)
831834
if err != nil {
835+
if strings.Contains(err.Error(), "(status 400)") { // There are no valid uplinks to worry about here.
836+
return nil, nil
837+
}
832838
return nil, err
833839
}
834840
}
@@ -1107,6 +1113,9 @@ func (c *MerakiClient) getVpnStatus(dur time.Duration) ([]*kt.JCHF, error) {
11071113
for _, org := range c.orgs {
11081114
err := getVpnStatus("", org, &vpns)
11091115
if err != nil {
1116+
if strings.Contains(err.Error(), "(status 400)") { // There are no valid vpns to worry about here.
1117+
return nil, nil
1118+
}
11101119
return nil, err
11111120
}
11121121
}
@@ -1275,6 +1284,9 @@ func (c *MerakiClient) getDeviceStatus(dur time.Duration) ([]*kt.JCHF, error) {
12751284
for _, org := range c.orgs {
12761285
err := getDeviceStatus("", org, &devices)
12771286
if err != nil {
1287+
if strings.Contains(err.Error(), "(status 400)") { // There are no valid devices to worry about here.
1288+
return nil, nil
1289+
}
12781290
return nil, err
12791291
}
12801292
}

0 commit comments

Comments
 (0)