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] Update cloudwatch metricset mappings #15245

Merged
merged 9 commits into from
Jan 9, 2020
Merged

[Metricbeat] Update cloudwatch metricset mappings #15245

merged 9 commits into from
Jan 9, 2020

Conversation

kaiyan-sheng
Copy link
Contributor

@kaiyan-sheng kaiyan-sheng commented Dec 20, 2019

This PR is to continue working on #14653 to update mappings in cloudwatch metrics and all the metricsets that are created using light module based on cloudwatch metricset.

Mapping change:
aws.cloudwatch.metrics.BurstBalance.avg -> aws.ebs.metrics.BurstBalance.avg
aws.cloudwatch.dimensions.VolumeId -> aws.dimensions.VolumeId

TODO - fix dashboards:

  • Fix ebs dashboard
  • Fix elb dashboard
  • Fix sns dashboard
  • Fix aws overview dashboard
  • Fix usage dashboard
  • Fix billing dashboard

TODO - regenerate data.json files in metricsets:

  • Regenerate data.json in cloudwatch
  • Regenerate data.json in ebs
  • Regenerate data.json in elb
  • Regenerate data.json in usage
  • Regenerate data.json in billing
  • Regenerate data.json in sns

How to test this

Make sure the AWS account you use for testing has multiple different services. Enalbe aws metricbeat module and modify aws.yml with:

- module: aws
  period: 1m
  metricsets:
    - usage
- module: aws
  period: 12h
  metricsets:
    - billing
- module: aws
  period: 5m
  metricsets:
    - ebs
    - elb
    - sns
  • Make sure ebs, elb, usage, billing, sns metricsets are reporting metrics
  • Make sure dashboards from the metricsets above are still working as well with the new mapping

Carlos Pérez-Aradros Herce and others added 5 commits November 20, 2019 16:57
AWS cloudwatch metrics were being reported under `aws.metrics`, but the
mapping definitions in `fields.yml` were expecting these under
`aws.cloudwatch.metrics`.

This change fixes that and refactors how metrics are handled when used
together with Lightweight modules. Metrics should now include the
metricset name in the path, example:

For cloudwatch metricset, metrics look like:

```
aws.cloudwatch.metrics.CPUUtilization.p10
aws.cloudwatch.dimensions.InstanceId
```

While when used from a lightweight module it produces:

```
aws.ebs.metrics.BurstBalance.avg
aws.cloudwatch.dimensions.VolumeId
```

I kept dimensions together as sometimes these can be used for
correlation, so having them under the same field helps.
@kaiyan-sheng kaiyan-sheng self-assigned this Dec 20, 2019
@kaiyan-sheng kaiyan-sheng added breaking change Metricbeat Metricbeat needs_backport PR is waiting to be backported to other branches. Team:Integrations Label for the Integrations team labels Dec 20, 2019
@kaiyan-sheng
Copy link
Contributor Author

Tried to change mapping to aws.*.*.* instead of aws.*.metrics.*.* didn't work. When trying with cloudwatch metricset to collect from AWS/EC2 namespace and the same time running ec2 metricset with config:

- module: aws
  period: 5m
  metricsets:
    - cloudwatch
  credential_profile_name: elastic-beats
  metrics:
    - namespace: AWS/EC2
      name: ["CPUUtilization", "DiskWriteOps"]
      tags.resource_type_filter: ec2:instance
      statistic: ["Average"]
- module: aws
  period: 5m
  credential_profile_name: elastic-beats
  metricsets:
    - ec2

I got error:

2019-12-20T14:38:57.997-0700    WARN    elasticsearch/client.go:516     Cannot index event publisher.Event{Content:beat.Event{Timestamp:time.Time{wall:0xbf776db6996b7df8, ext:2793788450, loc:(*time.Location)(0x95278e0)}, Meta:common.MapStr(nil), Fields:common.MapStr{"agent":common.MapStr{"ephemeral_id":"444e60bd-5a6f-4695-867f-f340e10bc9d9", "hostname":"KaiyanMacBookPro", "id":"23fd6ee9-2255-43f3-9565-78a051337c04", "type":"metricbeat", "version":"8.0.0"}, "aws":common.MapStr{"ec2":common.MapStr{"cpu":common.MapStr{"credit_balance":56.963139, "credit_usage":0.006812, "surplus_credit_balance":0, "surplus_credits_charged":0, "total":common.MapStr{"pct":0.1333880080189532}}, "diskio":common.MapStr{"read":common.MapStr{"bytes":0, "bytes_per_sec":0, "count":0, "count_per_sec":0}, "write":common.MapStr{"bytes":0, "bytes_per_sec":0, "count":0, "count_per_sec":0}}, "instance":common.MapStr{"core":common.MapStr{"count":1}, "image":common.MapStr{"id":"ami-00068cd7555f543d5"}, "monitoring":common.MapStr{"state":"disabled"}, "private":common.MapStr{"dns_name":"ip-172-31-81-156.ec2.internal", "ip":"172.31.81.156"}, "public":common.MapStr{"dns_name":"ec2-3-83-255-51.compute-1.amazonaws.com", "ip":"3.83.255.51"}, "state":common.MapStr{"code":16, "name":"running"}, "threads_per_core":1}, "network":common.MapStr{"in":common.MapStr{"bytes":815.8, "bytes_per_sec":2.719333333333333, "packets":8.4, "packets_per_sec":0.028}, "out":common.MapStr{"bytes":651.6, "bytes_per_sec":2.172, "packets":9.2, "packets_per_sec":0.030666666666666665}}, "status":common.MapStr{"check_failed":0, "check_failed_instance":0, "check_failed_system":0}}, "tags":common.MapStr{"created-by":"ks", "service":"mysql"}}, "cloud":common.MapStr{"account":common.MapStr{"id":"428152502467", "name":"elastic-beats"}, "availability_zone":"us-east-1b", "instance":common.MapStr{"id":"i-05381e495aa0f95ef"}, "machine":common.MapStr{"type":"t2.micro"}, "provider":"aws", "region":"us-east-1"}, "ecs":common.MapStr{"version":"1.2.0"}, "event":common.MapStr{"dataset":"aws.ec2", "duration":22486295401, "module":"aws"}, "host":common.MapStr{"architecture":"x86_64", "hostname":"KaiyanMacBookPro", "id":"9C7FAB7B-29D1-5926-8E84-158A9CA3E25D", "name":"KaiyanMacBookPro", "os":common.MapStr{"build":"17G9016", "family":"darwin", "kernel":"17.7.0", "name":"Mac OS X", "platform":"darwin", "version":"10.13.6"}}, "metricset":common.MapStr{"name":"ec2", "period":300000}, "service":common.MapStr{"type":"aws"}}, Private:interface {}(nil), TimeSeries:true}, Flags:0x0, Cache:publisher.EventCache{m:common.MapStr(nil)}} (status=400): {"type":"mapper_parsing_exception","reason":"failed to parse field [aws.ec2.network.in] of type [double] in document with id 'S7c_JW8BCg_wxAud1ac3'. Preview of field's value: '{packets_per_sec=0.028, bytes_per_sec=2.719333333333333, bytes=815.8, packets=8.4}'","caused_by":{"type":"json_parse_exception","reason":"Current token (START_OBJECT) not numeric, can not use numeric value accessors\n at [Source: org.elasticsearch.common.bytes.BytesReference$MarkSupportingStreamInputWrapper@16c0f5f3; line: 1, column: 186]"}}

If we use aws.*.*.* mapping, I guess anytime we run cloudwatch metricset before ec2 metricset, this error will happen. @exekias What do you think?

@kaiyan-sheng kaiyan-sheng marked this pull request as ready for review December 20, 2019 22:10
@kaiyan-sheng kaiyan-sheng requested a review from a team as a code owner December 20, 2019 22:10
@kaiyan-sheng kaiyan-sheng added the test-plan Add this PR to be manual test plan label Jan 4, 2020
@exekias exekias mentioned this pull request Jan 7, 2020
2 tasks
Copy link
Contributor

@exekias exekias left a comment

Choose a reason for hiding this comment

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

Thank you for taking this! I think metrics look now much better, the change should make them easier to discover 🎉

x-pack/metricbeat/module/aws/_meta/fields.yml Outdated Show resolved Hide resolved
@kaiyan-sheng
Copy link
Contributor Author

@exekias I updated all the data.json files and dashboards. This is ready for review. Thanks!

Copy link
Contributor

@exekias exekias left a comment

Choose a reason for hiding this comment

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

Could you please add a message into the breaking changes section of the CHANGELOG?

Also I guess existing PRs using cloudwatch will need to rebase

@kaiyan-sheng
Copy link
Contributor Author

Could you please add a message into the breaking changes section of the CHANGELOG?

Also I guess existing PRs using cloudwatch will need to rebase

@exekias The current changelog entry is already under breaking changes - metricbeat. Yes, two PRs for adding new aws metricset are waiting for this PR to get in first.

@exekias
Copy link
Contributor

exekias commented Jan 9, 2020

Ouch I'm blind 🙈, then 👍 to :shipit:

@kaiyan-sheng kaiyan-sheng merged commit 10fd6bd into elastic:master Jan 9, 2020
@kaiyan-sheng kaiyan-sheng deleted the update-cloudwatch-mappings branch January 9, 2020 15:06
@kaiyan-sheng kaiyan-sheng added v7.6.0 and removed needs_backport PR is waiting to be backported to other branches. labels Jan 9, 2020
kaiyan-sheng added a commit that referenced this pull request Jan 10, 2020
…appings (#15421)

* [Metricbeat] Update cloudwatch metricset mappings (#15245)

* Update AWS Cloudwatch mappings
* Update data json files and dashboards

Co-authored-by: Carlos Pérez-Aradros Herce <exekias@gmail.com>
(cherry picked from commit 10fd6bd)

* update changelog
@ChrsMark ChrsMark added the test-plan-ok This PR passed manual testing label Jan 21, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
breaking change Metricbeat Metricbeat review Team:Integrations Label for the Integrations team test-plan Add this PR to be manual test plan test-plan-ok This PR passed manual testing v7.6.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants