Skip to content

Instantly share code, notes, and snippets.

@calston
Created November 5, 2014 13:29
Show Gist options
  • Save calston/8ea348c81375a971257b to your computer and use it in GitHub Desktop.
Save calston/8ea348c81375a971257b to your computer and use it in GitHub Desktop.
(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