Created
April 12, 2016 13:10
-
-
Save jamtur01/5a81220bd6a727969d3d04acadda8f53 to your computer and use it in GitHub Desktop.
Check Ratio stream
This file contains hidden or 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
(defn check_ratio [srv1 srv2 newsrv warning critical & children] | |
(project [(service srv1) | |
(service srv2)] | |
(smap folds/quotient | |
(fn [event] (let [percenta (* (float (:metric event)) 100) | |
new-event (assoc event :metric percenta | |
:service (str newsrv) | |
:type_instance nil | |
:state (condp < percenta | |
critical "critical" | |
warning "warning" | |
"ok"))] | |
(call-rescue new-event children)))))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment