Commit Graph

49 Commits

Author SHA1 Message Date
Robert Muir 9886ecab5c fix maven to work at all
Original commit: elastic/x-pack-elasticsearch@28f61700e6
2015-06-17 09:15:17 -04:00
Simon Willnauer d175a75cfc no sec manager for now
Original commit: elastic/x-pack-elasticsearch@36329494ea
2015-06-16 16:28:47 +02:00
Simon Willnauer fc95323904 first cut - everything compiles
Original commit: elastic/x-pack-elasticsearch@f29fd6de3f
2015-06-15 14:53:03 +02:00
uboness 0ac5dc8271 [lib] - upgraded java mail to 1.5.3
Original commit: elastic/x-pack-elasticsearch@15142f2c79
2015-06-12 21:38:02 +02:00
uboness 7d12d314ad moving version to 2.0.0-SNAPSHOT
Original commit: elastic/x-pack-elasticsearch@58e7b38de5
2015-05-20 15:29:52 +02:00
uboness 0a3c85803c moving version to 1.0.0-Beta1
Original commit: elastic/x-pack-elasticsearch@d88dd97379
2015-05-20 14:23:05 +02:00
uboness 68d0420dd2 Added maven deployment profiles
Original commit: elastic/x-pack-elasticsearch@37a867aa26
2015-05-20 13:36:36 +02:00
Brian Murphy bd9bf2810d Make log4j dependency a test only dependency
Original commit: elastic/x-pack-elasticsearch@cc8936ad8f
2015-05-06 15:59:06 -04:00
Brian Murphy 42fc43451c Unshade the javax.mail and javax.activation jars
This change removes these jars from shading and changes the assemblies file so that they are included as is.

Original commit: elastic/x-pack-elasticsearch@695f5e2b20
2015-05-06 15:59:05 -04:00
Brian Murphy b0fd2f9f59 Relocate guava and owasp under org.elasticsearch.watcher.common/common.owasp.
This change relocates the shaded jars for guava and owasp under org.elasticsearch.watcher.common and org.elasticsearch.watcher.common.owasp respectively.

Original commit: elastic/x-pack-elasticsearch@0e2d6303e0
2015-05-04 12:59:34 -04:00
Brian Murphy bc78dd36c9 Add and shade dependency on com.google.guava
This is needed for owasp to load the Sanitizers class at runtime.

Original commit: elastic/x-pack-elasticsearch@4ed5776509
2015-05-03 20:53:16 -04:00
uboness 67d2a39f2c [fix] fixed shield integration
- updated Shield version to 1.2.1 (final)
- Not all requests sent via the client proxy where set with the `__watcher_user`

Fixes elastic/elasticsearch#283

Original commit: elastic/x-pack-elasticsearch@3a36bd4d55
2015-04-30 02:08:27 +02:00
uboness 20059d353a fixed the watcher info API
To return the right build info & version

Fixes elastic/elasticsearch#258

Original commit: elastic/x-pack-elasticsearch@53f5189978
2015-04-29 18:03:21 +02:00
Brian Murphy 94bea8f83a Change the watch specific actions to reflect that they operate on watches.
This change changes the watch specific actions put/get/delete/execute/ack to be watcher.<action>_watch.

Original commit: elastic/x-pack-elasticsearch@86a91cb141
2015-04-28 19:08:28 -04:00
Brian Murphy a68d9018f2 Disable minimizeJar in pom.xml
The javax package finds some needed classfiles by reflection. Minimizing the shaded jar meant that these were not available.

Fixes elastic/elasticsearch#254

Original commit: elastic/x-pack-elasticsearch@7cdc3bc55b
2015-04-23 17:37:39 -04:00
uboness 70209698fb Changed version to 1.0.0-Beta1-SNAPSHOT
Original commit: elastic/x-pack-elasticsearch@6bd62904cc
2015-04-23 10:35:33 +02:00
Martijn van Groningen 7851ad6993 Removed quartz, timer and hashwheel schedule engines. Renames simple engine to ticket engine.
Original commit: elastic/x-pack-elasticsearch@f59be963ef
2015-04-22 23:36:53 +02:00
Brian Murphy 3c7b42eb7b Support for Sanitized HTML in emails.
This change adds a shaded dependency on owasp (https://code.google.com/p/owasp-java-html-sanitizer/) to add support for HTML Sanitization.
Only images that reference an attachment are supported. This Sanitization may be customized for each email profile.
Other dangerous behavior is suppressed.

See elastic/elasticsearch#163
Fixes elastic/elasticsearch#163

Original commit: elastic/x-pack-elasticsearch@bc237d1beb
2015-04-22 16:57:03 -04:00
Martijn van Groningen 4c6d2e7b39 Build: removed -XX:MaxPermSize option from pom.xml
Support for this option has been removed in Java 8 and the build works without it with Java 7 too.

Original commit: elastic/x-pack-elasticsearch@b1ba8893f2
2015-04-07 13:41:51 +02:00
Brian Murphy 5e57389c11 Add webhook and index actions tests.
This commit adds tests for the webhook and index actions.
Also adds docs for the webhook and index actions and fixes url escaping of webhook action urls.

Original commit: elastic/x-pack-elasticsearch@b70435b198
2015-04-01 16:18:37 -04:00
Brian Murphy 3a09914b67 Add support for rest tests
This commit adds support for rest tests using the same yaml and json formatting as for core elasticsearch.
Also added is support for shield in the rest tests.

Original commit: elastic/x-pack-elasticsearch@bbeb9c0fc9
2015-03-31 17:25:48 -04:00
Martijn van Groningen e00bb69982 Added http input.
The http input allows to let any http interface be the input for a watch.
The http input can be configured with the following options:
* `method` - Optional http method. (default to GET)
* `host` - The host of the http service.
* `port` - The port of the http service.
* `path` - The url path.
* `params` - Optional url query string options.
* `header` - Optional http header.
* `auth` - Optional authentication http heads.
* `body` - Optional body

The response of the http request is expected to be valid json.

Closes elastic/elasticsearch#157

Original commit: elastic/x-pack-elasticsearch@0b1f122615
2015-03-30 18:32:06 +02:00
uboness fca9b6a1e6 Integration with Shield
- Change action names to be aligned with Shield. All actions are categorized as `cluster management`.. the read actions (get & stats) are also also categorized as `cluster monitoring`.

- Added `ShieldIntegration` and `WatcherShieldModule` to handle all the integration points.

- We have a new internal shield user `__watcher_user` that will be the actor behind all the watcher interal action executions (managing the `.watches` and `.watch_history` indices

- This integration revealed a bug where the watcher plugin would not wire correctly with transport clients. This is now fixed with the introduction of a dedicated `TransportClientWatcherModule`

- Added docs

Closes elastic/elasticsearch#43

Original commit: elastic/x-pack-elasticsearch@26e9b0da06
2015-03-27 20:19:19 +01:00
Martijn van Groningen 6277a32b91 Set minimum binary compatibility to ES 1.5
Closes elastic/elasticsearch#160

Original commit: elastic/x-pack-elasticsearch@10da3efb1a
2015-03-26 18:20:39 +01:00
uboness 41832b6f5b Change project name to elasticsearch-watcher
- `alerts` package is now `watcher` package
- we no longer use the term `Alert`, but instead we use `Watch`
- documentation still needs to be updated

Original commit: elastic/x-pack-elasticsearch@1225edf7e3
2015-03-24 13:46:01 +01:00
uboness 50f4a1c0e3 Introducing TimeWarp mode for tests
The idea behind a time warp mode is that while it's enabled the time related constructs in the alerts module are replaced with a mock test friendly version.. so we'll be able to control time and therefore avoid sleeping the threads.

 In time warp mode:

-  The `SchedulerMock` is used to manually fire jobs
-  The `ClockMock` is used to set and fast forward time
-  The alerts are executed on the same thread as the scheduler mock... so we don't have to deal with async nature at all. This is accomplished by the added `AlertsExecutor` abstraction.

By default, the time warp mode is enabled and tests run in it. If a test must not use the time warp mode, it is possible to add `@TimeWarped(false)` annotation to the test and it will then run with the standard scheduler & clock. It is also possible to disable this mode all together by running the tests with `-Dtests.timewarp=false`.

All the updated tests now work in both modes (whether the time warp mode is dis/enabled). This is important as on the server we would like to run the tests outside of this mode as well, but locally we'd like to run them with time warped enabled (so they'll be faster)

Also, cleaned up the tests.. we now only do `assertThat(...)` calls (no `assertTrue` or `assertEquals`... for consistency sake)

Original commit: elastic/x-pack-elasticsearch@11e09f6dea
2015-03-06 08:33:21 +01:00
uboness b292051a13 [email] fixed bugs and added unit tests
Original commit: elastic/x-pack-elasticsearch@3b5406d4c8
2015-02-24 12:27:13 +02:00
uboness 8dffa5afd1 Enabled tests @Slow annotation
Original commit: elastic/x-pack-elasticsearch@4cabffcdf4
2015-02-23 15:44:15 +02:00
uboness 2136210711 [template] formalized the template definition
- Introduced `Template` & `Template.Parser` interfaces
- There main template implementation is the `ScriptTemplate` and its parser is bound to `Template.Parser`
- There are also xContent templates - YAML & JSON that just render the model as xContent. (used as a fallback in webhook action)
- updated all actions to use the new template infrastructure

Also

- introduced mockito for unit testing
- removed `WebhookTest` as it was effectively testing the template functionality... we'll add a proper test for teh webhook action in a later commit

Original commit: elastic/x-pack-elasticsearch@34a90e8c2f
2015-02-23 12:30:31 +01:00
uboness 54923420d9 [cleanup] - added forbidden apis mvn plugin
- fixed the use of the found forbidden APIs
- changed `FiredAlert.State` values to lower case (for consistency sake)

Original commit: elastic/x-pack-elasticsearch@9b3f8383d9
2015-02-17 16:31:18 +01:00
uboness 70b5d36098 Enhanced email action
- Introducing the notion of email account (i.e. smtp account). It is now possible to configure multiple email accounts (in node settings) via which the emails will be sent. The email alert action can be configured with an account name, to indicate which account should be used, if no account is configured, the email will be sent with the _default account_. The default account can also be configured using the `default_account` node setting.
- `InternalEmailService` maintains the email sessions and responsible for sending emails.
- the account settings are dynamic (configurable at runtime)
- `Email` class was introduces to abstract away the email structure (`javax.mail`'s `Message` is not the most intuitive construct to deal with. `Email` enables setting both `text` and `html` content and also support normal and inlined attachments.
- "profiles" were added to support different email message formats. Unfortunately the different email systems don't fully comply to the standards and each has their own way of structuring the mime message (especially when it comes to attachments). The `Profile` enum abstracts this by letting the user define what email system structure it wants to support. we define 4 profiles - `GMAIL`, `MAC`, `OUTLOOK` and `STANDARD`. `STANDARD` is the official way of structuring the mime message according to the different RFC standard (it also serves as the default profile).
- The `EmailAction` only task is to create an `Email` based on the action settings and the payload, and send it via the `EmailService`.

Original commit: elastic/x-pack-elasticsearch@2b893c8127
2015-02-10 18:19:11 -08:00
Martijn van Groningen 27b6aa50f7 Add version and build information to the stats api
Also set the current maven version to -SNAPSHOT

Original commit: elastic/x-pack-elasticsearch@964c740373
2015-01-30 17:08:19 +01:00
Martijn van Groningen f5605db41b Share all libraries and noop-ed quartz logging
Original commit: elastic/x-pack-elasticsearch@88228b7f46
2015-01-30 17:02:28 +01:00
Brian Murphy cef0976a6c Change the version to 1.0.0-beta2i
Original commit: elastic/x-pack-elasticsearch@aace18a423
2015-01-15 16:54:25 -05: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 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 a6bdb5f572 Test: testing framework requires lucene test jar to be before lucene core jar on the classpath
Original commit: elastic/x-pack-elasticsearch@9b043c9b5b
2014-11-07 14:29:56 +01:00
Martijn van Groningen 434ee83df6 Build: Configure randomizedtesting properly
Original commit: elastic/x-pack-elasticsearch@e7b1a4fb9c
2014-11-07 14:24:56 +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 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 61a28f68e3 Upgraded to ES 1.4.0
Original commit: elastic/x-pack-elasticsearch@6685382a01
2014-11-05 16:06:36 +01:00
Bill Hwang 266a53d913 [CI] Add jacoco coverage profile
Original commit: elastic/x-pack-elasticsearch@1f9a665e8f
2014-10-24 10:16:03 -07:00
Martijn van Groningen 39182616c7 Added slf4j log4j bindings for quartz :(
Original commit: elastic/x-pack-elasticsearch@2bc5bda9ed
2014-10-24 18:18:42 +02:00
Martijn van Groningen 9b7b2214c0 Removed duplicate dependency
Original commit: elastic/x-pack-elasticsearch@58a9068b61
2014-10-24 13:13:59 +02:00
Martijn van Groningen 96fe2d9ddf silly me
Original commit: elastic/x-pack-elasticsearch@b24829745d
2014-10-24 13:09:28 +02:00
Martijn van Groningen 6c66ca5fdc Build: Updated the groupId and artifactId
Original commit: elastic/x-pack-elasticsearch@326d53f3ec
2014-10-24 13:07:36 +02: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 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