Why doesn't my send-email definition work?

35 views
Skip to first unread message

Matt Spaulding

unread,
Jul 8, 2016, 4:42:07 PM7/8/16
to Riemann Users
Hi,

I'm really new to both Riemann and Clojure.  Having a problem when using a definition to send email.  Here is the full config that I'm using.


(logging/init {:file "/var/log/riemann/riemann.log"})


(require 'riemann.client)


(let [host "0.0.0.0"]

    (repl-server {:host "127.0.0.1"})

    (tcp-server {:host host})

    (udp-server {:host host})

    (ws-server  {:host host}))


(def email (mailer {:from "no-r...@example.com"}))


(def send-email

        (email "mye...@example.com"))


(let [index (index)]

        (streams

                #(info %)

                (send-email)))



When I use this I get an error in the log saying:


ERROR [2016-07-08 16:30:36,624] main - riemann.bin - Couldn't start

clojure.lang.Compiler$CompilerException: clojure.lang.ArityException: Wrong number of args (0) passed to: email/mailer/make-stream--8949/stream--8951, compiling:(/etc/riemann/riemann.config:18:1)

        at clojure.lang.Compiler.load(Compiler.java:7391)

        at clojure.lang.Compiler.loadFile(Compiler.java:7317)

        at clojure.lang.RT$3.invoke(RT.java:320)

        at riemann.config$include.invokeStatic(config.clj:406)

        at riemann.config$include.invoke(config.clj:384)

        at riemann.bin$_main.invokeStatic(bin.clj:99)

        at riemann.bin$_main.invoke(bin.clj:85)

        at clojure.lang.AFn.applyToHelper(AFn.java:156)

        at clojure.lang.AFn.applyTo(AFn.java:144)

        at riemann.bin.main(Unknown Source)

Caused by: clojure.lang.ArityException: Wrong number of args (0) passed to: email/mailer/make-stream--8949/stream--8951

        at clojure.lang.AFn.throwArity(AFn.java:429)

        at clojure.lang.AFn.invoke(AFn.java:28)

        at riemann.config$eval33.invokeStatic(riemann.config:21)

        at riemann.config$eval33.invoke(riemann.config:18)

        at clojure.lang.Compiler.eval(Compiler.java:6927)

        at clojure.lang.Compiler.load(Compiler.java:7379)

        ... 9 common frames omitted



Now if I change the (send-email) part to use (email "mye...@example.com") directly everything works.  Why can't I use the send-email definition here?

Aphyr

unread,
Jul 8, 2016, 4:49:17 PM7/8/16
to rieman...@googlegroups.com
On 07/08/2016 03:42 PM, Matt Spaulding wrote:
> (def email (mailer {:from "no-r...@example.com"}))

> (def send-email
> (email "mye...@example.com"))

> clojure.lang.Compiler$CompilerException: clojure.lang.ArityException: Wrong
> number of args (0) passed to: email/mailer/make-stream--8949/stream--8951,
> compiling:(/etc/riemann/riemann.config:18:1)

`send-email` is already a stream; you don't need to wrap it in parens. You can
just say `send-email`. See http://riemann.io/howto#send-email for an example.

--Kyle
Reply all
Reply to author
Forward
0 new messages