首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >riemann中的描述事件获得零

riemann中的描述事件获得零
EN

Stack Overflow用户
提问于 2015-11-13 10:17:32
回答 1查看 184关注 0票数 1

我试图用Riemann从日志库发送电子邮件警报。我的电子邮件应该在满足某些标准的情况下被触发。我写了Riemann来发送电子邮件警告,因为我正在从logstash发送某些事件,我有硬编码的:description字段,但是在我的Riemann服务器中,我总是看到描述为nil。我不知道我哪里出了问题。

Riemann Config

代码语言:javascript
复制
(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 Config

代码语言:javascript
复制
    riemann{
        host=>localhost
             riemann_event => { "service" => "e_log"
"description" => "system space communication"
"metric" => "%{metric}"
"ttl" => "%{ttl}"                                                                                 
                          }                                        
                    }

在我的Riemann服务器中,我将:description字段视为nil字段,因此:total-fail总是错误的。

黎曼服务器

代码语言:javascript
复制
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}

提前感谢

EN

回答 1

Stack Overflow用户

发布于 2015-11-16 18:49:10

我脑海中浮现的两件事:

  1. 发送这些事件的代码有问题。你能撬一下有效载荷吗?
  2. 这是一个遥远的机会:这些事件是否过期了?如果是的话,很可能钥匙就不被保留了。尝试以下操作:(定期到期5{:存放键:host :service :description ...etc.})(当然,将5更改为您希望发生的任何值)。
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/33690393

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档