riemann/riemann

Riemann to Nagios Integration

Closed this issue · 15 comments

I want Riemann to send events to Nagios using NSCA.
I have RHEL instance with Nagios and NSCA configured and Riemann installed and working.
So any help will be really appreciated.

FWIW the nagios integration only supports very basic encryption

I'm okay with basic encryption @faxm0dem.
I just want to make a use case of this integration so I'm okay with basic encryption.

Have you looked at the Nagios plugin?

Check the docs:

http://riemann.io/api/riemann.nagios.html

And this post might also help:

https://stackoverflow.com/questions/31199676/configure-nagios-riemann-integration-for-monitoring

Do you have a specific issue?

I tried the solution given in the stack overflow post but that didn't work.
Can you help me with this please.

What didn't work? I can't really help if you don't elaborate.

  1. Please tell me the version of Riemann and NSCA you're using.
  2. Show me your Riemann and Nagios configurations.
  3. Any logs or errors you're seeing.

Hi @jamtur01,
I am using Riemann-0.3.1 and NSCA-2.9.2.
And I have set password in both send_nsca.cfg and nsca.cfg same.
Also I have used the code from the post you gave the link from stack overflow.

@shekaralle Show me the code and any log output please. I can't help without details.

This is my riemann.config file:

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

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

; 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 every 5 seconds.
(periodically-expire 5)

(let [index (index)]
  ; Inbound events will be passed to these streams:
  (streams
    (default :ttl 60
      ; Index all events immediately.
      index

      ; Log expired events.
      (expired
        (fn [event] (info "expired" event))))))
;(let [nagios (nagios {:host "localhost" :port 5667 :password "password" :encryption NONE})]
;  (streams
;      (where (service "cpu")
;	        nagios)))

I have commented out the nagios part because if I use it, it was giving me error.

What was the error?

Well it seems to be working now after I did some changes with encryption.
This is the output I'm getting:

Dec  9 03:31:33 arrow-pc nsca[27756]: SERVICE CHECK -> Host Name: 'arrow-pc', Service Description: 'cpu', Return Code: '0', Output: '3.43% user+nice+system#012#01224.1  4298 java#012 4.8  5097 chrome#012 4.1  3752 pulseaudio#012 2.4  3699 compiz#012 1.9  5169 chrome#012 1.6  2807 Xorg#012 1.3  5327 chrome#012 0.7 23825 chrome#012 0.4 28904 chrome#012 0.4 24158 chrome'
Dec  9 03:31:33 arrow-pc nsca[27756]: Attempting to write to nagios command pipe
Dec  9 03:31:33 arrow-pc nsca[27756]: End of connection...
Dec  9 03:31:33 arrow-pc nagios: External command error: Malformed command

But it says malformed command and also I can't see that on Nagios dashboard.
Is there a way I need to configure it to show up on my dashboard.
Thanks.

That sounds like the Nagios command you're trying to run failed. That looks like a Nagios/NCSA error and not a Riemann one. I am afraid I can't help there.

Haha yeah that is a Nagios/NSCA error and nothing to do with Riemann.
Well thanks for your help.

I am getting some error while running Riemann.
Following is the error:

arrow@arrow-pc:~/riemann-0.3.1$ bin/riemann etc/riemann.config
INFO [2018-12-09 00:22:09,513] main - riemann.bin - PID 12601
INFO [2018-12-09 00:22:09,517] main - riemann.bin - Loading /home/arrow/riemann-0.3.1/etc/riemann.config
INFO [2018-12-09 00:22:09,722] clojure-agent-send-off-pool-3 - riemann.transport.websockets - Websockets server 0.0.0.0 5556 online
INFO [2018-12-09 00:22:09,843] clojure-agent-send-off-pool-2 - riemann.transport.tcp - TCP server 0.0.0.0 5555 online
INFO [2018-12-09 00:22:09,877] clojure-agent-send-off-pool-4 - riemann.transport.udp - UDP server 0.0.0.0 5555 16384 -1 online
INFO [2018-12-09 00:22:09,879] main - riemann.core - Hyperspace core online
INFO [2018-12-09 00:22:15,193] worker-1 - riemann.transport.websockets - New websocket subscription to index : service = "cpu"
INFO [2018-12-09 00:22:34,704] riemann task 0 - riemann.config - expired {:host arrow-pc, :service memory, :state expired, :time 308859030939/200, :ttl 60}
INFO [2018-12-09 00:22:34,707] riemann task 0 - riemann.config - expired {:host arrow-pc, :service disk /, :state expired, :time 1544295154707/1000, :ttl 60}
INFO [2018-12-09 00:22:34,708] riemann task 0 - riemann.config - expired {:host arrow-pc, :service disk /boot/efi, :state expired, :time 1544295154707/1000, :ttl 60}
INFO [2018-12-09 00:22:34,708] riemann task 0 - riemann.config - expired {:host arrow-pc, :service load, :state expired, :time 386073788677/250, :ttl 60}
WARN [2018-12-09 00:22:35,378] defaultEventExecutorGroup-2-3 - riemann.config - riemann.nagios$nagios$fn__11643@2376ae3 threw
java.net.SocketTimeoutException: Read timed out
	at java.net.SocketInputStream.socketRead0(Native Method)
	at java.net.SocketInputStream.socketRead(SocketInputStream.java:116)
	at java.net.SocketInputStream.read(SocketInputStream.java:170)
	at java.net.SocketInputStream.read(SocketInputStream.java:141)
	at java.io.DataInputStream.readFully(DataInputStream.java:195)
	at com.googlecode.jsendnsca.core.NagiosPassiveCheckSender.readInitializationVector(NagiosPassiveCheckSender.java:108)
	at com.googlecode.jsendnsca.core.NagiosPassiveCheckSender.send(NagiosPassiveCheckSender.java:77)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at clojure.lang.Reflector.invokeMatchingMethod(Reflector.java:93)
	at clojure.lang.Reflector.invokeInstanceMethod(Reflector.java:28)
	at cljr_nsca.core$send_message.invokeStatic(core.clj:42)
	at cljr_nsca.core$send_message.invoke(core.clj:39)
	at riemann.nagios$nagios$fn__11643.invoke(nagios.clj:46)
	at riemann.config$eval179$stream__9098__auto____180$fn__185.invoke(riemann.config:28)
	at riemann.config$eval179$stream__9098__auto____180.invoke(riemann.config:28)
	at riemann.core$stream_BANG_$fn__9747.invoke(core.clj:20)
	at riemann.core$stream_BANG_.invokeStatic(core.clj:19)
	at riemann.core$stream_BANG_.invoke(core.clj:15)
	at riemann.transport$handle.invokeStatic(transport.clj:173)
	at riemann.transport$handle.invoke(transport.clj:167)
	at riemann.transport.tcp$tcp_handler.invokeStatic(tcp.clj:109)
	at riemann.transport.tcp$tcp_handler.invoke(tcp.clj:102)
	at riemann.transport.tcp$gen_tcp_handler$fn__12967.invoke(tcp.clj:68)
	at riemann.transport.tcp.proxy$io.netty.channel.ChannelInboundHandlerAdapter$ff19274a.channelRead(Unknown Source)
	at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:362)
	at io.netty.channel.AbstractChannelHandlerContext.access$600(AbstractChannelHandlerContext.java:38)
	at io.netty.channel.AbstractChannelHandlerContext$7.run(AbstractChannelHandlerContext.java:353)
	at io.netty.util.concurrent.DefaultEventExecutor.run(DefaultEventExecutor.java:66)
	at io.netty.util.concurrent.SingleThreadEventExecutor$5.run(SingleThreadEventExecutor.java:884)
	at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30)
	at java.lang.Thread.run(Thread.java:745)
INFO [2018-12-09 00:22:39,699] riemann task 2 - riemann.config - expired {:host arrow-pc, :service cpu, :state expired, :time 308859031939/200, :ttl 60}
WARN [2018-12-09 00:22:49,703] riemann task 2 - riemann.config - riemann.nagios$nagios$fn__11643@2376ae3 threw
java.net.SocketTimeoutException: Read timed out
	at java.net.SocketInputStream.socketRead0(Native Method)
	at java.net.SocketInputStream.socketRead(SocketInputStream.java:116)
	at java.net.SocketInputStream.read(SocketInputStream.java:170)
	at java.net.SocketInputStream.read(SocketInputStream.java:141)
	at java.io.DataInputStream.readFully(DataInputStream.java:195)
	at com.googlecode.jsendnsca.core.NagiosPassiveCheckSender.readInitializationVector(NagiosPassiveCheckSender.java:108)

Hi - this isn't really a support forum for Riemann, more a place to log bugs. Can I recommend you try:

https://groups.google.com/forum/#!forum/riemann-users

For support issues.

Also please don't re-open old issues for new problems.

Thanks.

Thanks I'll check there