Created
April 30, 2014 04:29
-
-
Save ProTip/5fb17333227af7a6a03b 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 [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