【问题标题】:custom config for riemann黎曼的自定义配置
【发布时间】:2014-04-12 06:17:43
【问题描述】:

我也是 riemann 和 clojure 的新手。想要的是,当新事件进来时,它会检查它的状态和服务,如果两者都匹配,它会在控制台中打印一些东西。这是我的配置文件。

(let [index (default :ttl 300 (update-index (index)))]

  ; Inbound events will be passed to these streams:
  (streams

    ; Index all events immediately.
    index

    ; Calculate an overall rate of events.
    (with {:metric 1 :host nil :state "ok" :service "events/sec"}
      (rate 5 index))
      ; my code starts from here 
      ; _______________________
    (where (and (= :service "foo")
        (= :state "ok"))
    (println "It works"))
;________ENDS HERE ______________
    ; Log expired events.
    (expired
      (fn [event] (info "expired" event)))
))

当我启动 riemann 时,我可以在控制台中看到“It Works”。但之后再也没有。 告诉我哪里做错了?

【问题讨论】:

    标签: clojure riemann


    【解决方案1】:

    问题似乎是您在 where 表达式中使用了关键字。 where 函数将重写条件以在内部使用关键字,尽管在 API documentation 之外似乎没有明确说明这种行为。如果您查看the howto 中的示例,则表达式在字段名称上没有冒号的条件。

    我已经测试了以下配置:

    (where (and (service "foo")
        (state "ok"))
        prn)
    

    【讨论】:

      猜你喜欢
      • 2016-02-22
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2018-03-27
      • 1970-01-01
      • 1970-01-01
      • 2021-05-23
      • 1970-01-01
      相关资源
      最近更新 更多