summaryrefslogtreecommitdiff
path: root/files
diff options
context:
space:
mode:
authormh <mh@immerda.ch>2010-06-28 22:36:41 +0200
committermh <mh@immerda.ch>2010-06-28 22:36:41 +0200
commit36f40d47f3c583ec302a192f9940a32bfe66ae3f (patch)
tree4c7807da16a640abd31c64a7b20aecd8f9d74190 /files
parent7541627bdf96534ba9df16efb1b04e899b8ca7dd (diff)
downloadpuppet-ejabberd-36f40d47f3c583ec302a192f9940a32bfe66ae3f.tar.gz
puppet-ejabberd-36f40d47f3c583ec302a192f9940a32bfe66ae3f.tar.bz2
deploy nagios plugin and define command
Diffstat (limited to 'files')
-rw-r--r--files/nagios/check_jabber_login30
1 files changed, 30 insertions, 0 deletions
diff --git a/files/nagios/check_jabber_login b/files/nagios/check_jabber_login
new file mode 100644
index 0000000..dac0e1f
--- /dev/null
+++ b/files/nagios/check_jabber_login
@@ -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"