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

[Monitoring] Migrate license expiration alert to Kibana alerting #54306

Merged
merged 41 commits into from
Feb 3, 2020

Conversation

chrisronline
Copy link
Contributor

@chrisronline chrisronline commented Jan 8, 2020

Relates to #42960
Replaces #49219

This is the first PR of a set of PRs aimed to migrate the six watcher-based cluster alerts to use the Kibana alerting framework.

This PR focuses on the license expiration alert, as well as laying out the foundation of how the rest of the alerts will be migrated.

There are three main things we need to do to accomplish this:

  1. Disable the (potentially) existing watcher-based cluster alerts
  2. Create a UI that allows the user to create kibana-based cluster alerts.
  3. Ensure UX parity between watcher-based and kibana-based cluster alerts.

For the first one, the ES team will be introducing an api that will allow us to do that from the UI (pending ticket creation). For testing this PR, let's assume those are disabled properly and we don't need to worry about that now.

For the second one, we want to slowly merge all of this work into master (to avoid one large PR) so we are going to add a constant that will be set to false until all of the alerts are ready. Then, the final PR will remove this constant and all of the new alerts will be available to users.

Finally, for the last one, we want to ensure the messaging is consistent (even though it might be somewhat poor) for this phase.

Screenshots

alerting

Screen Shot 2020-01-08 at 10 15 45 AM

Screen Shot 2020-01-08 at 10 15 50 AM

Testing

  1. Flip this switch to true

We need to easily simulate the scenario in which this alert would fire. To do that, we'll leverage the monitoring ingest pipeline to set an expiration date in the near future. See these commands:

# Add the ingest pipeline
PUT _ingest/pipeline/force_license_expiration
{
  "processors": [
    {
      "script": {
        "lang": "painless",
        "source": """
          if (ctx.type == "cluster_stats") {
            ctx.license.expiry_date_in_millis = Instant.ofEpochMilli(new Date().getTime()).plusSeconds(60 * 60 * 24 * 3).getEpochSecond() * 1000;
          }
        """
      }
    }
  ]
}
# Ensure a local exporter is explictly configured so the default pipeline is established
PUT _cluster/settings
{
  "transient": {
    "xpack.monitoring.exporters": { 
      "local": {
        "type": "local",
        "use_ingest": false
      }
    }
  }
}
# Use the created pipeline
PUT .monitoring-es-7-*/_settings
{
  "index.required_pipeline": "force_license_expiration"
}

# This will unset the pipeline (and therefore resolve the alert)
PUT .monitoring-es-7-*/_settings
{
  "index.required_pipeline": null
}

TODO

  • Once migrated, all stored alerts in .monitoring-alerts-* should be removed
  • Only users with the right permissions should be able to interact with this UI, see [Monitoring] Only elevated permission users should see Setup Mode #50327
  • Should we perform CCS queries when searching for monitoring data in the alert?
  • Create follow up issues to remove the default_admin_email logic since we aren't using that in the Kibana alerting world
  • Ensure alert is set to 1m interval

@chrisronline
Copy link
Contributor Author

@elasticmachine merge upstream

@chrisronline chrisronline marked this pull request as ready for review January 14, 2020 20:13
@chrisronline chrisronline added release_note:skip Skip the PR/issue when compiling release notes v7.7.0 v8.0.0 labels Jan 17, 2020
Copy link
Contributor

@igoristic igoristic left a comment

Choose a reason for hiding this comment

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

Looks good! Really excited about this feature 😃

@chrisronline
Copy link
Contributor Author

@elasticmachine merge upstream

@chrisronline chrisronline merged commit 6398a99 into elastic:master Feb 3, 2020
@chrisronline chrisronline deleted the monitoring/kibana_alerting branch February 3, 2020 20:56
chrisronline added a commit to chrisronline/kibana that referenced this pull request Feb 3, 2020
…stic#54306)

* License expiration

* Flip off

* Only require alerting and actions if enabled

* Support date formating and timezones in the alert UI messages, support ccs better

* Fix status tests

* Fix up front end tests

* Fix linting, and switch this back

* Add this back in so legacy alerts continue to work

* Fix type issues

* Handle CCS better

* Code cleanup

* Fix type issues

* Flip this off, and fix test

* Moved the email address config to advanced settings, but need help with test failures and typescript

* Fix issue with task manager

* Deprecate email_address

* Use any until we can figure out this TS issue

* Fix type issue

* More tests

* Fix mocha tests

* Use mock instead of any

* I'm not sure why these changed...

* Provide timezone in moment usage in tests for consistency

* Fix type issue

* Change how we get dateFormat and timezone

* Change where we calculate the dates to show in the alerts UI

* Show deprecation warning based on the feature toggle

* Ensure we are using UTC

* PR feedback

* Only add this if the feature flag is enabled

* Fix tests

* Ensure we only attempt to look this up if the feature flag is enabled

Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
@tylersmalley
Copy link
Contributor

Looks like there were changes required from the EUI bump in #56228 which were not here, so it failed once it hit master. I am pushing a fix.

@tylersmalley
Copy link
Contributor

@chrisronline, can you confirm 0440ae5 is expected?

@chrisronline
Copy link
Contributor Author

@tylersmalley Yup, looks expected

chrisronline added a commit that referenced this pull request Feb 4, 2020
) (#56677)

* License expiration

* Flip off

* Only require alerting and actions if enabled

* Support date formating and timezones in the alert UI messages, support ccs better

* Fix status tests

* Fix up front end tests

* Fix linting, and switch this back

* Add this back in so legacy alerts continue to work

* Fix type issues

* Handle CCS better

* Code cleanup

* Fix type issues

* Flip this off, and fix test

* Moved the email address config to advanced settings, but need help with test failures and typescript

* Fix issue with task manager

* Deprecate email_address

* Use any until we can figure out this TS issue

* Fix type issue

* More tests

* Fix mocha tests

* Use mock instead of any

* I'm not sure why these changed...

* Provide timezone in moment usage in tests for consistency

* Fix type issue

* Change how we get dateFormat and timezone

* Change where we calculate the dates to show in the alerts UI

* Show deprecation warning based on the feature toggle

* Ensure we are using UTC

* PR feedback

* Only add this if the feature flag is enabled

* Fix tests

* Ensure we only attempt to look this up if the feature flag is enabled

Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>

Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
@chrisronline
Copy link
Contributor Author

Backport:

7.x: 1601403

cauemarcondes pushed a commit to cauemarcondes/kibana that referenced this pull request Feb 5, 2020
…stic#54306)

* License expiration

* Flip off

* Only require alerting and actions if enabled

* Support date formating and timezones in the alert UI messages, support ccs better

* Fix status tests

* Fix up front end tests

* Fix linting, and switch this back

* Add this back in so legacy alerts continue to work

* Fix type issues

* Handle CCS better

* Code cleanup

* Fix type issues

* Flip this off, and fix test

* Moved the email address config to advanced settings, but need help with test failures and typescript

* Fix issue with task manager

* Deprecate email_address

* Use any until we can figure out this TS issue

* Fix type issue

* More tests

* Fix mocha tests

* Use mock instead of any

* I'm not sure why these changed...

* Provide timezone in moment usage in tests for consistency

* Fix type issue

* Change how we get dateFormat and timezone

* Change where we calculate the dates to show in the alerts UI

* Show deprecation warning based on the feature toggle

* Ensure we are using UTC

* PR feedback

* Only add this if the feature flag is enabled

* Fix tests

* Ensure we only attempt to look this up if the feature flag is enabled

Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
@kibanamachine
Copy link
Contributor

💔 Build Failed

History

To update your PR or re-run it, just comment with:
@elasticmachine merge upstream

majagrubic pushed a commit to majagrubic/kibana that referenced this pull request Feb 10, 2020
…stic#54306)

* License expiration

* Flip off

* Only require alerting and actions if enabled

* Support date formating and timezones in the alert UI messages, support ccs better

* Fix status tests

* Fix up front end tests

* Fix linting, and switch this back

* Add this back in so legacy alerts continue to work

* Fix type issues

* Handle CCS better

* Code cleanup

* Fix type issues

* Flip this off, and fix test

* Moved the email address config to advanced settings, but need help with test failures and typescript

* Fix issue with task manager

* Deprecate email_address

* Use any until we can figure out this TS issue

* Fix type issue

* More tests

* Fix mocha tests

* Use mock instead of any

* I'm not sure why these changed...

* Provide timezone in moment usage in tests for consistency

* Fix type issue

* Change how we get dateFormat and timezone

* Change where we calculate the dates to show in the alerts UI

* Show deprecation warning based on the feature toggle

* Ensure we are using UTC

* PR feedback

* Only add this if the feature flag is enabled

* Fix tests

* Ensure we only attempt to look this up if the feature flag is enabled

Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
release_note:skip Skip the PR/issue when compiling release notes v7.7.0 v8.0.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants