Skip to content

Instantly share code, notes, and snippets.

@jamtur01
Created January 17, 2015 17:33
Show Gist options
  • Save jamtur01/50d817ba7fde367c0ab3 to your computer and use it in GitHub Desktop.
Save jamtur01/50d817ba7fde367c0ab3 to your computer and use it in GitHub Desktop.
; -*- 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 10 {:keep-keys [:host :service :tags :metric]})
(def email (mailer {:from "[email protected]"}))
(def pd (pagerduty "a9d4031c77a643818323fb6f1fab0684"))
(def graph (graphite {:host "localhost"}))
(let [index (index)]
; Inbound events will be passed to these streams:
(streams
(default :ttl 60
; Index all events immediately.
index
(changed-state {:init "ok"}
(stable 60 :state
(where (state "ok") (:resolve pd))
(where (state "expired") (:trigger pd)))))))
; graph all
(streams
graph)
; print events to the log
(streams
prn
#(info %))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment