Skip to content

Commit

Permalink
[metricbeat] [meraki] Ignore 400 error for unsupported per-device lic…
Browse files Browse the repository at this point in the history
…ensing (#42397)

* dont error in getDeviceLicenses

* add changelog entry

* fix pr id

* keep error and check for bad request

* check response body

---------

Co-authored-by: Ishleen Kaur <102962586+ishleenk17@users.noreply.github.com>
  • Loading branch information
gpop63 and ishleenk17 authored Jan 29, 2025
1 parent 27b714d commit b5f726b
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.next.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -249,6 +249,7 @@ https://github.com/elastic/beats/compare/v8.8.1\...main[Check the HEAD diff]
- Fixed `creation_date` scientific notation output in the `elasticsearch.index` metricset. {pull}42053[42053]
- Fix bug where metricbeat unintentionally triggers Windows ASR. {pull}42177[42177]
- Remove `hostname` field from zookeeper's `mntr` data stream. {pull}41887[41887]
- Continue collecting metrics even if the Cisco Meraki `getDeviceLicenses` operation fails. {pull}42397[42397]

*Osquerybeat*

Expand Down
4 changes: 4 additions & 0 deletions x-pack/metricbeat/module/meraki/device_health/devices.go
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,10 @@ func getDeviceChannelUtilization(client *meraki.Client, devices map[Serial]*Devi
func getDeviceLicenses(client *meraki.Client, organizationID string, devices map[Serial]*Device) error {
val, res, err := client.Organizations.GetOrganizationLicenses(organizationID, &meraki.GetOrganizationLicensesQueryParams{})
if err != nil {
// Ignore 400 error for per-device licensing not supported
if res.StatusCode() == 400 && strings.Contains(string(res.Body()), "does not support per-device licensing") {
return nil
}
return fmt.Errorf("GetOrganizationLicenses failed; [%d] %s. %w", res.StatusCode(), res.Body(), err)
}

Expand Down

0 comments on commit b5f726b

Please sign in to comment.