Created
April 5, 2016 06:40
-
-
Save yeshess/15603c00c1b9b8316429c1edd47400de to your computer and use it in GitHub Desktop.
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
(let [hostcnt (:metric (riemann.index/lookup index nil "hostcount")) | |
conns (/ (:metric ev) (max hostcnt 1)) | |
cooling (not (nil? (riemann.index/lookup index "scaling" "suspended"))) | |
] | |
(if (and (not cooling) ({{scale_direction}} hostcnt {{scale_limit}}) ({{scale_direction}} {{scale_threshold}} conns)) | |
(do | |
(process-policy-triggers ev) | |
(riemann.index/update index {:host "scaling" :service "suspended" :time (unix-time) :description "cooldown flag" :metric 0 :ttl {{cooldown_time}} :state "ok"}) | |
) | |
) | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment