Module: HostStatusNameConcerneable

Included in:
Nagira::ResourceStatusController, Nagira::ServiceStatusController
Defined in:
app/concerns/host_status_name_concerneable.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#hostnameObject

Returns the value of attribute hostname.



3
4
5
# File 'app/concerns/host_status_name_concerneable.rb', line 3

def hostname
  @hostname
end

#resourceObject

Returns the value of attribute resource.



3
4
5
# File 'app/concerns/host_status_name_concerneable.rb', line 3

def resource
  @resource
end

#service_nameObject

Returns the value of attribute service_name.



3
4
5
# File 'app/concerns/host_status_name_concerneable.rb', line 3

def service_name
  @service_name
end

Instance Method Details

#statusObject



5
6
7
8
9
# File 'app/concerns/host_status_name_concerneable.rb', line 5

def status
  @status ||=
    Nagira::HostStatusController.new(@nagios_status, hostname: hostname, output: :full)
    .status[hostname][resource]
end

#with_service_nameObject



11
12
13
14
15
16
17
# File 'app/concerns/host_status_name_concerneable.rb', line 11

def with_service_name
  if service_name
    { service_name => status[service_name] }
  else
    status
  end
end