Skip to content

Instantly share code, notes, and snippets.

@gmr
Created April 23, 2013 02:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gmr/5440275 to your computer and use it in GitHub Desktop.
Save gmr/5440275 to your computer and use it in GitHub Desktop.
Example riemann config
; -*- mode: clojure; -*-
; vim: filetype=clojure
(logging/init :file "/var/log/riemann/riemann.log")
; Listen on the local interface over TCP (5555), UDP (5555), and websockets
; (5556)
(let [host "0.0.0.0"]
(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:
(streams
; Index all events immediately.
index
; Calculate an overall rate of events.
(with {:metric 1 :host nil :state "ok" :service "events/sec"}
(rate 5 index))
(where (service "messages")
(coalesce (smap folds/sum*
(where (<= 0 metric 10000)
(with {:service "total messages" :state "ok" :host nil} index)
(else
(with {:service "total messages" :state "warning" :host nil} index)))))
(where (metric > 0)
(top 10 :metric
(adjust [:tags conj "top"] index)
index)))
(where (service "delivery rate")
(coalesce (smap folds/sum*
(with {:service "cluster delivery rate" :state "ok" :host nil} index)))
(top 10 :metric
(adjust [:tags conj "top"] index)
index))
; Log expired events.
(expired
(fn [event] (info "expired" event)))
))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment