Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.next.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -208,6 +208,7 @@ https://github.com/elastic/beats/compare/v8.8.1\...main[Check the HEAD diff]
- Fix http server helper SSL config. {pull}39405[39405]
- Fix Kubernetes metadata sometimes not being present after startup {pull}41216[41216]
- Do not report non-existant 0 values for RSS metrics in docker/memory {pull}41449[41449]
- Log Cisco Meraki `getDevicePerformanceScores` errors without stopping metrics collection. {pull}41622[41622]


*Osquerybeat*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,10 +98,7 @@ func (m *MetricSet) Fetch(reporter mb.ReporterV2) error {
return fmt.Errorf("getDeviceStatuses failed; %w", err)
}

err = getDevicePerformanceScores(m.client, devices)
if err != nil {
return fmt.Errorf("getDevicePerformanceScores failed; %w", err)
}
getDevicePerformanceScores(m.logger, m.client, devices)

err = getDeviceChannelUtilization(m.client, devices, collectionPeriod)
if err != nil {
Expand Down
12 changes: 8 additions & 4 deletions x-pack/metricbeat/module/meraki/device_health/devices.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import (
"time"

"github.com/elastic/beats/v7/metricbeat/mb"
"github.com/elastic/elastic-agent-libs/logp"
"github.com/elastic/elastic-agent-libs/mapstr"

meraki "github.com/meraki/dashboard-api-go/v3/sdk"
Expand Down Expand Up @@ -67,7 +68,7 @@ func getDeviceStatuses(client *meraki.Client, organizationID string, devices map
return nil
}

func getDevicePerformanceScores(client *meraki.Client, devices map[Serial]*Device) error {
func getDevicePerformanceScores(logger *logp.Logger, client *meraki.Client, devices map[Serial]*Device) {
for _, device := range devices {
// attempting to get a performance score for a non-MX device returns a 400
if strings.Index(device.details.Model, "MX") != 0 {
Expand All @@ -76,16 +77,19 @@ func getDevicePerformanceScores(client *meraki.Client, devices map[Serial]*Devic

val, res, err := client.Appliance.GetDeviceAppliancePerformance(device.details.Serial)
if err != nil {
return fmt.Errorf("GetDeviceAppliancePerformance failed; [%d] %s. %w", res.StatusCode(), res.Body(), err)
if res.StatusCode() == 400 && strings.Contains(string(res.Body()), "Feature not supported") {
continue
}

logger.Errorf("GetDeviceAppliancePerformance failed; [%d] %s. %v", res.StatusCode(), res.Body(), err)
continue
}

// 204 indicates there is no data for the device, it's likely 'offline' or 'dormant'
if res.StatusCode() != 204 {
device.performanceScore = val
}
}

return nil
}

func getDeviceChannelUtilization(client *meraki.Client, devices map[Serial]*Device, period time.Duration) error {
Expand Down
Loading