使用SMTP的riemann电子邮件例外

时间:2014-02-27 17:07:01

标签: clojure riemann

我能够使用SMTP设置riemann。 Riemann似乎在满足条件时发送电子邮件但我观察到异常(复制如下) - 任何有关如何解决/修复此问题的见解将不胜感激。

配置

    (def email (mailer {:host "xxx.xxx.xxx.xxx"
                        :port "xxxx"
                        :user "user@somewhere.com"
                        :pass "user12345"
                        :from "user@somewhere.com"}))

(streams
 (where (and (service #"^riemann netty execution-handler"))
        (email "user@somewhere.com")))

错误

#riemann.codec.Event{:host "ubuntu-3", :service "riemann netty execution-handler threads active", :state "ok", :description nil, :metric 0, :tags nil, :time 348380111059/250, :ttl 20000}
WARN [2014-02-27 12:00:44,278] Thread-10 - riemann.config - riemann.email$mailer$make_stream__16773$stream__16774@4e9c33e9 threw
java.lang.ClassCastException: java.lang.String cannot be cast to java.lang.Number
        at postal.smtp$smtp_send_STAR_.invoke(smtp.clj:33)
        at postal.smtp$smtp_send.doInvoke(smtp.clj:58)
        at clojure.lang.RestFn.invoke(RestFn.java:423)
        at postal.core$send_message.invoke(core.clj:35)
        at riemann.email$email_event.invoke(email.clj:18)
        at riemann.email$mailer$make_stream__16773$stream__16774.invoke(email.clj:69)
        at riemann.config$eval40$stream__41$fn__46.invoke(riemann.config:44)
        at riemann.config$eval40$stream__41.invoke(riemann.config:44)
        at riemann.core$stream_BANG_$fn__10513.invoke(core.clj:19)
        at riemann.core$stream_BANG_.invoke(core.clj:18)
        at riemann.core$instrumentation_service$measure__10522.invoke(core.clj:56)
        at riemann.service.ThreadService$thread_service_runner__8329$fn__8330.invoke(service.clj:64)
        at riemann.service.ThreadService$thread_service_runner__8329.invoke(service.clj:63)
        at clojure.lang.AFn.run(AFn.java:24)
        at java.lang.Thread.run(Thread.java:744)

1 个答案:

答案 0 :(得分:1)

通过将端口号指定为数字(不带引号)来解决问题。

<强>配置

 (def email (mailer {:host "xxx.xxx.xxx.xxx"
                        :port xxxx
                        :user "user@somewhere.com"
                        :pass "user12345"
                        :from "user@somewhere.com"}))

(streams
 (where (and (service #"^riemann netty execution-handler"))
        (email "user@somewhere.com")))