Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
(require '[org.spootnik.riemann.collectd :refer [rewrite-service-with]])
(require '[org.spootnik.riemann.thresholds :refer [threshold-check]])
(include "thresholds.clj")
(include "services.clj")
(logging/init {:file "/var/log/riemann/riemann.log"})
(let [host "127.0.0.1"]
(tcp-server {:host host})
(ws-server {:host host}))
(instrumentation {:enabled? false})
(periodically-expire 1 {:keep-keys [:host :service :tags]})
(def contact_email "a@b.com")
(def contact_sms "+1234567890")
(def send_email (mailer {...}))
(def send_sms (twilio {...}))
(def alert (throttle 3 900 (send_email contact_email) (send_sms contact_sms)))
(def rewrite-service (rewrite-service-with services-patterns))
(def apply-thresholds (threshold-check thresholds))
(let [
index (default {:ttl 30, :state "ok"}
(tap :index
(smap apply-thresholds
(smap rewrite-service (index)))))
]
(streams
index
(where (not (service #"^cpu-max"))
(expired alert))
(where (and (not (= (:state event) nil))
(not (expired? event)))
(changed-state {:init "ok"}
(send_email contact_email))))
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.