Module: NSCA::Client

Defined in:
lib/nsca/client.rb,
lib/nsca/client/host.rb,
lib/nsca/client/message.rb,
lib/nsca/client/service.rb,
lib/nsca/client/version.rb,
lib/nsca/client/notifier.rb,
lib/nsca/client/remote_server.rb

Defined Under Namespace

Classes: Host, Message, Notifier, RemoteServer, Service

Constant Summary collapse

VERSION =
'0.1.0'

Class Method Summary collapse

Class Method Details

.critical(service, message = 'CRITICAL') ⇒ Object



35
36
37
38
39
40
41
42
43
# File 'lib/nsca/client.rb', line 35

def critical(service, message = 'CRITICAL')
  status = false
  servers.each do |server|
    message = Message.new(:critical, message, service, server)
    notifier = Notifier.new(message)
    status = true if notifier.send_nsca
  end
  status
end

.ok(service, message = 'OK') ⇒ Object



15
16
17
18
19
20
21
22
23
# File 'lib/nsca/client.rb', line 15

def ok(service, message = 'OK')
  status = false
  servers.each do |server|
    message = Message.new(:ok, message, service, server)
    notifier = Notifier.new(message)
    status = true if notifier.send_nsca
  end
  status
end

.serversObject



11
12
13
# File 'lib/nsca/client.rb', line 11

def servers
  @servers ||= []
end

.warning(service, message = 'WARNING') ⇒ Object



25
26
27
28
29
30
31
32
33
# File 'lib/nsca/client.rb', line 25

def warning(service, message = 'WARNING')
  status = false
  servers.each do |server|
    message = Message.new(:warn, message, service, server)
    notifier = Notifier.new(message)
    status = true if notifier.send_nsca
  end
  status
end