Skip to content

Instantly share code, notes, and snippets.

@chiradeep
Created January 9, 2014 23:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save chiradeep/8343882 to your computer and use it in GitHub Desktop.
Save chiradeep/8343882 to your computer and use it in GitHub Desktop.
Riemann configuration to generate notifications like CloudWatch Alarms
(streams
(where (not (expired? event))
;; over time windows of 3 seconds...
(fixed-time-window 3
;; calculate the average value of the metric and emit an average (summary) event
(combine folds/mean
;; if there are no events in the window, we can get nil events
(where (not (nil? event))
#(info "average event" %)
;; collect the summary event over the last 3 fixed-time-windows
(moving-event-window 3
;;find the summary event with the minimum average metric
(combine folds/minimum
;; see if it breached the threshold
(where (> metric 6.0)
#(info "[TC]" %)
;; send the event in an email
(email "itguy@coolwebapp.net"))))))
))
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment