FishinForIt
FishinForIt

Reputation: 13

clojure.lang.ArityException: Wrong number of args (3) passed to: client$batch

I am new to closure and trying to setup Riemann to monitor server resources and application events. I have a Riemann server setup and am trying to add a Riemann client, which will forward events to the Riemann server.

This is my Riemann client configuration file:

; -*- mode: clojure; -*-
; vim: filetype=clojure

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

(require 'riemann.client)

; Listen on the local interface over TCP (5555), UDP (5555), and websockets (5556)
(let [host "0.0.0.0"]
  (tcp-server :host host)
  (udp-server :host host)
  (ws-server  :host host))

; Expire old events from the index.
(periodically-expire 10 {:keep-keys [:host, :service, :tags, :state, :description, :metric]})

(let [index (index)
      downstream (batch 100 1/10
        (async-queue! :agg { :queue-size 1e3
                             :core-pool-size 4
                             :max-pool-size 32}
      (forward
        (riemann.client/tcp-client :host "10.11.5.10"))))]

  (streams ; Inbound events will be passed to these streams:
    (default :ttl 60 ; Keep events in the index for 1 minute by default.
      index
      #(info %)
      (where (service #"^riemann.*") ; Send any events with service starting with riemann downstream
        downstream))))

Every time I try to start Riemann, I get the following exception printed to the logs:

ERROR [2016-05-17 14:58:58,118] main - riemann.bin - Couldn't start
clojure.lang.ArityException: Wrong number of args (3) passed to: client$batch
  at clojure.lang.AFn.throwArity(AFn.java:437)
  at clojure.lang.AFn.invoke(AFn.java:47)
  at riemann.config$eval36.invoke(riemann.config:23)
  at clojure.lang.Compiler.eval(Compiler.java:6619)
  at clojure.lang.Compiler.load(Compiler.java:7064)
  at clojure.lang.Compiler.loadFile(Compiler.java:7020)
  at clojure.lang.RT$3.invoke(RT.java:318)
  at riemann.config$include.invoke(config.clj:285)
  at riemann.bin$_main.doInvoke(bin.clj:61)
  at clojure.lang.RestFn.applyTo(RestFn.java:137)
  at riemann.bin.main(Unknown Source)

I lifted this configuration file (almost verbatim) from pg. 93 of The Art of Monitoring by James Turnbull. So I am confused what I could have done wrong. Can someone help me to understand why this configuration file is throwing a wrong number of args error?

Thanks

Upvotes: 1

Views: 796

Answers (2)

MicSokoli
MicSokoli

Reputation: 841

I see you got your answer but it seems to me that the author of the book got some things about Clojure wrong on this one, and maybe that's not surprising because this is version v0.0.1 of the book.

The explanation for the code you've used says "Our binding defines a symbol called downstream. The value of this symbol is a series of streams. Our first stream is called batch." But it is clear from the code that batch is supposed to be the name of a function (or macro) that is called in the snippet.

Then it says "The batch stream passed the events into our async-queue! [...]" but the result of calling async-queue! is actually an argument with which batch is called.

Upvotes: 0

Arthur Ulfeldt
Arthur Ulfeldt

Reputation: 91617

Your installed version of Riemann is ancient, you need 0.2.11+ to have a good time following that guide.

You can get the rpm at http://riemann.io

Upvotes: 1

Related Questions