Created
December 22, 2015 11:38
-
-
Save filterfish/072d32ecf1f8e9f3d2b8 to your computer and use it in GitHub Desktop.
riemann flapping
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(udp-server {:host "::"}) | |
(periodically-expire 1) | |
(let [index (index)] | |
(streams | |
index | |
(match :service #"^serf" | |
(changed-state {:init "ok"} | |
(stable 20 :state | |
prn)))) | |
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#riemann.codec.Event{:host "ch01", :service "serf", :state "ok", :description "ch01 is reachable", :metric nil, :tags nil, :time 1450783205, :ttl 20.0} | |
{:time 290156645199/200, :state "expired", :service "serf", :host "ch01"} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'riemann/client' | |
r = Riemann::Client.new | |
default = {:host => 'ch01', :description => "ch01 is reachable", :metric => nil, :service => "serf", :ttl => 20} | |
r << default.merge(:state => 'critical', :description => "ch01 is not reachable").tap { |p| puts p } | |
sleep(2) | |
r << default.merge(:state => 'ok', :description => "ch01 is reachable").tap { |p| puts p } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment