-
Notifications
You must be signed in to change notification settings - Fork 25.7k
Implement xpack.monitoring.elasticsearch.collection.enabled setting #33791
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
Implement xpack.monitoring.elasticsearch.collection.enabled setting #33791
Conversation
|
Pinging @elastic/es-core-infra |
…lastic#33474) * Implement xpack.monitoring.elasticsearch.collection.enabled setting * Fixing line lengths * Updating constructor calls in test * Removing unused import * Fixing line lengths in test classes * Make monitoringService.isElasticsearchCollectionEnabled() return true for tests * Remove wrong expectation * Adding unit tests for new flag to be false * Fixing line wrapping/indentation for better readability * Adding docs * Fixing logic in ClusterStatsCollector::shouldCollect * Rebasing with master and resolving conflicts * Simplifying implementation by gating scheduling * Doc fixes / improvements * Making methods package private * Fixing wording * Fixing method access
3187d85 to
bbf01c9
Compare
| --------------------------------------------------- | ||
| xpack.monitoring.collection.enabled: true | ||
| xpack.monitoring.elasticsearch.collection.enabled: false | ||
| --------------------------------------------------- |
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.
Sorry, I missed the master pull request.
There's a subtle thing that I am missing, because in the current state xpack.monitoring.elasticsearch.collection.enabled seems to be a duplicate of xpack.monitoring.collection.enabled to me.
Today xpack.monitoring.collection.enabled controls the collection of the local Elasticsearch cluster and has no impact on how Beats/LS/KB monitoring data are exported. Is the plan to change that?
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.
Hi @tlrx, sorry for any confusion. Let me try to clarify how things are working right now (I just tested in master to confirm).
Conceptually, the xpack.monitoring.collection.enabled setting does everything the xpack.monitoring.elasticsearch.collection.enabled setting does and more. The xpack.monitoring.collection.enabled setting controls whether all of Monitoring should be on or off. With it on, the xpack.monitoring.elasticsearch.collection.enabled setting can then be used to turn off just Elasticsearch monitoring. Conceptually this setting is similar to the xpack.monitoring.kibana.collection.enabled setting that can be set in kibana.yml to turn off just Kibana monitoring.
Put differently:
The xpack.monitoring.elasticsearch.collection.enabled setting stops collection of only Elasticsearch monitoring data. Monitoring data from other products (Beats/LS/KB) sent to the bulk monitoring API endpoint will still be exported and indexed into monitoring indices.
On the other hand, the xpack.monitoring.collection.enabled setting stops collection of Elasticsearch monitoring data and ignores any monitoring data sent from other products (Beats/LS/KB) sent to the bulk monitoring API endpoint. Therefore, no monitoring data is exported and indexed into monitoring indices.
You can verify this as follows:
- Start up Elasticsearch and Kibana with default settings + basic license (default build).
- At this point no monitoring data should be indexed. Verify this with:
GET _cat/indices/.m*` - Turn on all monitoring with:
PUT _cluster/settings { "persistent": { "xpack.monitoring.collection.enabled": true } } - After 30s or so, verify that both ES and Kibana monitoring indices are being created and growing, with:
GET _cat/indices/.m*` - Now turn off only Elasticsearch monitoring with:
PUT _cluster/settings { "persistent": { "xpack.monitoring.elasticsearch.collection.enabled": false } } - After 30s or so, verify that only Kibana monitoring indices are growing but the Elasticsearc monitoring indices have stopped growing, with:
GET _cat/indices/.m*`
Does that help?
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.
Thanks for the reminder! I was looking at where ENABLED was used - and saw nothing in the monitoring bulk code - but looking at where the isMonitoringActive() is used answered my question.
tlrx
left a comment
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
Backport of #33474.
This PR implements an optional setting named
xpack.monitoring.elasticsearch.collection.enabled, defaulting totrue.This setting will determine whether X-Pack Monitoring (when active overall) should collect Elasticsearch metrics or not.