Created
June 18, 2013 09:53
-
-
Save benmiles/5804114 to your computer and use it in GitHub Desktop.
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
(import '(org.apache.log4j Level)) | |
(logging/init :file "/var/log/riemann/riemann.log") | |
(logging/set-level "riemann.streams" Level/DEBUG) | |
; Listen on the local interface over TCP (5555), UDP (5555), and websockets | |
; (5556) | |
(let [host "127.0.0.1"] | |
(tcp-server :host host) | |
(udp-server :host host) | |
(ws-server :host host)) | |
; Expire old events from the index every 5 seconds. | |
(periodically-expire 5) | |
; Keep events in the index for 5 minutes by default. | |
(let [index (default :ttl 300 (update-index (index))) | |
graph (graphite {:host "graphite.npgsrv.com"})] | |
; Inbound events will be passed to these streams: | |
(streams | |
index | |
;; response times (200 only) | |
;; ========================= | |
(where (and (service "response_time") | |
(tagged "status=200")) | |
prn | |
(percentiles 60 [0.5 0.98] index prn graph)) | |
;; search | |
;; ====== | |
(where (service "search") | |
prn | |
(where (tagged "type=search") | |
(where (tagged "method=perform_search") | |
(adjust [:service str " search perform_search"] | |
(percentiles 60 [0.5 0.98] index prn graph))) | |
(where (tagged "method=tire_search") | |
(adjust [:service str " search tire_search"] | |
(percentiles 60 [0.5 0.98] index prn graph)))) | |
(where (tagged "type=autocomplete") | |
(where (tagged "method=perform_search") | |
(adjust [:service str " autocomplete perform_search"] | |
(percentiles 60 [0.5 0.98] index prn graph))) | |
(where (tagged "method=tire_search") | |
(adjust [:service str " autocomplete tire_search"] | |
(percentiles 60 [0.5 0.98] index prn graph))) | |
(where (tagged "method=group_results") | |
(adjust [:service str " autocomplete group_results"] | |
(percentiles 60 [0.5 0.98] index prn graph))))) | |
;; status codes | |
;; ============ | |
(where (service "http_status") | |
(with :metric 1 | |
(adjust [:service str " rate overall"] | |
(rate 20 index prn graph)))) | |
(where (and (service "http_status") | |
(= 200 metric)) | |
(with :metric 1 | |
(adjust [:service str " rate 200"] | |
(rate 20 index graph prn)))) | |
(where (and (service "http_status") | |
(= 404 metric)) | |
(with :metric 1 | |
(adjust [:service str " rate 404"] | |
(rate 20 index graph prn)))) | |
(where (and (service "http_status") | |
(<= 500 metric 599)) | |
(with :metric 1 | |
(adjust [:service str " rate 5xx"] | |
(rate 20 index graph prn)))) | |
(where (and (service "http_status") | |
(not (or (= 200 metric) | |
(= 404 metric) | |
(<= 500 metric 599)))) | |
(with :metric 1 | |
(adjust [:service str " rate other"] | |
(rate 20 index graph prn)))) | |
) | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment