diff --git a/readme.md b/readme.md index 8b0ad87a..1234d9a4 100644 --- a/readme.md +++ b/readme.md @@ -84,12 +84,12 @@ start analyzing for anomalies! ### Alerts Skyline can alert you! In your settings.py, add any alerts you want to the ALERTS list, according to the schema `(metric keyword, strategy, expiration seconds)` where -`strategy` is one of `smtp`, `hipchat`, or `pagerduty`. You can also add your own +`strategy` is one of `smtp`, `hipchat`, `pagerduty` or `pushnotify`. You can also add your own alerting strategies. For every anomalous metric, Skyline will search for the given keyword and trigger the corresponding alert(s). To prevent alert fatigue, Skyline will only alert once every for any given metric/strategy combination. To enable Hipchat integration, uncomment the python-simple-hipchat -line in the requirements.txt file. +line in the requirements.txt file. To enable Pushnotify integration, uncomment the py-pushnotify line. ### How do you actually detect anomalies? An ensemble of algorithms vote. Majority rules. Batteries __kind of__ included. diff --git a/requirements.txt b/requirements.txt index 82f9822f..8e062580 100644 --- a/requirements.txt +++ b/requirements.txt @@ -6,3 +6,4 @@ simplejson==2.0.9 unittest2 mock #python-simple-hipchat +#py-pushnotify diff --git a/src/analyzer/alerters.py b/src/analyzer/alerters.py index edf076b0..7171dea5 100644 --- a/src/analyzer/alerters.py +++ b/src/analyzer/alerters.py @@ -47,6 +47,13 @@ def alert_smtp(alert, metric): s.quit() +def alert_pushnotify(alert, metric): + import pushnotify + client = pushnotify.get_client(settings.PUSHNOTIFY_OPTS['protocol'], application='skyline') + for x in settings.PUSHNOTIFY_OPTS['keys']: + client.add_key(x) + client.notify("%s (value: %s)" % (metric[1], metric[0]), "Anomalous metric") + def alert_pagerduty(alert, metric): import pygerduty pager = pygerduty.PagerDuty(settings.PAGERDUTY_OPTS['subdomain'], settings.PAGERDUTY_OPTS['auth_token']) diff --git a/src/settings.py.example b/src/settings.py.example index c128fe88..6511ba56 100644 --- a/src/settings.py.example +++ b/src/settings.py.example @@ -154,6 +154,12 @@ PAGERDUTY_OPTS = { "key": "your_pagerduty_service_api_key", } +# PushNotify alerts require py-pushnotify +PUSHNOTIFY_OPTS = { + # Your pagerduty subdomain and auth token + "protocol": "prowl", + "keys": ["YOUR-KEY-HERE"] +} """ Horizon settings