Class: NagiosConfig

Inherits:
CloudstackNagios::Base show all
Defined in:
lib/cloudstack-nagios/commands/nagios_config.rb

Constant Summary

Constants included from CloudstackNagios::Helper

CloudstackNagios::Helper::RETURN_CODES

Instance Attribute Summary

Attributes inherited from CloudstackNagios::Base

#config

Instance Method Summary collapse

Methods inherited from CloudstackNagios::Base

exit_on_failure?

Methods included from CloudstackNagios::Helper

#check_data, #cs_routers, #exit_with_failure, #load_template

Instance Method Details

#api_hostsObject



36
37
38
39
40
41
42
43
44
# File 'lib/cloudstack-nagios/commands/nagios_config.rb', line 36

def api_hosts
  service_template = load_template(options[:template])
  puts service_template.result(
    zones: client.list_zones,
    bin_path: bin_path,
    config_file: options[:config],
    date: date_string
  )
end

#capacity_servicesObject



69
70
71
72
73
74
75
76
77
# File 'lib/cloudstack-nagios/commands/nagios_config.rb', line 69

def capacity_services
  service_template = load_template(options[:template])
  puts service_template.result(
    capacity_types: Capacity::CAPACITY_TYPES,
    bin_path: bin_path,
    config_file: options[:config],
    date: date_string
  )
end

#router_hostsObject



8
9
10
11
12
13
14
# File 'lib/cloudstack-nagios/commands/nagios_config.rb', line 8

def router_hosts
  host_template = load_template(options[:template])
  puts host_template.result(
    routers: cs_routers,
    date: date_string
  )
end

#router_servicesObject



21
22
23
24
25
26
27
28
29
# File 'lib/cloudstack-nagios/commands/nagios_config.rb', line 21

def router_services
  service_template = load_template(options[:template])
  puts service_template.result(
    routers: cs_routers,
    bin_path: bin_path,
    config_file: options[:config],
    date: date_string
  )
end

#storage_pool_servicesObject



51
52
53
54
55
56
57
58
59
60
61
62
# File 'lib/cloudstack-nagios/commands/nagios_config.rb', line 51

def storage_pool_services
  service_template = load_template(options[:template])
  storage_pools = client.list_storage_pools.select do |pool| 
    pool['state'].downcase == 'up'
  end
  puts service_template.result(
    storage_pools: storage_pools,
    bin_path: bin_path,
    config_file: options[:config],
    date: date_string
  )
end