]> gitweb.fluxo.info Git - puppet-ejabberd.git/commitdiff
deploy nagios plugin and define command
authormh <mh@immerda.ch>
Mon, 28 Jun 2010 20:36:41 +0000 (22:36 +0200)
committermh <mh@immerda.ch>
Mon, 28 Jun 2010 20:36:41 +0000 (22:36 +0200)
files/nagios/check_jabber_login [new file with mode: 0644]
manifests/nagios.pp

diff --git a/files/nagios/check_jabber_login b/files/nagios/check_jabber_login
new file mode 100644 (file)
index 0000000..dac0e1f
--- /dev/null
@@ -0,0 +1,30 @@
+#!/usr/bin/env ruby
+require 'rubygems'
+require 'xmpp4r'
+
+
+def usage
+  puts "#{$0} jabberid password"
+  exit 3
+end
+
+usage unless ARGV.size == 2
+
+begin
+      my_client = Jabber::Client.new(ARGV[0])
+      my_client.connect
+      my_client.auth(ARGV[1])
+rescue Jabber::ClientAuthenticationFailure => detail
+  puts "CRITICAL: Login Error"
+  exit 2
+rescue Errno::ECONNREFUSED => detail
+  puts "CRITICAL: Connection refused"
+  exit 2
+rescue SocketError => detail
+  puts "CRITICAL: Socket Error"
+  exit 2
+#rescue 
+#  puts "CRITICAL: Unknown Error"
+#  exit 2
+end
+puts "OK: Login for #{ARGV[0]} successfull"
index 05874dd9afe52676fb05d1fd8738714996d8223f..eafcb1f2726746c7f10ec53c9e44f9901b9f7db0 100644 (file)
@@ -10,6 +10,16 @@ class ejabberd::nagios {
         '': { $jabber_nagios_user = 'nagios' }
     } 
 
+    @@nagios::plugin{'check_jabber_login':
+      source => 'ejabberd/nagios/check_jabber_login';
+    }
+
+    @@nagios_command{
+      'check_jabber_login':
+            command_line => '$USER1$/check_jabber_login $ARG1$ $ARG2$',
+            require => Nagios::Plugin['check_jabber_login'];
+    }
+
     case $jabber_nagios_pwd {
         '': { info("no \$jabber_nagios_pwd supplied for ${fqdn}! Can't test jabber login") }
         default: {