Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for passive Nagios checks #267

Merged
merged 4 commits into from Sep 28, 2013

Conversation

bracki
Copy link

@bracki bracki commented Sep 24, 2013

Hi there,

this is an attempt to add support for passive Nagios checks. Depends on http://github.com/bracki/clj-nsca which in turn depends on https://code.google.com/p/jsendnsca/.
Only supports three encryption methods (or rather one ;p). NONE, XOR, TRIPLE_DES.

(def nag (nagios "localhost" 5667 "top-secret" :TRIPLE_DES))

(streams
  (default {:state "ok" :description "some desc"}
   nag))

Cheers,
Jan

@mfournier
Copy link

Can't comment about the way the implementation is done, but a big +1 for the idea ! It would be really helpful for people wanting to smoothly move from nagios to riemann, or who can't afford to to get rid of nagios for some reason.

@bracki
Copy link
Author

bracki commented Sep 26, 2013

@aphyr I think all issues are addressed now...

@bracki
Copy link
Author

bracki commented Sep 26, 2013

If you want to test this you need:

A riemann.config:

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

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

(tcp-server :tls? false
            :key "test/data/tls/server.pkcs8"
            :cert "test/data/tls/server.crt"
            :ca-cert "test/data/tls/demoCA/cacert.pem")

(instrumentation {:interval 1})

(udp-server)
(ws-server)
(repl-server)

(periodically-expire 1)

(let [index (default :ttl 3 (update-index (index)))]
  (streams
    (expired prn)
    index))

(def nag (nagios {:password "top-secret"}))

(streams 
  (default {:state "ok" :description "Hello from Riemann"}
   nag))

and a Vagrantfile

# -*- mode: ruby -*-
# vi: set ft=ruby :

$PROVISION = <<SCRIPT
echo I am but an empty shell
apt-get -y install nsca
sed -i "s/#password=/password=top-secret/" /etc/nsca.cfg
sed -i "s/decryption_method=1/decryption_method=3/" /etc/nsca.cfg
sed -i "s/debug=0/debug=1/" /etc/nsca.cfg
/etc/init.d/nsca reload
SCRIPT

Vagrant::Config.run do |config|
  config.vm.box = "riemann"
  config.vm.box_url = "https://jimdo-vagrant-boxes.s3.amazonaws.com/jimdo-debian-6.0.7.box"
  config.vm.forward_port 5667, 5667
  config.vm.provision "shell", inline: $PROVISION
end

Now run:

vagrant up
vagrant ssh -c "sudo tail -F /var/log/syslog"
# In another shell
lein run -- riemann.config
# You should see something like this in the Vagrant output
Sep 26 07:31:30 debian-6 nsca[1674]: SERVICE CHECK -> Host Name: 'knoeterich.local', Service Description: 'riemann server ws 127.0.0.1:5556 conns', Return Code: '0', Output: 'Hello from Riemann'

@aphyr
Copy link
Collaborator

aphyr commented Sep 28, 2013

This looks really good, thanks @bracki! It might make sense to leave the crypto opts as :keywords instead of constants, so that users don't need to refer to them as riemann.nagios/DES, etc, but I'm gonna merge either way. Thank you so much! :)

aphyr added a commit that referenced this pull request Sep 28, 2013
Add support for passive Nagios checks
@aphyr aphyr merged commit 54cd186 into riemann:master Sep 28, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants