Skip to content

Instantly share code, notes, and snippets.

@XANi
Last active October 16, 2019 08:05
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 XANi/8569698 to your computer and use it in GitHub Desktop.
Save XANi/8569698 to your computer and use it in GitHub Desktop.
riemann collectd derive/counter -> rate
; Expire old events from the index every 5 seconds.
(periodically-expire 600)
(def graph (graphite {:host "127.0.0.1"}))
; 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
(where (= (:ds_type event) "derive")
(by [:host :service]
(ddt 30 (over -0.0000001 graph))
))
(where (= (:ds_type event) "counter")
(by [:host :service]
(ddt 30 (over -0.0000001 graph))
))
(where (= (:ds_type event) "gauge")
(by [:host :service]
graph
))
; (where (service #"^cpu")
; #(info %)
; )
; 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