Skip to content

Instantly share code, notes, and snippets.

@barinek
Created January 7, 2010 02:18
Show Gist options
  • Save barinek/270910 to your computer and use it in GitHub Desktop.
Save barinek/270910 to your computer and use it in GitHub Desktop.
nagios xmpp check
#! /usr/bin/env ruby
require 'rubygems'
require 'main'
require 'xmpp4r'
require File.dirname(__FILE__) + "/nagios_helpers"
class NoErrorsFoundInLogs < Exception;
end
main do
option "verbose", "v" do
attr
description "Print more information about what is being done"
end
option "hostname=hostname" do
attr
required
description "The xmpp server hostname"
end
option "jid=jid" do
attr
required
description "The jid"
end
option "password=password" do
attr
required
description "The password for the jid"
end
def run
logger.level = Logger::DEBUG if verbose?
begin
client_jid = Jabber::JID.new(jid)
client = Jabber::Client.new(client_jid)
client.connect(hostname)
client.auth(password)
client.close
puts "Ejabberd is up on #{hostname}"
exit_success!
rescue
puts "Ejabberd DOWN on #{hostname}"
raise SystemExit.new(2)
end
end
end
@cwebberOps
Copy link

Where do you get what is on line 7?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment