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

Collect license expiry date fields as well #11652

Merged
merged 2 commits into from
Apr 30, 2019

Conversation

ycombinator
Copy link
Contributor

@ycombinator ycombinator commented Apr 4, 2019

This PR teaches the elasticsearch.cluster_stats metricset (x-pack code path) to collect and index the license expiration fields, expiry_date and expiry_date_in_millis as well.

Testing this PR

Basic license

  1. Start Elasticsearch with a Basic license.
  2. Delete .monitoring-es-* indices to start with a clean slate (making it easier to test).
    DELETE .monitoring-es-*
    
  3. Turn on Elasticsearch monitoring via the native collection method.
  4. Wait ~15 seconds for documents to be indexed into .monitoring-es-*.
  5. Check the value of the license field indexed into a .monitoring-es-* document with type:cluster_stats. In particular, note that it is missing the expiry_date and expiry_date_in_millis sub-fields.
    POST .monitoring-es-7-*/_search?filter_path=**.license
    {
      "query": {
        "term": {
          "type": "cluster_stats"
        }
      }
    }
    
  6. Turn off Elasticsearch native collection.
    PUT _cluster/settings
    {
      "transient": {
        "xpack.monitoring.elasticsearch.collection.enabled": false
      }
    }
    
  7. Delete .monitoring-es-* indices to start with a clean slate (making it easier to test).
    DELETE .monitoring-es-*
    
  8. Build Metricbeat with this PR.
    cd $GOPATH/src/github.com/elastic/beats/metricbeat
    mage build
    
  9. Enable Elasticsearch collection via Metricbeat.
    ./metricbeat modules enable elasticsearch-xpack
    
  10. Start Metricbeat
    ./metricbeat
    
  11. Wait ~15 seconds for documents to be indexed into .monitoring-es-*.
  12. Check the value of the license field indexed into a .monitoring-es-* document with type:cluster_stats. In particular, verify that it is missing the expiry_date and expiry_date_in_millis sub-fields.
POST .monitoring-es-7-*/_search?filter_path=**.license
{
  "query": {
    "term": {
      "type": "cluster_stats"
    }
  }
}

Trial license

  1. Start Elasticsearch with a Trial license. If you started with a Basic license, you can upgrade to Trial via the Kibana License Management UI.
  2. Delete .monitoring-es-* indices to start with a clean slate (making it easier to test).
    DELETE .monitoring-es-*
    
  3. Turn on Elasticsearch monitoring via the native collection method.
  4. Wait ~15 seconds for documents to be indexed into .monitoring-es-*.
  5. Check the value of the license field indexed into a .monitoring-es-* document with type:cluster_stats. In particular, note that it includes the expiry_date and expiry_date_in_millis sub-fields.
    POST .monitoring-es-7-*/_search?filter_path=**.license
    {
      "query": {
        "term": {
          "type": "cluster_stats"
        }
      }
    }
    
  6. Turn off Elasticsearch native collection.
    PUT _cluster/settings
    {
      "transient": {
        "xpack.monitoring.elasticsearch.collection.enabled": false
      }
    }
    
  7. Delete .monitoring-es-* indices to start with a clean slate (making it easier to test).
    DELETE .monitoring-es-*
    
  8. Build Metricbeat with this PR.
    cd $GOPATH/src/github.com/elastic/beats/metricbeat
    mage build
    
  9. Enable Elasticsearch collection via Metricbeat.
    ./metricbeat modules enable elasticsearch-xpack
    
  10. Start Metricbeat
    ./metricbeat
    
  11. Wait ~15 seconds for documents to be indexed into .monitoring-es-*.
  12. Check the value of the license field indexed into a .monitoring-es-* document with type:cluster_stats. In particular, verify that it includes the expiry_date and expiry_date_in_millis sub-fields.
POST .monitoring-es-7-*/_search?filter_path=**.license
{
  "query": {
    "term": {
      "type": "cluster_stats"
    }
  }
}

@ycombinator ycombinator requested a review from a team as a code owner April 4, 2019 17:59
@elasticmachine
Copy link
Collaborator

Pinging @elastic/stack-monitoring

@cachedout
Copy link
Contributor

@ycombinator Do you have any recommendations on how to test this?

@ycombinator
Copy link
Contributor Author

Do you have any recommendations on how to test this?

Unfortunately there's no easy way to test this PR until elastic/elasticsearch#40872 is resolved first.

@ycombinator
Copy link
Contributor Author

jenkins, test this

Copy link
Contributor

@cachedout cachedout left a comment

Choose a reason for hiding this comment

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

LGTM

@ycombinator
Copy link
Contributor Author

@cachedout I've updated this PR per @tvernum's comment here: elastic/elasticsearch#40872 (comment). This is ready for review now. Thanks!

@ycombinator
Copy link
Contributor Author

jenkins, test this

Copy link
Contributor

@cachedout cachedout left a comment

Choose a reason for hiding this comment

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

👍

@ycombinator
Copy link
Contributor Author

jenkins, test this

@ycombinator ycombinator merged commit d83ad51 into elastic:master Apr 30, 2019
ycombinator added a commit to ycombinator/beats that referenced this pull request Apr 30, 2019
* Collect license expiry date fields as well

* Omit expiration date fields if absent
ycombinator added a commit that referenced this pull request Apr 30, 2019
* Collect license expiry date fields as well

* Omit expiration date fields if absent
@ycombinator ycombinator deleted the mb-es-xp-license-fields branch May 3, 2019 16:44
ycombinator added a commit to ycombinator/beats that referenced this pull request Jul 25, 2019
* Collect license expiry date fields as well

* Omit expiration date fields if absent
ycombinator added a commit that referenced this pull request Jul 25, 2019
* Collect license expiry date fields as well

* Omit expiration date fields if absent
@ycombinator ycombinator removed the needs_backport PR is waiting to be backported to other branches. label Jan 15, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants