【发布时间】:2016-12-25 07:51:21
【问题描述】:
我在我的项目中使用 Riemann 来触发电子邮件警报。是否可以仅在特定日期触发电子邮件警报(例如(周一至周五上午 3 点至晚上 8 点)。
如果可以的话,谁能帮我参考一下。
我更新的代码:
(tcp-server {:host "127.0.0.1" :port 5555})
(let [userindex1 (default :ttl 300 (update-index (index)))])
(let [email (mailer {....email configuration})]
(streams
(where (service "log")
(smap
(fn [events]
(let [count-of-transaction (count (filter #(= "error" (:type %)) events))]
(event
{
:status "Failure"
:metric count-of-failures
:total-fail (< count-of-failures 2)})))
(where (let [now (clj-time.core/now)]
(and (<= 3 (clj-time.core/hour now) 20)
(<= 1 (clj-time.core/day-of-week now) 5)
(= (:status event) "Failure")
(:total-fail event)))
(rollup 1 200
(email "xxx@xx.com")
))prn))))
【问题讨论】:
-
我假设这是一个发布错误,但在您的示例中,最上面的 ) 位于错误的位置。
-
你是说这条线
(let [userindex1 (default :ttl 300 (update-index (index)))])
标签: clojure clojurescript riemann