Skip to content

Instantly share code, notes, and snippets.

Created January 18, 2013 18:37
What would you like to do?
(require '[clj-http.client :as http])
(require '[riemann.common :as common])
(defn remote-post [event]
(http/post "" {:body (common/event-to-json event)
:content-type :json
:accept :json }))
(logging/init :file "riemann.log")
(let [host ""]
(tcp-server :host host)
(udp-server :host host)
(ws-server :host host))
; Expire old events from the index every 5 seconds.
(periodically-expire 5)
; Keep events in the index for 5 minutes by default.
(let [index (default :ttl 300 (update-index (index)))]
; Inbound events will be passed to these streams:
; Index all events immediately.
; Calculate an overall rate of events.
(with {:metric 1 :host nil :state "ok" :service "events/sec"}
(rate 5 index))
; Log expired events.
(fn [event] (info "expired" event)))
(where (tagged "mytag") remote-post)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment