1
0
mirror of https://github.com/OpenNebula/one.git synced 2025-02-03 13:47:01 +03:00

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>
This commit is contained in:
sergiojvg 2019-03-22 03:27:51 -06:00 committed by Tino Vázquez
parent 5fb69330f3
commit c1ce6bb5f9
2 changed files with 9 additions and 3 deletions

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

View File

@ -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"