; Enabling the log: (logging/init {:file "/var/log/riemann/riemann,log"}) ; Connection to Graphite server: (def graph (graphite {:host "graphite-server"})) ; Enable all interfaces for TCP, UDP and websockets: (let [host "0.0.0.0"] (tcp-server {:host host}) (udp-server {:host host}) (ws-server {:host host})) ; Clean up events (every 5 seconds): (periodically-expire 5) ; Email address used to send notifications: (def email (mailer {:from "riemann@example.com"})) ; Index: Definition (let [index (index)] (streams (default :ttl 60 ; immediate indexing of all incoming events: index ; Forward errors, sorted by tags: (where (state "error") (where (tagged "www") (email "webmaster@example.com")) (where (service = "postgres") (email "dba@example.com")) (where (not (or (tagged "www") (service = "postgres"))) (email "admin@example.com"))) ; Compute existing hosts: (let [hosts (atom #{})] (fn [event] (swap! hosts conj (:host event)) (prn :hosts @hosts) (index {:service "unique hosts" :time (unix-time) :metric (count @hosts)}))) ; Forward all events to the Graphite host: graph ; Log inactive events: (expired (fn [event] (info "expired" event))))) )