描述事件在黎曼中为零

问题描述 投票:0回答:2

我正在尝试使用 Riemann 从 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 "[email protected]"))prn)))))

Logstash 配置

    riemann{
        host=>localhost
             riemann_event => { "service" => "e_log"
"description" => "system space communication"
"metric" => "%{metric}"
"ttl" => "%{ttl}"                                                                                 
                          }                                        
                    }

在我的黎曼服务器中,我看到

:description
字段始终为
nil
,因此
: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}
riemann.codec.Event{:host nil, :service nil, :state nil, :description nil, :metric 0, :tags nil, :time 1447406529, :ttl nil, :status "Failure", :total-fail false}

提前致谢

clojure clojurescript riemann
2个回答
0
投票

我想到两件事:

  1. 发送这些事件的代码有问题。你能prn有效负载吗?
  2. 这是一个远景:这些活动过期了吗?如果是的话,钥匙很可能没有被保留。试试这个:(periodically-expire 5 {:keep-keys [:host :service :description ...etc...]}) (当然,将 5 更改为您希望发生的任何值)。

0
投票

:ttl nil 是什么意思?没有 ttl 或者 riemann 中的 TTL 是无限的?

© www.soinside.com 2019 - 2024. All rights reserved.