【问题标题】:description event getting nil in riemann描述事件在黎曼中为零
【发布时间】:2016-02-14 21:30:12
【问题描述】:

我正在尝试使用 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 "dfbnn@gmail.com"))prn)))))

Logstash 配置

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

在我的 Riemann 服务器中,: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}

提前致谢

【问题讨论】:

  • 这可能对prn 事件有所帮助,因此您可以验证您尝试获取:description 密钥的地图是否确实具有该密钥。我不知道关于黎曼的第一件事,但我想知道是否可能将键存储为"description" 之类的字符串而不是:description 之类的关键字?
  • 黎曼配置中的=> 符号是什么?那应该是 clojure 地图吗?

标签: clojure clojurescript riemann


【解决方案1】:

我想到了两件事:

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

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2016-03-19
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-09-24
    • 1970-01-01
    • 1970-01-01
    • 2021-05-23
    相关资源
    最近更新 更多