Skip to content

Instantly share code, notes, and snippets.

@jamtur01
Created April 12, 2016 13:10
Show Gist options
  • Save jamtur01/5a81220bd6a727969d3d04acadda8f53 to your computer and use it in GitHub Desktop.
Save jamtur01/5a81220bd6a727969d3d04acadda8f53 to your computer and use it in GitHub Desktop.
Check Ratio stream
(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