1
我是clojure的新手,需要設置riemann配置,以便編輯/添加新條件。我們現在有什麼:需要幫助優化clojure語句
(defn tell-ops
([to]
(by [:service]
(throttle 3 360
(rollup 2 360
slackerDefault
(email to)))))
([to channel]
(by [:service]
(throttle 3 360
(rollup 2 360
(slacker channel)
(email to))))))
............
(where (state "FATAL")
(where (service #"^Serv1")
(tell-ops "[email protected]" "#dev-ops1"))
(where (service #"^Serv2")
(tell-ops "[email protected]"))
....
)
而且,它缺乏default語句,像 如果沒有匹配,告訴-OPS「[email protected]」
我想我需要的東西就像一個頂級struct
(def services
[{:regex #"^serv1" :mail "[email protected]" :channel "#serv1"}
{:regex #"serv2$" :mail "[email protected]"} ])
因此很容易添加新的。但我不知道如何循環穿透式該數組考慮缺席的:在第二種情況下通道,使「默認調用」如果沒有正則表達式的提前
謝謝,我會試一試並在此發佈結果! –