Commit Graph

332 Commits

Author SHA1 Message Date
Martijn van Groningen 775f1cb878 Increased logging
Original commit: elastic/x-pack-elasticsearch@375279fca5
2014-11-27 09:53:10 +01:00
Martijn van Groningen 45ee1d2d9b Test: Added test that uses an agg in a trigger.
Original commit: elastic/x-pack-elasticsearch@ad87b18aa5
2014-11-26 23:31:40 +01:00
Martijn van Groningen 3965cb194c Make sure that the alerts templates get applied and disabled test template since it conflicts with the alerts templates.
Original commit: elastic/x-pack-elasticsearch@ddd178da78
2014-11-26 23:23:15 +01:00
Martijn van Groningen e4d10c58a9 Core: load alert store before the action manager, b/c action depends on alert store
Original commit: elastic/x-pack-elasticsearch@6aa3cb33b0
2014-11-26 22:51:34 +01:00
Martijn van Groningen 56a121109d Simplified getAlertHistoryIndexNameForTime()
Original commit: elastic/x-pack-elasticsearch@08ce6daf75
2014-11-26 22:38:40 +01:00
Martijn van Groningen 4048bfe55c Removed explicit delete index calls, because it redundant and the test framework wipes the clusters between tests.
Original commit: elastic/x-pack-elasticsearch@eebeef3bee
2014-11-26 22:18:19 +01:00
Martijn van Groningen 6b4f68fcb3 Test: made the simple no master node test more useful
Original commit: elastic/x-pack-elasticsearch@4ffc11d702
2014-11-26 22:00:26 +01:00
Martijn van Groningen 168bed9d32 Restored some code and fix the assert trigger methods
Original commit: elastic/x-pack-elasticsearch@7ca18b77b9
2014-11-26 21:56:13 +01:00
Brian Murphy 871274adbd Add back in the exists checks for the alert history indices.
Original commit: elastic/x-pack-elasticsearch@a170742e56
2014-11-26 18:17:31 +00:00
Brian Murphy 87e056d762 Fix missing index issue by explicitly creating the index if implicit creation fails
This really shouldn't be happening.

Original commit: elastic/x-pack-elasticsearch@7d334ec76f
2014-11-26 18:10:52 +00:00
Brian Murphy 193865925c Properly catch errors on startup and return false from start if we get errors looking for the alert history indices.
Original commit: elastic/x-pack-elasticsearch@9db4691783
2014-11-26 17:27:22 +00:00
Brian Murphy 779e7e83c0 TEST Fix Bootstrap test that got munged by merge.
Original commit: elastic/x-pack-elasticsearch@b0f40fd764
2014-11-26 16:28:11 +00:00
Brian Murphy f8e26c2f75 Remove dependency on the alert history indices being started in the actions.
Original commit: elastic/x-pack-elasticsearch@a3f0e0fe46
2014-11-26 15:58:52 +00:00
Brian Murphy 713327cee5 TEST : Add bootstrap test to boot strap different history indices.
Original commit: elastic/x-pack-elasticsearch@72c36f6d4d
2014-11-26 15:58:52 +00:00
Brian Murphy aaef7de62d TEST: This test got forgotten when I squash the commits.
Original commit: elastic/x-pack-elasticsearch@5109b4bea6
2014-11-26 15:58:52 +00:00
Brian Murphy 914a5035fd Remove merge conflict in comment.
Original commit: elastic/x-pack-elasticsearch@aa4bb3dab6
2014-11-26 15:58:52 +00:00
Brian Murphy f6027e9a6b Alert History : Make alert history index time based.
This commit makes the alert history index a time based index.
The alert history now is a timebased index prefixed with .alert_history_
with the time fomat YYYY-MM-dd.

This commit makes the alert history index a time based index.

Original commit: elastic/x-pack-elasticsearch@df6d6dee29
2014-11-26 15:58:52 +00:00
Martijn van Groningen 8512dfcb36 Removed enable from Alert.
Original commit: elastic/x-pack-elasticsearch@d65a883f70
2014-11-26 15:30:11 +01:00
Martijn van Groningen b0b3721f84 Added forgotten cluster block check
Original commit: elastic/x-pack-elasticsearch@022be40b54
2014-11-26 14:59:27 +01:00
Martijn van Groningen a34504b45e Test: stabilize the alert stopping during test cluster close and between tests.
Original commit: elastic/x-pack-elasticsearch@f2e7818d86
2014-11-26 12:21:05 +01:00
Martijn van Groningen b7dfde7de7 Changed the way alerting gets shut down when the test cluster gets closed.
Original commit: elastic/x-pack-elasticsearch@74c148c025
2014-11-26 00:26:43 +01:00
Martijn van Groningen 470fb053fd Load quartz job in batch style when starting the scheduler.
Original commit: elastic/x-pack-elasticsearch@9bcf84092a
2014-11-25 21:18:02 +01:00
Martijn van Groningen c9e181e597 Test: Replaced the internal clearing of the alert manager between tests with public stop alert service, delete alerts and alerts history index and start alert service calls.
Original commit: elastic/x-pack-elasticsearch@57c0120eb4
2014-11-25 15:12:00 +01:00
Martijn van Groningen 4b147b8f85 Fixes updating an existing alert works as expected.
Original commit: elastic/x-pack-elasticsearch@236407367a
2014-11-25 13:21:37 +01:00
Martijn van Groningen 00bfd694af Tests: restart action manager before clearing store between tests
Original commit: elastic/x-pack-elasticsearch@15f057c820
2014-11-25 00:17:43 +01:00
Martijn van Groningen 4eca3c86a0 Tests: restart the action manager between tests.
Original commit: elastic/x-pack-elasticsearch@73bc51717b
2014-11-24 21:33:30 +01:00
Martijn van Groningen 98bb60e4ba improve assert
Original commit: elastic/x-pack-elasticsearch@cfedeb5da8
2014-11-24 21:27:14 +01:00
Martijn van Groningen 7eb1ec8ba0 Test: Also clear the alert actions te be processed between tests.
Original commit: elastic/x-pack-elasticsearch@f6da5717aa
2014-11-24 21:14:18 +01:00
Martijn van Groningen 53ef534567 No need to clear the scheduler when it is going to be shut down.
Original commit: elastic/x-pack-elasticsearch@5e8e4134ee
2014-11-24 21:06:47 +01:00
Martijn van Groningen 3c896c3d44 Test: Fix mistake, this test requires cluster scope test
Original commit: elastic/x-pack-elasticsearch@e84b055c19
2014-11-24 18:38:03 +01:00
Martijn van Groningen 1a4e118d0d Improving the starting and stop logic of the alert manager.
- Remove synchronized
- Add STOPPING state
- Expose alert state in stats api
- Let the test framework disable alerting before closing the test cluster

Original commit: elastic/x-pack-elasticsearch@5794f5fd8f
2014-11-24 17:35:10 +01:00
Martijn van Groningen 4e543ded65 Test: Move ClusterScope annotation to base alerting test class.
Original commit: elastic/x-pack-elasticsearch@96bb107c03
2014-11-24 16:21:45 +01:00
Martijn van Groningen 619afe51af Test: use refresh and assertBusy
Original commit: elastic/x-pack-elasticsearch@44e0dab7ef
2014-11-24 10:15:14 +01:00
Martijn van Groningen e0eecc5550 Test: ensure alerting is started before adding alerts
Original commit: elastic/x-pack-elasticsearch@f034d20016
2014-11-23 21:02:21 +01:00
Martijn van Groningen 44b9d8229f Set the manually stopped flag we a node gets shutdown.
Original commit: elastic/x-pack-elasticsearch@f3841481b0
2014-11-23 20:55:40 +01:00
Martijn van Groningen 4e239a8be6 Test: check no master block on all nodes
Original commit: elastic/x-pack-elasticsearch@611ce01d69
2014-11-23 20:32:50 +01:00
Martijn van Groningen beb4fada5f Core: Changed the loading logic in AlertManager to happen all in a single forked thread only. Also retry attempts stay on the the same thread and is only done if there is a new cluster state version.
Test: Added first version of test that fails the elected master multiple times.

Original commit: elastic/x-pack-elasticsearch@2f7b840f5a
2014-11-21 18:15:09 +01:00
Brian Murphy c471abdab5 Merge branch 'master' of https://github.com/elasticsearch/elasticsearch-alerts
Original commit: elastic/x-pack-elasticsearch@7aee9aef96
2014-11-21 15:52:08 +00:00
Martijn van Groningen e6336010be Changed info log into debug log
Original commit: elastic/x-pack-elasticsearch@b142696ca5
2014-11-21 14:30:51 +01:00
Brian Murphy 97bbd747ea DOCS : Add REST API doc for akcing alerts.
Original commit: elastic/x-pack-elasticsearch@633444773d
2014-11-21 12:52:31 +00:00
Martijn van Groningen bb4d85a1a7 Removed error log statement
Original commit: elastic/x-pack-elasticsearch@8a33309b71
2014-11-21 13:44:18 +01:00
Martijn van Groningen 1adb25127b Added start, stop and restart apis.
Closes elastic/elasticsearch#37

Original commit: elastic/x-pack-elasticsearch@6d491c4cec
2014-11-21 12:28:54 +01:00
Brian Murphy 6ea6256e35 TEST : Fix ACK test
Get the count AFTER we ack.

Original commit: elastic/x-pack-elasticsearch@23dacea151
2014-11-21 10:41:08 +00:00
Martijn van Groningen c4787d9160 fixed bug, expected and update was swapped.
Original commit: elastic/x-pack-elasticsearch@78e42879be
2014-11-21 01:01:29 +01:00
Brian Murphy 178a701724 ACKS : Fix some issues when a transport client was used.
Original commit: elastic/x-pack-elasticsearch@9276820a90
2014-11-20 22:24:25 +00:00
Brian Murphy 42d484b62a TEST: Add extra logging when alert didn't trigger an action.
Original commit: elastic/x-pack-elasticsearch@bc389fccdc
2014-11-20 22:22:50 +00:00
Brian Murphy 32e7bc45b1 REST : Add ACK Rest Action
This commit adds the alert ack rest action.

Original commit: elastic/x-pack-elasticsearch@73a0286863
2014-11-20 18:02:54 +00:00
Brian Murphy bed7ddbb01 DOCS : Add some java docs.
Original commit: elastic/x-pack-elasticsearch@394d957364
2014-11-20 17:24:20 +00:00
Brian Murphy a3259e9c62 TEST: Up wait time to allow things to settle down once we ACK.
Original commit: elastic/x-pack-elasticsearch@69f7680348
2014-11-20 17:00:21 +00:00
Brian Murphy b1f64f4103 Fixes after merge conflicts.
Original commit: elastic/x-pack-elasticsearch@65adad6ea7
2014-11-20 16:28:00 +00:00
Brian Murphy 3fcae91633 Merge branch 'master' of https://github.com/elasticsearch/elasticsearch-alerts
Conflicts:
	src/main/java/org/elasticsearch/alerts/actions/AlertActionManager.java
	src/test/java/org/elasticsearch/alerts/BootStrapTest.java
	src/test/java/org/elasticsearch/alerts/actions/AlertActionsTest.java

Original commit: elastic/x-pack-elasticsearch@8dcb986dff
2014-11-20 15:44:25 +00:00
Brian Murphy 64325d4f30 THROTTLING : Add throttling support for alerts.
This commit adds throttling support for alerts.

If an alert is added with the throttle_state NOT_TRIGGERED
This alert can be ACKed.
If an alert is ACKed no further actions will be performed until the alert stops triggering.
If an alert is added with the throttle_period as a TimeValue alerts will only be triggered at least that TimeValue apart in time.

Original commit: elastic/x-pack-elasticsearch@65dfda7d1a
2014-11-20 15:31:04 +00:00
Martijn van Groningen 64d49dae5c Forked CronExpression because it uses the default Locale to determine the maximum allowed year to be used. It now uses Locale.ENGLISH to do this.
Original commit: elastic/x-pack-elasticsearch@41f27aa33c
2014-11-20 15:19:35 +01:00
Martijn van Groningen e3694655af Only stop the scheduler once it is set.
Original commit: elastic/x-pack-elasticsearch@4238a62673
2014-11-20 14:44:31 +01:00
Martijn van Groningen 306fefd847 Removed useless if check
Original commit: elastic/x-pack-elasticsearch@c9fea5aca4
2014-11-20 12:42:41 +01:00
Martijn van Groningen 15d9101ea9 First stop the alert action manager and enforce started property inside alert action manager.
Original commit: elastic/x-pack-elasticsearch@75a98a93f5
2014-11-20 12:39:09 +01:00
Martijn van Groningen cfdc061908 In the AlertsClusterStateListener fork the call to stop if we're no longer master
Original commit: elastic/x-pack-elasticsearch@1b40f14570
2014-11-20 12:09:12 +01:00
Martijn van Groningen 0438e61404 Let Quartz interrupt jobs on shutdown.
Original commit: elastic/x-pack-elasticsearch@3084f9b3f4
2014-11-20 11:56:48 +01:00
Martijn van Groningen 79b10f8c0d Don't let Quartz check for updates.
Original commit: elastic/x-pack-elasticsearch@dd1e4c2577
2014-11-20 11:32:54 +01:00
Martijn van Groningen ca00e59911 Make AlertManager#stop() synchronized so that the call from beforeClose waits if an stop is being performed already.
This prevents the test framework to complain about the fact that threads are lingering around when the test cluster has been shutdown.

Original commit: elastic/x-pack-elasticsearch@315be3f376
2014-11-20 11:12:25 +01:00
Martijn van Groningen 42dda5b975 Test: Let AlertActionsTest extend from AbstractAlertingTests.
Original commit: elastic/x-pack-elasticsearch@4c11aef8cb
2014-11-19 21:44:58 +01:00
Martijn van Groningen 43e6aa5b23 Moved json field variable from AlertActionEntry to AlertActionManager and made AlertActionEntry not implement ToXContent.
Original commit: elastic/x-pack-elasticsearch@76731aee22
2014-11-19 21:37:23 +01:00
Martijn van Groningen 72e9d9e4b7 Leftover from IndexAlert* to PutAlert*
Original commit: elastic/x-pack-elasticsearch@6af1e77e43
2014-11-19 21:32:18 +01:00
Martijn van Groningen c2e4fe375d Test: Fixed and cleanup bootstrap test
Original commit: elastic/x-pack-elasticsearch@7455bd8c00
2014-11-19 21:27:51 +01:00
Martijn van Groningen 19622d4f0b Moved more initialization responsibilty to AlertManager.
Original commit: elastic/x-pack-elasticsearch@5799ecbd23
2014-11-19 18:08:56 +01:00
Martijn van Groningen 506daca17e Added state to AlertManager that replaced the started flag.
This helps us preventing endless re-loading logic while a node steps down as master while while we in the process of starting alert store and action manager.

Original commit: elastic/x-pack-elasticsearch@e18c8215a9
2014-11-19 15:12:52 +01:00
Brian Murphy 8615cdb6af CLEANUP : remove extraneous logging statement.
Original commit: elastic/x-pack-elasticsearch@b6dd5601b9
2014-11-19 12:04:15 +00:00
Brian Murphy 2954f5f9c2 Fix alert history entry parsing
This commit fixes the alert history parsing that was causing the tests to fail.
It now just warns on null fields and sets the search request on alert history entry creation.

Original commit: elastic/x-pack-elasticsearch@09d2b09b79
2014-11-19 11:57:14 +00:00
Martijn van Groningen 71d9feb9d0 Disabled request and response object fields in the alerthistory mapping template
Original commit: elastic/x-pack-elasticsearch@01aa6aa526
2014-11-19 12:23:41 +01:00
Martijn van Groningen a6089ce8ac Dropped the binary request and response fields and rely fully on the response and request object fields.
Closes elastic/elasticsearch#36

Original commit: elastic/x-pack-elasticsearch@51370ac47d
2014-11-19 12:01:55 +01:00
Brian Murphy 7f177281ae TEST : Add alert history bootstrap test
This test checks if the alert history entries are loaded correctly at startup.
Also included in this commit are the fixes needed to pass this test.

Original commit: elastic/x-pack-elasticsearch@2a7859e495
2014-11-19 10:45:37 +00:00
Brian Murphy 84680f84b3 TESTS : Fix the alert stats test failure and some cleanup and docs.
This test fixes the alert stats test failures due the the scope being suite scope
which meant that the pass/fail was dependent on execution order for the clean start test.
Also add asciidoc for alert stats.

Original commit: elastic/x-pack-elasticsearch@be3ff86359
2014-11-19 09:33:16 +00:00
Brian Murphy 90a214f9ab TEST fix the stats test.
Original commit: elastic/x-pack-elasticsearch@021cb7d5f2
2014-11-18 16:03:06 +00:00
Brian Murphy 7d27fdfc4b TEST fix the alert serialization test to look at each field instead of compairing alerts directly.
Original commit: elastic/x-pack-elasticsearch@2d0d4ce6df
2014-11-18 15:46:17 +00:00
Brian Murphy 6e7ea3cc5b Core: Add javadocs and add refresh to queue loading
This commit adds javadocs to the Request/Response/Action classes and
Adds a refresh to the loading of both the action queue and the alerts.

Original commit: elastic/x-pack-elasticsearch@853be114dd
2014-11-18 15:42:22 +00:00
Brian Murphy 5491e8e4b3 TESTS : Add stats test and bootstrap test
This commit adds tests for the stats API along with a bootstrap test.
The bootstrap test is currently failing outside of a debugger for me so I'm digging into it.

Original commit: elastic/x-pack-elasticsearch@db497a6b51
2014-11-18 11:17:00 +00:00
Martijn van Groningen 43043ce3ce Added `search_type` option to the trigger search in an alert.
The default `search_type` is `count`.

Closes elastic/elasticsearch#38

Original commit: elastic/x-pack-elasticsearch@8e87aaea36
2014-11-17 19:02:23 +01:00
Martijn van Groningen 732d7018b4 Core: Made the trigger search request templating use the mustache / script service.
Closes elastic/elasticsearch#47

Original commit: elastic/x-pack-elasticsearch@db22c882dd
2014-11-17 15:06:09 +01:00
Martijn van Groningen 532e5d7b35 Core: Change the rest api url structure as if all operations are targetted for the `.alerts` index.
Closes elastic/elasticsearch#44

Original commit: elastic/x-pack-elasticsearch@0f1a9e23b1
2014-11-17 12:09:22 +01:00
Martijn van Groningen 6891702397 Fix template error
Original commit: elastic/x-pack-elasticsearch@2f1733348a
2014-11-14 21:14:24 +01:00
Martijn van Groningen f6e28c96ca Core: move errorMessage field to error_message field
Closes elastic/elasticsearch#25

Original commit: elastic/x-pack-elasticsearch@186f812919
2014-11-14 11:16:32 +01:00
Martijn van Groningen 5c34d8b59a Core: Renamed AlertsClient to NodeAlertsClient and renamed AlertsClientInterface to AlertsClient
Original commit: elastic/x-pack-elasticsearch@7aff2cbdd8
2014-11-14 00:45:05 +01:00
Martijn van Groningen e5293ba0c3 Core: Transport classes are now managed by Guide and are injected into the AlertsClient
Original commit: elastic/x-pack-elasticsearch@3cfdd3dc71
2014-11-14 00:37:49 +01:00
Martijn van Groningen ecdfdb11d9 Cleanup: removed lost synchronized keyword
Original commit: elastic/x-pack-elasticsearch@6eaa2a59a7
2014-11-14 00:01:09 +01:00
Martijn van Groningen 8705fd04b9 Core: Fix use of search templates
Original commit: elastic/x-pack-elasticsearch@401b9b39f2
2014-11-14 00:00:19 +01:00
Brian Murphy aa6a51306c Merge branch 'master' of https://github.com/elasticsearch/elasticsearch-alerts
Original commit: elastic/x-pack-elasticsearch@bf4f4669f1
2014-11-13 18:24:02 +00:00
Brian Murphy e79a98c568 REST : Fix rendering on GetAlerts
Original commit: elastic/x-pack-elasticsearch@81fc5d86df
2014-11-13 18:23:11 +00:00
Martijn van Groningen cabdcd862b Core: Use reading/writing search request infra also in alert action
Original commit: elastic/x-pack-elasticsearch@14dbbfe164
2014-11-13 19:22:41 +01:00
Martijn van Groningen eb3f123ad6 Core: Better infra for reading/writing search request in alert
Original commit: elastic/x-pack-elasticsearch@febd43058b
2014-11-13 19:14:36 +01:00
Martijn van Groningen 6a5a1710d0 Core: Change <<< placeholder to {{
Original commit: elastic/x-pack-elasticsearch@39d2de2dd8
2014-11-13 18:39:23 +01:00
Martijn van Groningen f58b36b70a Core: fix trigger search for templates
Original commit: elastic/x-pack-elasticsearch@11cdc8a396
2014-11-13 18:36:07 +01:00
Brian Murphy c070e932c3 CORE : add keyed lock.
This commit adds a keyed lock to prevent concurrent modification of the alert store and alert index.

Original commit: elastic/x-pack-elasticsearch@416351c06d
2014-11-13 16:38:49 +00:00
Martijn van Groningen 1e593a4075 Build: Added mail and activation to depdency sets for the assembly plugin
Original commit: elastic/x-pack-elasticsearch@3af4f1b8d9
2014-11-13 15:55:16 +01:00
Brian Murphy d20bd52a27 REST : actually add the handlers.
Original commit: elastic/x-pack-elasticsearch@fce0de9dea
2014-11-13 14:27:25 +00:00
Brian Murphy e2340a9645 Merge branch 'master' of https://github.com/elasticsearch/elasticsearch-alerts
Original commit: elastic/x-pack-elasticsearch@9169ddaabe
2014-11-13 14:21:11 +00:00
Brian Murphy 31baa2aa47 REST : Add stats and get alert rest handlers.
Original commit: elastic/x-pack-elasticsearch@f402c13fc5
2014-11-13 14:20:05 +00:00
Martijn van Groningen d801537c9e Test: Added trigger search test
Core: Modified TriggerManager#prepareTriggerSearch to always produce a new instance.

Original commit: elastic/x-pack-elasticsearch@4041898645
2014-11-13 13:42:51 +01:00
Brian Murphy 8b2c6ba39d CORE : Add alerts stats.
This commit adds the alerts stats actions.

Original commit: elastic/x-pack-elasticsearch@c3c471de74
2014-11-13 11:25:28 +00:00
Martijn van Groningen b731f84d68 Core: Removed unused methods.
Original commit: elastic/x-pack-elasticsearch@1aac9a440e
2014-11-12 22:11:45 +01:00
Martijn van Groningen cd2c74a6a0 Core: Simplify the template helper by using the actual put index template api instead of the MetaDataIndexTemplateService directly which allows for code reuse.
Original commit: elastic/x-pack-elasticsearch@1c646f3448
2014-11-12 22:04:41 +01:00
Martijn van Groningen e0741997d0 Test: Extended malformed test to also check if the strict alert mapping in the template is active.
Original commit: elastic/x-pack-elasticsearch@dfcad46f94
2014-11-12 21:27:48 +01:00
Martijn van Groningen 4d581876bd Cleanup: removed unused field and method
Original commit: elastic/x-pack-elasticsearch@058e57f6c4
2014-11-12 18:03:17 +01:00
Martijn van Groningen 3bed2c92e2 Core: Retry shouldn't cause a new cluster state, but rather should be done in a forked thread.
Original commit: elastic/x-pack-elasticsearch@cb944ddce7
2014-11-12 18:02:15 +01:00
Brian Murphy 36dc82bcc5 AlertActions : Change the AlertActions to be simple POJOs and do the actions in the factories.
With this commit alert actions are simple pojos with the action descriptions. The actual actions are undertaken by the AlertActionFactories.

Original commit: elastic/x-pack-elasticsearch@d47b453018
2014-11-12 11:06:35 +00:00
Martijn van Groningen 3c1e31bfbf Test: move no master node test over to only use unicast zen discovery. On the build server there is no multicast enabled.
Original commit: elastic/x-pack-elasticsearch@20eab58db1
2014-11-09 23:17:20 +00:00
Martijn van Groningen e87b0a980c Test: Fixed local discovery issue when running tests for plugins
Core: synchronized initializing and stopping the scheduler to avoid scheduler stops leaving leaking threads behind

Original commit: elastic/x-pack-elasticsearch@b845651430
2014-11-09 22:21:51 +00:00
Martijn van Groningen 77fc31f815 Test: Added todo
Original commit: elastic/x-pack-elasticsearch@4267ebfe8f
2014-11-09 21:25:05 +00:00
Martijn van Groningen 0e53268bf2 Test: Don't force networking mode.
By default use local transport to increase testing speed.
Also Zen discovery is required for plugin tests otherwise Guice errors occur (so far unclear to me what is causing this).

Original commit: elastic/x-pack-elasticsearch@0de574c12f
2014-11-09 21:17:57 +00:00
Martijn van Groningen 15c1b4c56d Core: Changed the way index templates are installed
Before the index templates were installed via json files in the config directory, this commit installs templates from the classpath via the put index template api.
Also template versioning is enforced.

Original commit: elastic/x-pack-elasticsearch@22f6596015
2014-11-09 20:50:03 +01:00
Martijn van Groningen b62da0691b Core: Make sure deletes are unscheduled and no npe is returned when a alert is deleted twice
Core: When an alert searches in an index that doesn't exist it shouldn't fail

Original commit: elastic/x-pack-elasticsearch@fc4ab8f823
2014-11-08 02:13:59 +01:00
Martijn van Groningen 4b089cb157 Build: include dependencies in plugin assembly
Original commit: elastic/x-pack-elasticsearch@276e87d8f8
2014-11-08 01:47:01 +01:00
Martijn van Groningen 94cf006b8f Replaced quartz thread pool by an impl that is backed by ES thread pool
Original commit: elastic/x-pack-elasticsearch@24a055dc00
2014-11-07 23:49:44 +01:00
Martijn van Groningen b11f0bf6df Test: changed default node settings
Core: AlertManager sets itself now

Original commit: elastic/x-pack-elasticsearch@fad2318528
2014-11-07 21:47:02 +01:00
Martijn van Groningen a6bb3b533f Test: prevent npe
Original commit: elastic/x-pack-elasticsearch@8a332d22be
2014-11-07 20:32:24 +01:00
Martijn van Groningen c081a9b62c Test: assertAlertTrigger should wait for active shards in alert history index.
Original commit: elastic/x-pack-elasticsearch@bdf6370aee
2014-11-07 19:59:56 +01:00
Brian Murphy c9eae998b5 Alerts : add alert serialization test
This test tests that an alert that is serialized in and out of json is the same alert.

Original commit: elastic/x-pack-elasticsearch@58cdc6d784
2014-11-07 17:44:18 +00:00
Brian Murphy a6468781f0 Alert Trigger : add trigger unit test.
This commit adds a simple unit test for the alert triggers.

Original commit: elastic/x-pack-elasticsearch@d9f42aa913
2014-11-07 17:43:35 +00:00
Brian Murphy 7a23074c7c Actually add the new TriggerManager classes.
These should have been added in the previous commit.

Original commit: elastic/x-pack-elasticsearch@9efecc7ace
2014-11-07 17:42:43 +00:00
Brian Murphy 5d8f43225a Alerts update trigger manager.
This change changes the trigger manager to be pluggable.
Also removes the SimpleTrigger class, for now all triggers should be scripts.

Original commit: elastic/x-pack-elasticsearch@f7d0cb77e7
2014-11-07 17:40:37 +00:00
Martijn van Groningen a4dbc7315a Test: Added helper method that checks if an alert has triggered
Original commit: elastic/x-pack-elasticsearch@351d26618f
2014-11-07 13:45:48 +01:00
Martijn van Groningen f2453f53ac Test: Added no master node test
Original commit: elastic/x-pack-elasticsearch@0edeaba3a7
2014-11-07 13:21:15 +01:00
Brian Murphy 7efeffd2c2 Add License header to all files and javadocs for AlertClientInterface.
This commit adds the license header to all java files and enforces the license check on compile.
It also adds javadocs for all the methods in the AlertClientInterface

Original commit: elastic/x-pack-elasticsearch@2ec6f89b4b
2014-11-07 10:38:43 +00:00
Martijn van Groningen 1dc9021fbe Added base alerting test class
Original commit: elastic/x-pack-elasticsearch@a3d258318f
2014-11-06 23:58:30 +01:00
Martijn van Groningen 0f0436e128 Cleaned up rest layer
Original commit: elastic/x-pack-elasticsearch@cdcdc98383
2014-11-06 23:49:50 +01:00
Martijn van Groningen 22cf7f68f4 Make tests work with multiple nodes.
Original commit: elastic/x-pack-elasticsearch@68004e1d6c
2014-11-06 22:52:44 +01:00
Martijn van Groningen 8f0e454ac5 Clear alerts after each test run, so that we don't run into exceptions between wipe indices and node closing.
Improved stop logging

Original commit: elastic/x-pack-elasticsearch@195a4cb75d
2014-11-06 22:15:11 +01:00
Martijn van Groningen 5be1c5964c on going work for improving test coverage
Original commit: elastic/x-pack-elasticsearch@1ccb9c9d9b
2014-11-06 21:25:53 +01:00
Brian Murphy 89dd5e2599 Move alert execution out of scheduler thread.
This commit moves the execution of the alert trigger to the AlertActions queued thread.
Also change the states of AlertActionEntry to include SEARCH_NEEDED and ERROR and remove now uneeded states.
AlertActions now take a TriggerResult instead of an alert action entry.

Original commit: elastic/x-pack-elasticsearch@2b650ca4c1
2014-11-06 13:34:48 +00:00
Brian Murphy f86544497a Remove extraneous methods and change IndexAlertAction.NAME
This commit removes the uneeded addAlert methods in AlertManager and AlertsStore and
also changes the IndexAlertAction.NAME to "indices:data/write/alert/index"

Original commit: elastic/x-pack-elasticsearch@19013dcf3e
2014-11-06 11:14:58 +00:00
Brian Murphy bce97abc1d Refactor and rename transport layer
This commit removes the update action and renames the create action to index.
It also hides the Alert objects behind the interface rather than exposing them.
This means that all interactions should be via BytesReferences.

Original commit: elastic/x-pack-elasticsearch@87ac377d3e
2014-11-06 11:08:57 +00:00
Martijn van Groningen 0f78028190 * Update the alert version on each write
* Make AlertStore#addAlert() return a tuple<Alert, IndexResponse>

Original commit: elastic/x-pack-elasticsearch@b2f270caaf
2014-11-06 11:30:52 +01:00
Martijn van Groningen 9c81a2ab87 * Simplified add alert action logic.
* Reduce needed code to index Alert and AlertActionEntry
* Added scroll for loading action needed alert action entries

Original commit: elastic/x-pack-elasticsearch@a7b790ecc4
2014-11-06 09:40:44 +01:00
Brian Murphy 6422e8b5d5 Add IndexResponse to Update and Create Alert Responses.
This commit adds the IndexResponse if available to the Update and Create
Alert Response objects.

Original commit: elastic/x-pack-elasticsearch@5fed850c61
2014-11-05 18:08:22 +00:00
Brian Murphy 5d52c374b3 Merge branch 'master' of https://github.com/elasticsearch/elasticsearch-alerts
Original commit: elastic/x-pack-elasticsearch@d91926ebdf
2014-11-05 17:50:54 +00:00
Brian Murphy 41821c39c6 DeleteAlert : Add the delete response to the DeleteAlertResponse
This commit adds the delete response to the DeleteAlertResponse.

Original commit: elastic/x-pack-elasticsearch@a5cc31f321
2014-11-05 17:50:05 +00:00
Martijn van Groningen b07b0d497d AlertManager#stop() didn't stop, the expected and update was reversed in compareAndSet
Original commit: elastic/x-pack-elasticsearch@5b001af292
2014-11-05 16:13:22 +01:00
Martijn van Groningen 5a957ed678 Introduced dedicated alerting thread pool, which executes alert actions
Original commit: elastic/x-pack-elasticsearch@e49ecb3f7c
2014-11-05 16:08:27 +01:00
Brian Murphy 47a78648df Alerts : Cleanup
This commit :
1. Ensures an alert will run even if the lastFireTime is null (first time we see an alert)
2. Removes the incorrect license that existed in some of the files.
3. Cuts the BasicTest over to use the AlertsClient and deletes the alert at the end of the test
to prevent it running in a race condition.
4. Moves the execute method signatures in AlertsClient to be on a single line.

Original commit: elastic/x-pack-elasticsearch@9c3aec0127
2014-11-05 10:05:17 +00:00
Brian Murphy 9a2e594647 Merge branch 'master' of https://github.com/elasticsearch/elasticsearch-alerts
Original commit: elastic/x-pack-elasticsearch@258c047506
2014-11-04 17:24:57 +00:00
Brian Murphy 4f58b9c5ff Alerts : Forgot to add the AlertsClient package.
Sorry.

Original commit: elastic/x-pack-elasticsearch@8231a3845b
2014-11-04 17:24:18 +00:00
Brian Murphy 9f3f23698f Merge branch 'add-transport-actions' of https://github.com/elasticsearch/elasticsearch-alerts into add-transport-actions
Conflicts:
	src/main/java/org/elasticsearch/alerts/AlertManager.java
	src/main/java/org/elasticsearch/alerts/AlertsStore.java
	src/main/java/org/elasticsearch/alerts/transport/actions/update/TransportUpdateAlertAction.java
	src/main/java/org/elasticsearch/alerts/transport/actions/update/UpdateAlertResponse.java
	src/test/java/org/elasticsearch/alerts/actions/AlertActionsTest.java

Original commit: elastic/x-pack-elasticsearch@3f1b58a2ee
2014-11-04 17:09:40 +00:00
Brian Murphy 85655ac16d Alerts : Alert Transport Layer
This commit fixes the test and tests to make sure the alert we get back from
the alertsstore isn't null in execute alert since it may have been deleted.

Original commit: elastic/x-pack-elasticsearch@7a57dd090a
2014-11-04 17:03:03 +00:00
Brian Murphy a05fc88f0d Alerts: Transport actions
Add the UpdateAction (oops) and fix the test.

Original commit: elastic/x-pack-elasticsearch@ead7d446d7
2014-11-04 16:49:56 +00:00
Brian Murphy 75ce20ecff Alerting transport layer.
This commit adds the transport layer to the alerting plugin.

Original commit: elastic/x-pack-elasticsearch@a99dce9411
2014-11-04 16:49:56 +00:00
Martijn van Groningen 669203b2a1 Removed checks for creating alert & history index from code and use index templates instead
Original commit: elastic/x-pack-elasticsearch@c81134701f
2014-11-04 17:23:05 +01:00
Brian Murphy 69942c6c79 Alerting transport layer.
This commit adds the transport layer to the alerting plugin.

Original commit: elastic/x-pack-elasticsearch@0b6cb4760f
2014-11-04 16:21:57 +00:00
Martijn van Groningen c8c30f9b28 Properly resolve the place holders in the request source
Original commit: elastic/x-pack-elasticsearch@0d19c920d1
2014-11-04 16:01:20 +01:00
Martijn van Groningen 8ba9c1c609 Cleared up the alert / alert action entry classes and how the search request in the trigger manager gets prepared.
Original commit: elastic/x-pack-elasticsearch@52b16abb53
2014-11-04 11:27:58 +01:00
Martijn van Groningen 4373330a28 Changed the alert manager starting logic to move the loading logic down to alert store and alert action manager
Moved logic around from alert scheduler to action manager and trigger manager.

Original commit: elastic/x-pack-elasticsearch@8cba72b005
2014-10-31 10:28:42 +01:00
Martijn van Groningen 3e45310877 make more readable
Original commit: elastic/x-pack-elasticsearch@c7727618ac
2014-10-29 14:08:06 +01:00
Martijn van Groningen 12a6de0a57 Moved alert loading to use scan scroll instead of a single normal search
Original commit: elastic/x-pack-elasticsearch@06e70836ec
2014-10-29 10:20:36 +01:00
Martijn van Groningen 1e7fc84f06 Forgot to parse field
Original commit: elastic/x-pack-elasticsearch@23512bce74
2014-10-29 09:46:39 +01:00
Martijn van Groningen 3625b5bc91 Moved over the streaming parsing.
Original commit: elastic/x-pack-elasticsearch@10bd127df5
2014-10-29 00:54:18 +01:00
Martijn van Groningen 6b2fbe400e Introduced AlertsStore that is responsible for maintaining / storing / parsing etc of alerts
Original commit: elastic/x-pack-elasticsearch@40aae7dc30
2014-10-28 18:49:23 +01:00
Martijn van Groningen 34c359281a Added a todo
Original commit: elastic/x-pack-elasticsearch@56f5b1326b
2014-10-28 16:35:41 +01:00
Brian Murphy 4da8f9fec7 AlertActionManager: Add alert action job queue
This change adds the AlertActionManager and AlertActionEntry. The old AlertActionManager has become the AlertActionRegistry.
This means that now the results of Alerts are queued up in a job queue and executed in separate threads.
The AlertActionManager is a composite member of the AlertManager.
Change the BasicTest to just run on a single node to fix the action registration if the action happens on a different node.
Threads are not directly constructed but now the threadpool is used.
The ClusterStateListener in AlertManager is responsible now for starting the job queue.

Original commit: elastic/x-pack-elasticsearch@a73c6b60f8
2014-10-28 13:49:04 +00:00
Martijn van Groningen a23487cd38 Fixed build by:
* Using cluster state listener to clear alerts when .alerts index is removed. (when running on multiple nodes the .alerts index is scattered so indices listener doesn't work).
* Remove the starting / loading thread and move the initial loading to cluster state listener.

Original commit: elastic/x-pack-elasticsearch@b8f41db2ea
2014-10-25 23:37:05 +02:00
Martijn van Groningen 449edcda1d * Throw a understandle error if an alert action doesn't exist
* Moved over to a copy on write map instead of a hash map that is protected by synchronized blocks

Original commit: elastic/x-pack-elasticsearch@285515d585
2014-10-24 18:50:47 +02:00
Martijn van Groningen 1a32243781 Changes to AlertManager:
* Made use of IndicesLifecycle, to catch when the .alerts index gets deleted, so we can clear the alerts
* Moved to concurrent hashmap in favour over normal hashmap with synchronized blocks

Original commit: elastic/x-pack-elasticsearch@5599d01c78
2014-10-24 16:51:12 +02:00
Martijn van Groningen 16a7991d6d Rename and move the plugin class.
Original commit: elastic/x-pack-elasticsearch@b6f7a0490e
2014-10-24 14:31:20 +02:00
Brian Murphy ac979c880d Alerting : rename alerting package to alerts and fix test.
This commit renames the alerting package to alerts and will create the
alerts index on addAlert if needed.

Original commit: elastic/x-pack-elasticsearch@7cd691bd9b
2014-10-24 13:01:45 +01:00
Brian Murphy db9fae8021 Alerting: Split alerting into packages
This commit adds separate packages for actions,triggers,rest, and the scheduler.

Original commit: elastic/x-pack-elasticsearch@e104bbc521
2014-10-24 12:32:18 +01:00
Martijn van Groningen 75ef2dc3b3 Initial step to running alerts on master and added a very simple test.
Original commit: elastic/x-pack-elasticsearch@480f6bd44b
2014-10-24 12:49:33 +02:00
Brian Murphy 8c623534c2 Alerting : Cleanup and fixes.
These changes fix the alert throttling during the time period, move alert history it's own
index.

Original commit: elastic/x-pack-elasticsearch@5130637824
2014-08-21 16:33:11 +01:00
Brian Murphy 47e1e77b58 Alerting : Start of multiprocess coordination work
On alert claim time, query index to make sure alert is still valid and enabled and is the same alert.

Original commit: elastic/x-pack-elasticsearch@72b816b7d1
2014-08-19 13:31:01 +01:00
Brian Murphy 0eea73dd72 Alerting: Scripted triggers and support for aggregations in searches.
This commit adds support for triggers that are scripts:

Query :
````
POST /_search/template/testFilteredAgg
{
  "query" : {
    "filtered" : {
      "query" : {
        "match_all" : {}
     },
     "filter": {
       "range" : {
         "@timestamp" : {
             "gte" : "{{from}}",
             "lt" : "{{to}}"
         }
       }
     }
    }
  },
    "aggs" : {
      "response" : {
        "terms" : {
          "field" : "response",
          "size" : 100
        }
      }
}, "size" : 0  }
````

Trigger Script:
````
POST /_scripts/groovy/testScript
{
  "script" : "ok_count = 0.0;error_count = 0.0;for(bucket in aggregations.response.buckets) {if (bucket.key < 400){ok_count += bucket.doc_count;} else {error_count += bucket.doc_count;}}; return error_count/(ok_count+1) > 0.1;"
}
````

Alert:
````
POST /_alerting/_create/myScriptedAlert
{
    "query" : "testFilteredAgg",
    "schedule" : "05 * * * * ?",
    "trigger" : {
         "script" : {
           "script" : "testScript",
           "script_lang" : "groovy",
           "script_type" : "INDEXED"
         }
     },
    "timeperiod" : "300s",
     "action" : {
         "index" : {
           "index" : "weberrorhistory",
           "type" : "weberrorresult"
         }
     },
    "indices" : [ "logstash*" ],
    "enabled" : true,
    "simple" : false
}
````

If you want to use aggs with your alert you must create a search that contains the timefilter with the params ````{{from}}```` and ````{{to}}```` and set the ````simple```` flag to ````true````.

Original commit: elastic/x-pack-elasticsearch@0430a1bf40
2014-08-18 16:59:49 +01:00
Brian Murphy 4216491824 Alerting : Improve error handling in the RestInterface
This commit improves error handling in the RestHandler. Errors are now
returned to the client.

Original commit: elastic/x-pack-elasticsearch@433e8a57bc
2014-08-18 12:28:48 +01:00
Brian Murphy 14d0bcd589 Alerting add TODO
Original commit: elastic/x-pack-elasticsearch@23cf5fce8b
2014-08-18 12:22:13 +01:00
Brian Murphy 418b9f1a31 Alerting : Add scripted triggers and alert disabling.
This commit adds support for disabling alerts.
This commit adds preliminary support for scripted triggers.

Original commit: elastic/x-pack-elasticsearch@e14a56dbeb
2014-08-18 12:13:39 +01:00
Brian Murphy 4c1c502f80 Alerting : Fix IndexAction
This commit contains fixes to the IndexAlertAction and normalizes the serialization of
Alerts using ToXContent interface.

Original commit: elastic/x-pack-elasticsearch@47325bdd01
2014-08-18 11:23:45 +01:00
Brian Murphy 26e053eaed Alerting : Claim alert runs
This commit add functionality so that multiple nodes running alert plugins won't stand on
each other trying to run the same alerts at the same time.

Original commit: elastic/x-pack-elasticsearch@9c350c0114
2014-08-18 10:27:07 +01:00
Brian Murphy 83287e009a Alerting : Add index action.
This commit adds support for indexing on alert trigger.

Original commit: elastic/x-pack-elasticsearch@d6508ce16d
2014-08-17 13:49:29 +01:00
Brian Murphy d1af9f15fe Alerting : Small fixes.
Fix the constructor for the AlertResult.

Original commit: elastic/x-pack-elasticsearch@0820edaa6a
2014-08-16 17:44:44 +01:00
Brian Murphy 019cdb37d4 Alerting : Add support for history and fix issues around parsing lastRun.
This commit adds a history log for alerts and updates lastRan with the correct time.

Original commit: elastic/x-pack-elasticsearch@49c77f1ef8
2014-08-15 16:46:41 +01:00
Brian Murphy 4c47c8ba9a Alerting : REST endpoints
This commit adds REST endpoints for list/delete/create and fixes refresh.

Original commit: elastic/x-pack-elasticsearch@36e2c15753
2014-08-15 11:45:45 +01:00
Brian Murphy b5cb8b3d04 Alerting : Add RestHandler
This commit adds the rest handler and supports /_alerting/_refresh to reload all alerts.

Original commit: elastic/x-pack-elasticsearch@14fadbeeee
2014-08-13 18:00:36 +01:00
Brian Murphy 0d9061b838 Alerting : better email formatting
This commit enables better email formatting.

Original commit: elastic/x-pack-elasticsearch@8be3e3b6d1
2014-08-13 17:05:25 +01:00
Brian Murphy e3250c0366 Alerting : Add time clamping.
This commit adds timestamp clamping on the timeperiod to alerting.
Also adds index setting on alerts.

Original commit: elastic/x-pack-elasticsearch@222cd6eaef
2014-08-13 15:21:55 +01:00
Brian Murphy 88ed7a5624 Alerting : Add parsing and indices.
This commit adds parsing of the triggers and actions, and allows alerts to be restricted to indices.

Original commit: elastic/x-pack-elasticsearch@44a6a51b17
2014-08-13 10:11:51 +01:00
Brian Murphy 940d6402ae Alerting : connect email
The last commit ommited a line that actually sends the email on alert trigger.

Original commit: elastic/x-pack-elasticsearch@24b5c01db8
2014-08-12 19:54:13 +01:00
Brian Murphy 5f84596c92 Alerting : Add support for quartz scheduler.
This commit enables loading of alerts from the .alerts index and adds the
Quartz scheduler.
You can add the following alert :
````
curl -XPOST http://localhost:9200/.alerts/alert/myTestAlert -d '{
    "query" : "myAlertQuery",
    "schedule" : "00 * * * * ?",
    "trigger" : {
         "numberOfEvents" : ">1"
     },
    "timeperiod" : 300,
     "action" : {
         "email" : [ "brian.murphy@elasticsearch.com" ]
     },
    "version" : 1,
    "lastRan" : "2014-05-05T12:12:12.123Z"
}
````
With the following search template:
````
curl -XPOST localhost:9200/_search/template/myAlertQuery -d '{ "template" : { "query" : { "match_all" : {} } } }'
````
This will execute the search every minute and trigger if there is more than one match (which there will be).

Original commit: elastic/x-pack-elasticsearch@708f927914
2014-08-12 18:57:28 +01:00
Brian Murphy 1e6d6b58c9 Alerting Plugin : First commit
Very rough non-functional commit of the alerting plugin.
Please be gentle.

Original commit: elastic/x-pack-elasticsearch@98870d0778
2014-08-12 13:55:10 +01:00