Class: NagiosConfig
Constant Summary
CloudstackNagios::Helper::RETURN_CODES
Instance Attribute Summary
#config
Instance Method Summary
collapse
exit_on_failure?
#check_data, #cs_routers, #exit_with_failure, #load_template
Instance Method Details
#api_hosts ⇒ Object
53
54
55
56
57
58
59
60
61
|
# File 'lib/cloudstack-nagios/commands/nagios_config.rb', line 53
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
|
#asyncjobs_services ⇒ Object
104
105
106
107
108
109
110
111
|
# File 'lib/cloudstack-nagios/commands/nagios_config.rb', line 104
def asyncjobs_services
service_template = load_template(options[:template])
puts service_template.result(
bin_path: bin_path,
config_file: options[:config],
date: date_string
)
end
|
#capacity_services ⇒ Object
88
89
90
91
92
93
94
95
96
97
|
# File 'lib/cloudstack-nagios/commands/nagios_config.rb', line 88
def capacity_services
service_template = load_template(options[:template])
puts service_template.result(
zones: client.list_zones,
capacity_types: Capacity::CAPACITY_TYPES,
bin_path: bin_path,
config_file: options[:config],
date: date_string
)
end
|
#generate_all ⇒ Object
6
7
8
9
10
11
12
|
# File 'lib/cloudstack-nagios/commands/nagios_config.rb', line 6
def generate_all
commands = %w(router_hosts router_services api_hosts storage_pool_services capacity_services asyncjobs_services)
commands.each do |command|
invoke "nagios_config:#{command}"
puts
end
end
|
#router_hosts ⇒ Object
19
20
21
22
23
24
25
|
# File 'lib/cloudstack-nagios/commands/nagios_config.rb', line 19
def router_hosts
host_template = load_template(options[:template])
puts host_template.result(
routers: cs_routers,
date: date_string
)
end
|
#router_services ⇒ Object
37
38
39
40
41
42
43
44
45
46
|
# File 'lib/cloudstack-nagios/commands/nagios_config.rb', line 37
def router_services
service_template = load_template(options[:template])
puts service_template.result(
routers: cs_routers,
bin_path: bin_path,
if_speed: options[:if_speed],
config_file: options[:config],
date: date_string
)
end
|
#storage_pool_services ⇒ Object
69
70
71
72
73
74
75
76
77
78
79
80
81
|
# File 'lib/cloudstack-nagios/commands/nagios_config.rb', line 69
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,
over_provisioning: options[:over_provisioning],
bin_path: bin_path,
config_file: options[:config],
date: date_string
)
end
|