Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/clojure/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Clojure riemann的自定义配置_Clojure_Riemann - Fatal编程技术网

Clojure riemann的自定义配置

Clojure riemann的自定义配置,clojure,riemann,Clojure,Riemann,我对riemann和clojure也是新手。我们需要的是,当新事件出现时,它会检查它的状态和服务,如果两者都匹配,它会在控制台中打印一些东西。这是我的配置文件 (let [index (default :ttl 300 (update-index (index)))] ; Inbound events will be passed to these streams: (streams ; Index all events immediately. index

我对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时,我可以在控制台中看到“它工作”。但之后就再也没有了。
告诉我哪里做错了。?

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

我已经测试了以下配置:

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