Skip to content

Instantly share code, notes, and snippets.

@yeshess
Created April 5, 2016 06:40
Show Gist options
  • Save yeshess/15603c00c1b9b8316429c1edd47400de to your computer and use it in GitHub Desktop.
Save yeshess/15603c00c1b9b8316429c1edd47400de to your computer and use it in GitHub Desktop.
(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