我正在尝试使用黎曼从logstash 发送电子邮件警报。我的电子邮件应该在满足某些条件时被触发。我编写了 Riemann 配置来发送电子邮件警报,因为我正在从 logstash 发送某些事件,我有硬编码:description
字段,但在我的 Riemann 服务器中,我nil
一如既往地看到描述。我不知道我哪里错了。
黎曼配置
(let [host "127.0.0.1"]
(tcp-server {:host host})
(udp-server {:host host})
(ws-server {:host host}))
;Create index and print the values indexed
(let [eindex (default :ttl 300 (update-index (index)))])
;Index event for reserve webservice failure
(let [email (mailer{…….})]
(streams
(where (service "e_log")
(fixed-time-window
1
(smap
(fn [events]
(let [count-of-failures (count (filter #(re-find #"system space*" (:description %)) events))] ;Calculate the count for matched value
(event
{:status "Failure"
:metric count-of-failures
:total-fail (>= count-of-failures 1)})))
(where (and (= (:status event) "Failure")
(:total-fail event))
(email "dfbnn@gmail.com"))prn)))))
Logstash 配置
riemann{
host=>localhost
riemann_event => { "service" => "e_log"
"description" => "system space communication"
"metric" => "%{metric}"
"ttl" => "%{ttl}"
}
}
在我的黎曼服务器中,我总是看到:description
字段,nil
所以这:total-fail
总是错误的。
黎曼服务器
riemann.codec.Event{:host nil, :service nil, :state nil, :description nil, :metric 0, :tags nil, :time 1447406529, :ttl nil, :status "Failure", :total-fail false}
riemann.codec.Event{:host nil, :service nil, :state nil, :description nil, :metric 0, :tags nil, :time 1447406529, :ttl nil, :status "Failure", :total-fail false}
riemann.codec.Event{:host nil, :service nil, :state nil, :description nil, :metric 0, :tags nil, :time 1447406529, :ttl nil, :status "Failure", :total-fail false}
riemann.codec.Event{:host nil, :service nil, :state nil, :description nil, :metric 0, :tags nil, :time 1447406529, :ttl nil, :status "Failure", :total-fail false}
riemann.codec.Event{:host nil, :service nil, :state nil, :description nil, :metric 0, :tags nil, :time 1447406529, :ttl nil, :status "Failure", :total-fail false}
提前致谢