Commit Graph

236 Commits

Author SHA1 Message Date
Martijn van Groningen b039f8bbdb Changed to use indexBlockedException instead of indicesBlockedException
Original commit: elastic/x-pack-elasticsearch@33f581ddd2
2014-12-05 19:13:31 +01:00
Martijn van Groningen bbaa122d7e Removed unused field.
Original commit: elastic/x-pack-elasticsearch@b6b0d926ba
2014-12-05 19:11:24 +01:00
Martijn van Groningen 45e5c13369 Disallow dynamic mapping
Added config mapping

Original commit: elastic/x-pack-elasticsearch@f3de2c17bd
2014-12-05 17:03:26 +01:00
Brian Murphy c97e083a59 Move the saving of configs to the manager.
Original commit: elastic/x-pack-elasticsearch@aa8372d34e
2014-12-05 15:55:19 +00:00
Martijn van Groningen ac45a4fe99 Changes the configuration manager to rely more on alert store for the .alerts index / templated to be loaded. This simplified to loading logic in the configuration manager.
Original commit: elastic/x-pack-elasticsearch@ccd7a23243
2014-12-05 16:42:58 +01:00
Brian Murphy 780c89ec23 Move settings checking to the creation of SMTP alert actions.
Original commit: elastic/x-pack-elasticsearch@30da14cb9e
2014-12-05 15:09:07 +00:00
Martijn van Groningen 203cf5c024 Remove redundant config manager start checking
Original commit: elastic/x-pack-elasticsearch@5369765398
2014-12-05 16:02:28 +01:00
Martijn van Groningen 984d7d615a removed log statements
Original commit: elastic/x-pack-elasticsearch@c4b7b16cd4
2014-12-05 15:36:18 +01:00
Martijn van Groningen aeacbe44ca Removed redundant if statement
Original commit: elastic/x-pack-elasticsearch@2de43dc7d5
2014-12-05 15:34:44 +01:00
Martijn van Groningen 1258a4c327 Renamed ConfigManager#isReady() to ConfigManager#start()
Add ConfigManager#stop()
Simplified config loading
smpt alert action settings are now also updated

Original commit: elastic/x-pack-elasticsearch@acb180f88c
2014-12-05 15:14:24 +01:00
Brian Murphy 920f7ea2a9 More changes for configuration manager and email action renaming.
Original commit: elastic/x-pack-elasticsearch@1c5087e79a
2014-12-05 12:07:31 +00:00
Brian Murphy 1f49c9199d Changes after review.
Original commit: elastic/x-pack-elasticsearch@a5fac88f19
2014-12-05 12:07:31 +00:00
Brian Murphy d70164de4d Rename EmailAlertAction
Original commit: elastic/x-pack-elasticsearch@35e819cdf2
2014-12-05 12:06:42 +00:00
Brian Murphy 6791841f42 Changes after review.
Original commit: elastic/x-pack-elasticsearch@0a9055b918
2014-12-05 12:05:57 +00:00
Brian Murphy 31173507a5 Add actions and listeners for Configuration.
Add transport actions for configuration.
Add Listener so that components can listen for config changes.

Original commit: elastic/x-pack-elasticsearch@bab02770d9
2014-12-05 12:05:57 +00:00
Brian Murphy d3ec7f40ba Add tests for configuration manager.
Original commit: elastic/x-pack-elasticsearch@9c284fc4c6
2014-12-05 12:05:57 +00:00
Brian Murphy 8fa42a581f Configuration : Add ability to configure alerting by creating .alerts/config/<name> documents in the index.
This commit adds the ConfigurationManager which the components use to load configuration from the index.
The configuration manager exposes an isReady method which components should not start until it is returns true.

Original commit: elastic/x-pack-elasticsearch@96a2f9f44f
2014-12-05 12:05:57 +00:00
Brian Murphy 3f4d469d4a FIX: Fixes after merge fail.
Original commit: elastic/x-pack-elasticsearch@6bab2d2640
2014-12-04 15:10:18 +00:00
Brian Murphy b68d7e5554 Changes for payload merge.
Original commit: elastic/x-pack-elasticsearch@7989471378
2014-12-04 14:54:20 +00:00
Martijn van Groningen e09fface02 adjust formatting
Original commit: elastic/x-pack-elasticsearch@aeabde439e
2014-12-04 13:53:09 +01:00
Martijn van Groningen d3dcecbd77 Changed visibility of setters and made naming of setters and getters consistent
Original commit: elastic/x-pack-elasticsearch@c9cc736012
2014-12-01 18:52:02 +01:00
Martijn van Groningen 8910a1f284 Let the xcontent type of alert history documents be based on the xcontent type of alert documents.
Closes elastic/elasticsearch#54

Original commit: elastic/x-pack-elasticsearch@e03bf5d3bf
2014-11-28 15:54:32 +01:00
Martijn van Groningen c094430584 Moved the stopping log info message
Original commit: elastic/x-pack-elasticsearch@0391704846
2014-11-28 15:36:34 +01:00
Martijn van Groningen b883641b01 Also check if the refresh was successful on all the shards it was supposed to execute.
Original commit: elastic/x-pack-elasticsearch@ab867346e4
2014-11-28 12:49:51 +01:00
Martijn van Groningen 737e9567b9 Alert action manager: Start the queue reader thread with self maintained thread instead of using thread pool.
This gives us more control over interrupting and joining this thread during stopping, so we have a good moment in time to clear the queue.

Original commit: elastic/x-pack-elasticsearch@ed3f85fa75
2014-11-27 17:22:22 +01:00
Martijn van Groningen ac715134b3 Increased logging
Original commit: elastic/x-pack-elasticsearch@39093540fd
2014-11-27 15:46:41 +01:00
Brian Murphy fbec93d941 This adds metadata to alerts that are copied to the action entries for this alert.
Original commit: elastic/x-pack-elasticsearch@0abfc22421
2014-11-27 14:00:28 +00:00
Martijn van Groningen c29e3c9611 But we still need to clear if loading fails
Original commit: elastic/x-pack-elasticsearch@69bf786e81
2014-11-27 14:07:20 +01:00
Martijn van Groningen 385ea45b7c If loading or alerts or alert entries fail the alert manager should retry and if the search response are partial alert manager should retry as well.
Original commit: elastic/x-pack-elasticsearch@ea6a5a6372
2014-11-27 13:57:09 +01:00
Martijn van Groningen 6da23d412a When stopping alert manager wait for ongoing operations to complete.
Original commit: elastic/x-pack-elasticsearch@646e534628
2014-11-27 13:36:09 +01:00
Martijn van Groningen 27f83bb621 Clear the queue once the reader thread sees that it needs to stop.
Original commit: elastic/x-pack-elasticsearch@b70a224ff1
2014-11-27 12:14:30 +01:00
Martijn van Groningen 1cd5ae6a31 Added assertion
Original commit: elastic/x-pack-elasticsearch@3aae405242
2014-11-27 11:40:56 +01:00
Martijn van Groningen 29dd1bb888 Removed error log for null values
Original commit: elastic/x-pack-elasticsearch@4477fc1c2a
2014-11-27 10:17:51 +01:00
Martijn van Groningen 775f1cb878 Increased logging
Original commit: elastic/x-pack-elasticsearch@375279fca5
2014-11-27 09:53:10 +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 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 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 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 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 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 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 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 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
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 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 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 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