-
Notifications
You must be signed in to change notification settings - Fork 4.9k
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
Adding x-pack monitoring code for elasticsearch/ccr metricset #8336
Adding x-pack monitoring code for elasticsearch/ccr metricset #8336
Conversation
2eab02a
to
b75c7d2
Compare
Only CI failure is this unrelated flaky test: #8208. |
"timestamp": common.Time(time.Now()), | ||
"interval_ms": m.Module().Config().Period / time.Millisecond, | ||
"type": "ccr_stats", | ||
"ccr_stats": shard, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't schema be applied to this shard
? or metrics in x-pack are expected to be collected as they are?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Metrics in x-pack are passed through to mirror what internal Elasticsearch collectors are doing today. Eventually (probably in 8.0.0), once we have completely migrated over to Metricbeat for monitoring the Elastic stack and the internal ES collector code has been removed, we can add schemas to these metricset to be stricter in what we collect and ship to Elasticsearch.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, I was just wondering now what would be the experience of a user monitoring an OSS cluster with metricbeat when they start using x-pack 🤔
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jsoriano Just to make sure I'm understanding correctly: You mean if they try to monitor an OSS ES cluster with this metricset turned on and set xpack.enabled: true
in their modules/elasticsearch.yml
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I mean if they are using OSS, and then at some moment they upgrade to x-pack.
b75c7d2
to
d40611a
Compare
I followed the instructions but I'm not seeing any |
@chrisronline I'm able to reproduce what you're seeing locally as well. Will investigate and fix. |
@chrisronline The issue you found should be fixed now. Ready for review again. Thanks! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
Documents are as identical as expected!
c2f3a70
to
667ff7b
Compare
…#8422) This PR teaches the `elasticsearch/ccr` metricset to index documents into `.monitoring-es-6-*` indices when `xpack.enabled: true` is set in `modules.d/elasticsearch.yml`. ### To test this PR The idea is that metricbeat (specifically the elasticsearch/ccr metricset with `xpack.enabled: true`) will create exactly the same documents in `.monitoring-es-*` indices as Elasticsearch's internal collection and reporting does today. 1. Start up Elasticsearch (using the latest build from `master`). 2. Start up Kibana. 3. Start a trial license from the Kibana Management UI. 3. Enable Monitoring in Elasticsearch (via the cluster setting `xpack.monitoring.collection.enabled: true`). You can do this via [Elasticsearch's Cluster Update Settings API](https://www.elastic.co/guide/en/elasticsearch/reference/current/cluster-update-settings.html) or by clicking the "Turn on Monitoring" button in the Monitoring UI in Kibana. 4. Set up CCR with a leader and follower index. 4. Let Elasticsearch run for ~20 seconds so a few documents are indexed into `.monitoring-es-6-*`. 6. From `.monitoring-es-6-*`, retrieve a document for `type = ccr_stats` 8. Turn off Elasticsearch's internal collection via the cluster setting `xpack.monitoring.elasticsearch.collection.enabled: false`. 7. Delete `.monitoring-es-6-*` indices. 10. Enable the `elasticsearch` module in metricbeat: `./metricbeat modules enable elasticsearch`. 11. In `modules.d/elasticsearch.yml`, add the `ccr` metricset and set `xpack.enabled: true`. Concretely, your `modules.d/elasticsearch.yml` should look something like this: ```yaml - module: elasticsearch metricsets: - ccr period: 10s hosts: ["http://localhost:9200"] #username: "user" #password: "secret" xpack.enabled: true ``` 12. Start metricbeat. 13. Let metricbeat run for ~20 seconds so a few documents are indexed into `.monitoring-es-*`. 14. Stop metricbeat 6. From `.monitoring-es-6-*`, retrieve a document for `type = ccr_stats` 16. Using a tool such as http://www.jsondiff.com, compare the documents indexed by Elasticsearch with those indexed by metricbeat. Verify that their structures are identical (same fields, not necessarily same values), except for these known and expected differences: 1. Only Metricbeat-indexed documents are expected to contain the fields `@timestamp`, `beat`, `host`, and `metricset`. These are "standard" fields added by beats and metricbeat and don't have an adverse impact since they are additive. 3. Only Elasticsearch-indexed documents are expected to contain the field `source_node`. This field is used for debugging purposes only and not actually consumed by either the Monitoring UI or Telemetry feature in Kibana. (cherry picked from commit 35068ee)
This PR teaches the
elasticsearch/ccr
metricset to index documents into.monitoring-es-6-*
indices whenxpack.enabled: true
is set inmodules.d/elasticsearch.yml
.To test this PR
The idea is that metricbeat (specifically the elasticsearch/ccr metricset with
xpack.enabled: true
) will create exactly the same documents in.monitoring-es-*
indices as Elasticsearch's internal collection and reporting does today.Start up Elasticsearch (using the latest build from
master
).Start up Kibana.
Start a trial license from the Kibana Management UI.
Enable Monitoring in Elasticsearch (via the cluster setting
xpack.monitoring.collection.enabled: true
). You can do this via Elasticsearch's Cluster Update Settings API or by clicking the "Turn on Monitoring" button in the Monitoring UI in Kibana.Set up CCR with a leader and follower index.
Let Elasticsearch run for ~20 seconds so a few documents are indexed into
.monitoring-es-6-*
.From
.monitoring-es-6-*
, retrieve a document fortype = ccr_stats
Turn off Elasticsearch's internal collection via the cluster setting
xpack.monitoring.elasticsearch.collection.enabled: false
.Delete
.monitoring-es-6-*
indices.Enable the
elasticsearch
module in metricbeat:./metricbeat modules enable elasticsearch
.In
modules.d/elasticsearch.yml
, add theccr
metricset and setxpack.enabled: true
. Concretely, yourmodules.d/elasticsearch.yml
should look something like this:Start metricbeat.
Let metricbeat run for ~20 seconds so a few documents are indexed into
.monitoring-es-*
.Stop metricbeat
From
.monitoring-es-6-*
, retrieve a document fortype = ccr_stats
Using a tool such as http://www.jsondiff.com, compare the documents indexed by Elasticsearch with those indexed by metricbeat. Verify that their structures are identical (same fields, not necessarily same values), except for these known and expected differences:
@timestamp
,beat
,host
, andmetricset
. These are "standard" fields added by beats and metricbeat and don't have an adverse impact since they are additive.source_node
. This field is used for debugging purposes only and not actually consumed by either the Monitoring UI or Telemetry feature in Kibana.