summaryrefslogtreecommitdiff
path: root/files/plugins/check_jabber_login
blob: dac0e1fe5cf71fd4c8f3f74d58b1b21832ff2591 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
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"