Skip to content

Instantly share code, notes, and snippets.

@pradeepchhetri
Created June 23, 2016 16:43
Show Gist options
  • Save pradeepchhetri/bfccdee75da665e763b7af4f3b7d18a1 to your computer and use it in GitHub Desktop.
Save pradeepchhetri/bfccdee75da665e763b7af4f3b7d18a1 to your computer and use it in GitHub Desktop.
(defn maintenance-mode?
"Is Riemann currently in maintenance mode?"
[]
; Take an expression representing a query for maintenance mode
(->> '(and (= :host nil)
(= :service "maintenance-mode"))
; Search the current Riemann core's index for any matching events
(riemann.index/search (:index @core))
; Take the first match
first
; Find its state
:state
; Is it the string "active"?
(= "active")))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment