Class: Unsub::Service::Icinga

Inherits:
Base
  • Object
show all
Defined in:
lib/unsub/service/icinga.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Base

#extend_host, #log

Constructor Details

#initialize(cmd_url, log) ⇒ Icinga

Returns a new instance of Icinga.



6
7
8
9
10
# File 'lib/unsub/service/icinga.rb', line 6

def initialize cmd_url, log
  @uri  = URI.parse cmd_url
  @http = Net::HTTP.new uri.host, uri.port
  @log  = log
end

Instance Attribute Details

#httpObject (readonly)

Returns the value of attribute http.



4
5
6
# File 'lib/unsub/service/icinga.rb', line 4

def http
  @http
end

#uriObject (readonly)

Returns the value of attribute uri.



4
5
6
# File 'lib/unsub/service/icinga.rb', line 4

def uri
  @uri
end

Instance Method Details

#disable_notifications(host) ⇒ Object



13
14
15
16
17
# File 'lib/unsub/service/icinga.rb', line 13

def disable_notifications host
  success = cgi_command 29, host # CMD_DISABLE_HOST_SVC_NOTIFICATIONS
  log.info service: 'icinga', event: 'disable_notifications', host: host, success: success
  success
end

#enable_notifications(host) ⇒ Object



20
21
22
23
24
# File 'lib/unsub/service/icinga.rb', line 20

def enable_notifications host
  success = cgi_command 28, host # CMD_ENABLE_HOST_SVC_NOTIFICATIONS
  log.info service: 'icinga', event: 'enable_notifications', host: host, success: success
  success
end