Created
          January 7, 2010 02:18 
        
      - 
      
- 
        Save barinek/270910 to your computer and use it in GitHub Desktop. 
    nagios xmpp check
  
        
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | #! /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 | |
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment
  
            
Where do you get what is on line 7?