Created
November 5, 2014 13:29
-
-
Save calston/8ea348c81375a971257b to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(where (not (expired? event)) | |
(by [:host :service] | |
(fixed-time-window 10 | |
(smap | |
(fn [events] | |
(let [p (/ (count (filter #(= "critical" (:state %)) events)) (count events))] | |
{ :service (format "%s window" (:service (first events))) | |
:metric p | |
:host (:host (first events)) | |
:state (condp < p | |
1 "critical" | |
"ok") | |
} | |
) | |
) | |
(changed-state slacker) | |
) | |
) | |
) | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment