F #2968: Monitor cluster health (#3089)

* F #2968: Monitor cluster health

Signed-off-by: Sergio Vega <svega@opennebula.systems>

* F #2968: Set cluster to error if vcenter health is red

Signed-off-by: Sergio Vega <svega@opennebula.systems>
(cherry picked from commit c1ce6bb5f9)
This commit is contained in:
sergiojvg authored and Tino Vazquez committed 2019-03-22 10:29:16 +01:00
1 parent 04e9f07a7a
commit 2bcd7181e3
2 files changed
+9 -3

No files matched your search

+4 -1
View File
@@ -49,7 +49,10 @@ begin
cluster = VCenterDriver::ClusterComputeResource.new_from_ref(ccr_ref, vi_client)
# Print monitoring info
puts cluster.monitor
cluster_info = cluster.monitor
puts cluster_info
raise "vCenter cluster health is on red, check issues on vCenter" if cluster_info.include?("STATUS=red")
puts cluster.monitor_host_systems
# Print VM monitor info
@@ -101,13 +101,15 @@ class ClusterComputeResource
total_memory,
effective_mem,
num_hosts,
num_eff_hosts = @item.collect("summary.totalCpu",
num_eff_hosts,
overall_status = @item.collect("summary.totalCpu",
"summary.numCpuCores",
"summary.effectiveCpu",
"summary.totalMemory",
"summary.effectiveMemory",
"summary.numHosts",
"summary.numEffectiveHosts"
"summary.numEffectiveHosts",
"summary.overallStatus"
)
mhz_core = total_cpu.to_f / num_cpu_cores.to_f
@@ -129,6 +131,7 @@ class ClusterComputeResource
str_info << "HYPERVISOR=vcenter\n"
str_info << "TOTALHOST=" << num_hosts.to_s << "\n"
str_info << "AVAILHOST=" << num_eff_hosts.to_s << "\n"
str_info << "STATUS=" << overall_status << "\n"
# CPU
str_info << "CPUSPEED=" << mhz_core.to_s << "\n"