2013-03-16 16:13:13 +01:00
|
|
|
require 'socket'
|
|
|
|
require 'enum'
|
|
|
|
require 'timeout'
|
|
|
|
require 'benchmark'
|
2013-04-08 19:46:42 +02:00
|
|
|
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
|
2013-04-08 19:46:42 +02:00
|
|
|
def destinations() @destinations ||= [] end
|
2013-03-16 16:13:13 +01:00
|
|
|
|
2013-04-08 19:46:42 +02:00
|
|
|
def send *results
|
|
|
|
NSCA.destinations.each {|server| server.send *results }
|
2013-03-16 16:13:13 +01:00
|
|
|
self
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
2013-04-08 19:46:42 +02:00
|
|
|
|
2013-04-08 20:18:21 +02:00
|
|
|
require 'nsca/packet'
|
|
|
|
require 'nsca/server'
|
|
|
|
require 'nsca/client'
|
|
|
|
require 'nsca/check'
|