Skip to content

Instantly share code, notes, and snippets.

@ProTip
Created April 30, 2014 04:29
Show Gist options
  • Save ProTip/5fb17333227af7a6a03b to your computer and use it in GitHub Desktop.
Save ProTip/5fb17333227af7a6a03b to your computer and use it in GitHub Desktop.
(let [threshold 15.0
parse-stack-servers (fn [& children]
(fn [event]
(let [new-event (assoc event
:graphite {
:product (:product (:graphite event))
:environment (:environment (:graphite event))
:namespace (:namespace (:graphite event))
:stack (nth (:remainder (:graphite event)) 0)
:server (nth (:remainder (:graphite event)) 1)
:category (nth (:remainder (:graphite event)) 2)
:instance (nth (:remainder (:graphite event)) 3)
:type (nth (:remainder (:graphite event)) 4)
}
:tags (vec(concat (:tags event) [(nth (:remainder (:graphite event)) 4)]))
:server (nth (:remainder (:graphite event)) 1)
:host (nth (:remainder (:graphite event)) 1)
)]
(call-rescue new-event children))))]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
(where (not(=(:instance(:graphite event))"_total"))
(by :server
(where (> threshold metric)
(with :state "critical"
index)
(throttle 1 60
(:trigger pd))
(else (with :state "ok" index #(info %)))))))))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment