ruby-nsca/lib/nsca.rb

38 lines
659 B
Ruby
Raw Normal View History

2013-03-16 16:13:13 +01:00
require 'socket'
require 'enum'
require 'timeout'
require 'benchmark'
require 'securerandom'
2013-03-16 16:13:13 +01:00
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
2013-03-16 16:13:13 +01:00
def send *results
NSCA.destinations.each {|server| server.send *results }
2013-03-16 16:13:13 +01:00
self
end
end
end
require 'nsca/packet'
require 'nsca/server'
require 'nsca/client'
require 'nsca/check'