influxdb2

51 views
Skip to first unread message

Nickolaos Kas

unread,
Apr 27, 2022, 10:43:39 AM4/27/22
to Riemann Users

Hello,
I'm quite new to riemann, and use version 0.3.8. I have been following the methodology suggested in the amazing book 'The art of monitoring', with collectd/riemann/graphite/grafana.
We are looking to trial influxdb2 for storage, but for some reason riemann does not want to play along with it. I have the following code in my streams


   (streams
      (default :ttl 120
         ; Index all events immediately.
         (where (not (tagged "notification"))
            index)

         (tagged "collectd"
          (where (some #{(:host event)} '("vm-vmanager"))
              (smap
                (fn [event]
                      (assoc event :measurement   (:service event)
                      :influxdb-tags   {:state (:state event)}
                      ;; :value = 0 by default
                      :influxdb-fields {:value (or (:metric event) 0)}))
                 #(info %)
               {influxdb2 {:host "graph_server"
                           :port 8086
                           :bucket "infra_short"
                           :organization "riemann"}})
          ))))

This is just a snippet and hopefully I have copied pasted the streams section without forgetting any closing brackets. My influxdb has the infra_short bucket, for the riemann organization.
I have taken most of the influxdb code from the documentantion and adjusted it to my influxdb setup. I am sending the metrics of only one system (vm-vmanager) to avoid generating too much traffic.
In the logs I can see that the metric is manipulated according to the smap, so I have something like this

INFO [2022-04-27 16:31:22,462] defaultEventExecutorGroup-2-1 - riemann.config - #riemann.codec.Event{:host vm-vmanager, :service cpu/percent-system, :state ok, :description nil, :metric 0.5008347245409015, :tags [collectd], :time 1651069882, :ttl 120.0, :plugin cpu, :type percent, :ds_name value, :type_instance system, :ds_type gauge, :ds_index 0, :measurement cpu/percent-system, :influxdb-tags {:state ok}, :influxdb-fields {:value 0.5008347245409015}}

Unfortunately my influxdb database does not see anything. And when I tried to monitor network traffic, I did not see any packets leaving the riemann server for the graph_server.

Any suggestions on how I may debug this issue?

Sanel Zukan

unread,
Apr 27, 2022, 3:08:23 PM4/27/22
to Nickolaos Kas, Riemann Users
Your error might be here:

> {influxdb2 {:host "graph_server"
> :port 8086
> :bucket "infra_short"
> :organization "riemann"}})

Instead of starting backets, there should be:

(influxdb2 {:host "graph_server"
:port 8086
:bucket "infra_short"
:organization "riemann"})

Best,
Sanel
> --
> You received this message because you are subscribed to the Google Groups "Riemann Users" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to riemann-user...@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/riemann-users/02bc05c6-ab71-4086-b6e4-55b9bdcba1d1n%40googlegroups.com.

Nickolaos Kas

unread,
Apr 28, 2022, 9:01:52 AM4/28/22
to Riemann Users
Thank you very much Sanel
I see my mistake, and now at least I can see packets with metrics going to the database.

One other thing I noticed about this module is that there is little information in the log. For graphite I get logs like
INFO [2022-04-28 14:50:23,962] clojure-agent-send-off-pool-2 - riemann.graphite - Connecting to  {:host mon_graph_host1, :port 2003}
INFO [2022-04-28 14:50:23,972] clojure-agent-send-off-pool-1 - riemann.graphite - Connected to 10.226.105.149
INFO [2022-04-28 14:50:24,294] main - riemann.repl - REPL server {:port 5557, :host 127.0.0.1} online
INFO [2022-04-28 14:50:24,950] clojure-agent-send-off-pool-3 - riemann.service - Executor Service :graphite starting

But for the influxdb module I get nothing. I had the servername wrong, and no error was displayed, and also there is no confirmation if things are ok. Is there a way to enable logging verbosity for the influxdb2?

Best regards
Nick

Sanel Zukan

unread,
Apr 28, 2022, 5:39:21 PM4/28/22
to Nickolaos Kas, Riemann Users
Nickolaos Kas <redh...@gmail.com> writes:
> Thank you very much Sanel
> I see my mistake, and now at least I can see packets with metrics going to
> the database.

Great!

> One other thing I noticed about this module is that there is little
> information in the log. For graphite I get logs like
> *INFO [2022-04-28 14:50:23,962] clojure-agent-send-off-pool-2 -
> riemann.graphite - Connecting to {:host mon_graph_host1, :port 2003}*
> *INFO [2022-04-28 14:50:23,972] clojure-agent-send-off-pool-1 -
> riemann.graphite - Connected to 10.226.105.149*
> ...
> But for the influxdb module I get nothing. I had the servername wrong, and
> no error was displayed, and also there is no confirmation if things are ok.
> Is there a way to enable logging verbosity for the influxdb2?

Yes, graphite code will print these logs at startup [1], but influxdb2
will not, because there isn't any logging code, except this [2].

I'm not sure why it didn't complain for a bad connection; maybe influx
java client will keep things silent, assuming influx server would get up
at some point...

> Best regards
> Nick

[1] https://github.com/riemann/riemann/blob/main/src/riemann/graphite.clj#L146
[2] https://github.com/riemann/riemann/blob/main/src/riemann/influxdb2.clj#L53
> To view this discussion on the web visit https://groups.google.com/d/msgid/riemann-users/52ec49d2-edf2-409e-a382-734b99d13114n%40googlegroups.com.

Nickolaos Kas

unread,
Apr 29, 2022, 11:40:40 AM4/29/22
to Riemann Users
The influxdb2 module is using the rest API so I debugged my problems by packet tracing, and seeing the response to various requests. When I have some time, and if I get competent enough in clojure, I will try to implement some error messaging, and I will try to see if I can improve the tag capabilites like in the previous influxdb module.
Reply all
Reply to author
Forward
0 new messages