Skip to content

Instantly share code, notes, and snippets.

@agile
Created November 17, 2015 22:31
Show Gist options
  • Save agile/3205b661dc650b5ff4ee to your computer and use it in GitHub Desktop.
Save agile/3205b661dc650b5ff4ee to your computer and use it in GitHub Desktop.
trying to understand how to fix this.. only initial state change alerts.
; Wanting to pass events by host/service, if state changed and consistent for `len-run` events
; modified changed-state macro to use runs
(defmacro stable-changed-state
"Passes on changes in state for each distinct host and service."
[len-run & children]
`(by [:host :service]
(runs ~len-run
(changed :state ~@children))))
(def send-alert #(debug "WOULD ALERT ON" %))
(streams
(where (not= "expired" (:state event))
(splitp re-matches service
#".*an.interesting.service"
(split
; only alerts on the the first state change until riemann restarted..
(> metric 500) (with :state "critical" index graph (stable-changed-state 2 send-alert))
(> metric 250) (with :state "warning" index graph (stable-changed-state 2 send-alert))
(with :state "ok" index graph))
#(debug "unmatched service: " %))))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment