Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[metricbeat] meraki module with device_health metricset #40836

Merged

Conversation

tommyers-elastic
Copy link
Contributor

@tommyers-elastic tommyers-elastic commented Sep 15, 2024

Proposed commit message

Checklist

  • My code follows the style guidelines of this project
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • I have made corresponding change to the default configuration files
  • I have added tests that prove my fix is effective or that my feature works
  • I have added an entry in CHANGELOG.next.asciidoc or CHANGELOG-developer.next.asciidoc.

Disruptive User Impact

Author's Checklist

  • [ ]

How to test this PR locally

Related issues

Use cases

Screenshots

Logs

DanH-Semplicity and others added 25 commits August 30, 2024 23:14
…c associations.

This commit removes a couple of data points from the original code, namely:
 - network appliance port settings - these settings are not defined per-device,
   but per-network, and as such don't fit into the current naming taxonomy.
 - site-to-site VPN settings - similarly to the above, these are not per-device attibutes.

In addition there is a limitation included on including only a single metric bucket (as returned
from the API) per metricbeat collection loop. There needs to be some better logging/config
validation on this, which will come later; for now, just run with a maximum 5 minute collection
interval.

This commit includes the field mappings too, but it currently causes events to get dropped due
to the index field limit getting hit (max 10k fields). You can get around this by setting
'setup.template.settings.index.mapping.total_fields.limit' to a higher value. We maybe can't
include all these mappings in the metricbeat module, but for now they are here to allow testing
with standalone metricbeat.
…d latency metrics.

Remove 'percent' units, because the data does not fit the 0-1 elastic interpretation of percent.
@ishleenk17
Copy link
Contributor

The lint error is due to implicit memory aliasing within for loop.
Something like this might help resolving the error ?

portCopy := port
switchports = append(switchports, &switchport{port: &portCopy})

@tommyers-elastic
Copy link
Contributor Author

The lint error is due to implicit memory aliasing within for loop. Something like this might help resolving the error ?

portCopy := port
switchports = append(switchports, &switchport{port: &portCopy})

ah yeh thanks, i thought i fixed all these already. this issue actually has dissapeared in go1.22. i was gonna just put a global ignore rule for the linter error, but figured it might be easier to just guard against in the code. maybe i'll do both.

@tommyers-elastic
Copy link
Contributor Author

the more of these i fix the more the linter seems to find. since there's not really any need to do it, i reverted the fixes and added the exclude rule for the linkter.

…ng that change and putting back the annoying index loop code
@tommyers-elastic tommyers-elastic added the backport-8.15 Automated backport to the 8.15 branch with mergify label Sep 17, 2024
go.mod Outdated Show resolved Hide resolved
Copy link
Member

@cmacknz cmacknz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approving go.mod changes.

@tommyers-elastic tommyers-elastic merged commit ae71c67 into elastic:main Sep 17, 2024
125 checks passed
mergify bot pushed a commit that referenced this pull request Sep 17, 2024
* inital meraki module and metricsets

* initial refactor for single meraki metricset device_health

* added tunnel support aka VPN support by Device

* adding interfaces aka switch ports and switch port status

* processing review comments

* refactored for comments

* fixing default metricset

* Removing unused variables and adding text to required variables

* add go module deps

* fixing for loop and starting on fields yml

* remove %d from loop condition

* fixing review comments and loss latency

* update dashboard-api lib to version with MIT licensed ratelimiter

* remove unused fields in metricset struct

* remove device details for now

* Major refactor to improve overall readability and device status/metric associations.

This commit removes a couple of data points from the original code, namely:
 - network appliance port settings - these settings are not defined per-device,
   but per-network, and as such don't fit into the current naming taxonomy.
 - site-to-site VPN settings - similarly to the above, these are not per-device attibutes.

In addition there is a limitation included on including only a single metric bucket (as returned
from the API) per metricbeat collection loop. There needs to be some better logging/config
validation on this, which will come later; for now, just run with a maximum 5 minute collection
interval.

This commit includes the field mappings too, but it currently causes events to get dropped due
to the index field limit getting hit (max 10k fields). You can get around this by setting
'setup.template.settings.index.mapping.total_fields.limit' to a higher value. We maybe can't
include all these mappings in the metricbeat module, but for now they are here to allow testing
with standalone metricbeat.

* Add maximum collection interval check to avoid missing uplink loss and latency metrics.

Remove 'percent' units, because the data does not fit the 0-1 elastic interpretation of percent.

* revert accidental changes to reference config

* add example in data.json

* review comments: license headers, missing/incorrect mapping

* result of 'go mod tidy' ... trying to unblock the CI builds

* fix linter issues

* update NOTICE.txt

* add release tag to fields.yml, update docs

* review feedback: keyword -> dat

* commit results of 'make update' in x-pack metricbeat for CI

* remove mappings to avoid hitting field limits in global metricbeat index template

* add one field back to please the docs CI

* more linter errors guarding against shared loop var pointers

* fix error introduced in previous commit

* add exception for golangci-lint G601 which is no longer required in go1.22+

* remove the guards against taking addresses of loop vars

* i can't get the golanglint-ci config to get picked up, so i'm reverting that change and putting back the annoying index loop code

* Update go.mod to match toolchain version to .go-version

Co-authored-by: Craig MacKenzie <[email protected]>

---------

Co-authored-by: Dan Hiebert <[email protected]>
Co-authored-by: Craig MacKenzie <[email protected]>
(cherry picked from commit ae71c67)

# Conflicts:
#	NOTICE.txt
#	go.mod
#	go.sum
#	x-pack/metricbeat/metricbeat.reference.yml
mergify bot pushed a commit that referenced this pull request Sep 17, 2024
* inital meraki module and metricsets

* initial refactor for single meraki metricset device_health

* added tunnel support aka VPN support by Device

* adding interfaces aka switch ports and switch port status

* processing review comments

* refactored for comments

* fixing default metricset

* Removing unused variables and adding text to required variables

* add go module deps

* fixing for loop and starting on fields yml

* remove %d from loop condition

* fixing review comments and loss latency

* update dashboard-api lib to version with MIT licensed ratelimiter

* remove unused fields in metricset struct

* remove device details for now

* Major refactor to improve overall readability and device status/metric associations.

This commit removes a couple of data points from the original code, namely:
 - network appliance port settings - these settings are not defined per-device,
   but per-network, and as such don't fit into the current naming taxonomy.
 - site-to-site VPN settings - similarly to the above, these are not per-device attibutes.

In addition there is a limitation included on including only a single metric bucket (as returned
from the API) per metricbeat collection loop. There needs to be some better logging/config
validation on this, which will come later; for now, just run with a maximum 5 minute collection
interval.

This commit includes the field mappings too, but it currently causes events to get dropped due
to the index field limit getting hit (max 10k fields). You can get around this by setting
'setup.template.settings.index.mapping.total_fields.limit' to a higher value. We maybe can't
include all these mappings in the metricbeat module, but for now they are here to allow testing
with standalone metricbeat.

* Add maximum collection interval check to avoid missing uplink loss and latency metrics.

Remove 'percent' units, because the data does not fit the 0-1 elastic interpretation of percent.

* revert accidental changes to reference config

* add example in data.json

* review comments: license headers, missing/incorrect mapping

* result of 'go mod tidy' ... trying to unblock the CI builds

* fix linter issues

* update NOTICE.txt

* add release tag to fields.yml, update docs

* review feedback: keyword -> dat

* commit results of 'make update' in x-pack metricbeat for CI

* remove mappings to avoid hitting field limits in global metricbeat index template

* add one field back to please the docs CI

* more linter errors guarding against shared loop var pointers

* fix error introduced in previous commit

* add exception for golangci-lint G601 which is no longer required in go1.22+

* remove the guards against taking addresses of loop vars

* i can't get the golanglint-ci config to get picked up, so i'm reverting that change and putting back the annoying index loop code

* Update go.mod to match toolchain version to .go-version

Co-authored-by: Craig MacKenzie <[email protected]>

---------

Co-authored-by: Dan Hiebert <[email protected]>
Co-authored-by: Craig MacKenzie <[email protected]>
(cherry picked from commit ae71c67)
tommyers-elastic added a commit that referenced this pull request Sep 17, 2024
)

* inital meraki module and metricsets

* initial refactor for single meraki metricset device_health

* added tunnel support aka VPN support by Device

* adding interfaces aka switch ports and switch port status

* processing review comments

* refactored for comments

* fixing default metricset

* Removing unused variables and adding text to required variables

* add go module deps

* fixing for loop and starting on fields yml

* remove %d from loop condition

* fixing review comments and loss latency

* update dashboard-api lib to version with MIT licensed ratelimiter

* remove unused fields in metricset struct

* remove device details for now

* Major refactor to improve overall readability and device status/metric associations.

This commit removes a couple of data points from the original code, namely:
 - network appliance port settings - these settings are not defined per-device,
   but per-network, and as such don't fit into the current naming taxonomy.
 - site-to-site VPN settings - similarly to the above, these are not per-device attibutes.

In addition there is a limitation included on including only a single metric bucket (as returned
from the API) per metricbeat collection loop. There needs to be some better logging/config
validation on this, which will come later; for now, just run with a maximum 5 minute collection
interval.

This commit includes the field mappings too, but it currently causes events to get dropped due
to the index field limit getting hit (max 10k fields). You can get around this by setting
'setup.template.settings.index.mapping.total_fields.limit' to a higher value. We maybe can't
include all these mappings in the metricbeat module, but for now they are here to allow testing
with standalone metricbeat.

* Add maximum collection interval check to avoid missing uplink loss and latency metrics.

Remove 'percent' units, because the data does not fit the 0-1 elastic interpretation of percent.

* revert accidental changes to reference config

* add example in data.json

* review comments: license headers, missing/incorrect mapping

* result of 'go mod tidy' ... trying to unblock the CI builds

* fix linter issues

* update NOTICE.txt

* add release tag to fields.yml, update docs

* review feedback: keyword -> dat

* commit results of 'make update' in x-pack metricbeat for CI

* remove mappings to avoid hitting field limits in global metricbeat index template

* add one field back to please the docs CI

* more linter errors guarding against shared loop var pointers

* fix error introduced in previous commit

* add exception for golangci-lint G601 which is no longer required in go1.22+

* remove the guards against taking addresses of loop vars

* i can't get the golanglint-ci config to get picked up, so i'm reverting that change and putting back the annoying index loop code

* Update go.mod to match toolchain version to .go-version

Co-authored-by: Craig MacKenzie <[email protected]>

---------

Co-authored-by: Dan Hiebert <[email protected]>
Co-authored-by: Craig MacKenzie <[email protected]>
(cherry picked from commit ae71c67)

Co-authored-by: Tom Myers <[email protected]>
tommyers-elastic added a commit that referenced this pull request Sep 17, 2024
… metricset (#40862)

* [metricbeat] meraki module with device_health metricset    (#40836)

* inital meraki module and metricsets

* initial refactor for single meraki metricset device_health

* added tunnel support aka VPN support by Device

* adding interfaces aka switch ports and switch port status

* processing review comments

* refactored for comments

* fixing default metricset

* Removing unused variables and adding text to required variables

* add go module deps

* fixing for loop and starting on fields yml

* remove %d from loop condition

* fixing review comments and loss latency

* update dashboard-api lib to version with MIT licensed ratelimiter

* remove unused fields in metricset struct

* remove device details for now

* Major refactor to improve overall readability and device status/metric associations.

This commit removes a couple of data points from the original code, namely:
 - network appliance port settings - these settings are not defined per-device,
   but per-network, and as such don't fit into the current naming taxonomy.
 - site-to-site VPN settings - similarly to the above, these are not per-device attibutes.

In addition there is a limitation included on including only a single metric bucket (as returned
from the API) per metricbeat collection loop. There needs to be some better logging/config
validation on this, which will come later; for now, just run with a maximum 5 minute collection
interval.

This commit includes the field mappings too, but it currently causes events to get dropped due
to the index field limit getting hit (max 10k fields). You can get around this by setting
'setup.template.settings.index.mapping.total_fields.limit' to a higher value. We maybe can't
include all these mappings in the metricbeat module, but for now they are here to allow testing
with standalone metricbeat.

* Add maximum collection interval check to avoid missing uplink loss and latency metrics.

Remove 'percent' units, because the data does not fit the 0-1 elastic interpretation of percent.

* revert accidental changes to reference config

* add example in data.json

* review comments: license headers, missing/incorrect mapping

* result of 'go mod tidy' ... trying to unblock the CI builds

* fix linter issues

* update NOTICE.txt

* add release tag to fields.yml, update docs

* review feedback: keyword -> dat

* commit results of 'make update' in x-pack metricbeat for CI

* remove mappings to avoid hitting field limits in global metricbeat index template

* add one field back to please the docs CI

* more linter errors guarding against shared loop var pointers

* fix error introduced in previous commit

* add exception for golangci-lint G601 which is no longer required in go1.22+

* remove the guards against taking addresses of loop vars

* i can't get the golanglint-ci config to get picked up, so i'm reverting that change and putting back the annoying index loop code

* Update go.mod to match toolchain version to .go-version

Co-authored-by: Craig MacKenzie <[email protected]>

---------

Co-authored-by: Dan Hiebert <[email protected]>
Co-authored-by: Craig MacKenzie <[email protected]>
(cherry picked from commit ae71c67)

# Conflicts:
#	NOTICE.txt
#	go.mod
#	go.sum
#	x-pack/metricbeat/metricbeat.reference.yml

* fix go.mod merge conflict

* fix merge errors in NOTICE.txt

* fix merge errors in metricbeat.reference.yml

* add result of running 'mage update'

---------

Co-authored-by: Tom Myers <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport-8.x Automated backport to the 8.x branch with mergify backport-8.15 Automated backport to the 8.15 branch with mergify Team:Elastic-Agent-Data-Plane Label for the Agent Data Plane team
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants