ruby-nsca/lib/nsca.rb

38 lines
659 B
Ruby

require 'socket'
require 'enum'
require 'timeout'
require 'benchmark'
require 'securerandom'
module NSCA
class ReturnCode <Enum
start_at 0
enum %w[OK WARNING CRITICAL UNKNOWN]
end
module Helper
class <<self
def class_name_gen label
clname = label.gsub( /\W+/, '_').sub /^[0-9_]+/, ''
return nil if clname.empty?
clname[0] = clname[0].upcase
clname.to_sym
end
end
end
class <<self
def destinations() @destinations ||= [] end
def send *results
NSCA.destinations.each {|server| server.send *results }
self
end
end
end
require 'nsca/packet'
require 'nsca/server'
require 'nsca/client'
require 'nsca/check'