Skip to content

Instantly share code, notes, and snippets.

@chiradeep
Created January 9, 2014 23:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save chiradeep/8344091 to your computer and use it in GitHub Desktop.
Save chiradeep/8344091 to your computer and use it in GitHub Desktop.
Riemann function for threshold crossing alerts
(defn tc [wndtime numwnds threshold & children]
(fixed-event-window wndtime
(combine folds/mean
(moving-event-window numwnds
(combine folds/minimum
(where (> metric threshold)
;;create a threshold crossing event
(with {:host nil :state "threshold crossed" :description (str "service crossed the value of " threshold " over " numwnds " windows of " wndtime " seconds")}
(apply sdo children)))))))
)
(streams
(tc 3 3 6.0
(email "itguy@othercoolapp.net"))
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment