Skip to content

Instantly share code, notes, and snippets.

@faxm0dem
Created November 16, 2015 14:00
Show Gist options
  • Save faxm0dem/79b78afb777d8d518c47 to your computer and use it in GitHub Desktop.
Save faxm0dem/79b78afb777d8d518c47 to your computer and use it in GitHub Desktop.
Riemann.io exceptions to events
;; watchdog-cfg is just a hash with host, port, etc.
(streams
;; irrelevant code ommited :)
(where (service #"riemann server")
(let [send-watchdog (forward (riemann.client/tcp-client watchdog-cfg))]
(fn watchdog-sending [event]
(try (send-watchdog event)
(catch Exception exc
(tell-ops (utils/exception->event exc))))))))
(ns bla-bla.utils
(require [clj-time.core :as ct])
(require [clj-time.coerce :as tc]))
(defn exception->event
[exc]
{:host "riemann.local"
:service "riemann"
:state "critical"
:metric 1
:tags []
:ttl 60
:description (str exc)
:time (tc/to-long (ct/now))})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment