summaryrefslogtreecommitdiff
path: root/files/plugins/check_jabber_login
diff options
context:
space:
mode:
authorMicah <micah@leap.se>2016-05-24 10:19:34 -0400
committerMicah <micah@leap.se>2016-05-24 10:19:34 -0400
commita8c803387fe3a53cfee912470d98b1a39d8b1940 (patch)
tree792ce0ea9118fe76a766e9d9c809660e7236c423 /files/plugins/check_jabber_login
Squashed 'puppet/modules/nagios/' content from commit e6fee3c
git-subtree-dir: puppet/modules/nagios git-subtree-split: e6fee3c731f68ccf8b6add8ada2162c7ad2b8407
Diffstat (limited to 'files/plugins/check_jabber_login')
-rw-r--r--files/plugins/check_jabber_login30
1 files changed, 30 insertions, 0 deletions
diff --git a/files/plugins/check_jabber_login b/files/plugins/check_jabber_login
new file mode 100644
index 00000000..dac0e1fe
--- /dev/null
+++ b/files/plugins/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"