diff --git a/Application.cfc b/Application.cfc index a01c0c8..1a5193e 100644 --- a/Application.cfc +++ b/Application.cfc @@ -76,7 +76,7 @@ - + diff --git a/cloud_capacity.cfm b/cloud_capacity.cfm index 264582a..892be5c 100644 --- a/cloud_capacity.cfm +++ b/cloud_capacity.cfm @@ -5,6 +5,56 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -94,35 +144,34 @@ select h.cluster_v2 n.commercial_name h.models - h.hosts_total - h.hosts_ha - h.hosts_in_maintenance - h.hosts_in_service - h.cores - h.cores_in_service - h.ghz_in_service - h.host_ghz_usage - u.vm_ghz_usage - h.ghz - h.ram_in_service - h.cpu_usage_perc + coalesce(h.hosts_total,0) as hosts_total + coalesce(h.hosts_ha,0) as hosts_ha + coalesce(h.hosts_in_maintenance,0) as hosts_in_maintenance + coalesce(h.hosts_in_service,0) as hosts_in_service + coalesce(h.cores,0) as cores + coalesce(h.cores_in_service,0) as cores_in_service + coalesce(h.ghz_in_service,0) as ghz_in_service + coalesce(h.host_ghz_usage,0) as host_ghz_usage + coalesce(u.vm_ghz_usage,0) as vm_ghz_usage + coalesce(h.ghz,0) as ghz + coalesce(h.ram_in_service,0) as ram_in_service + coalesce(h.cpu_usage_perc,0) as cpu_usage_perc - h.cores as Cores_Capacity + coalesce(h.cores,0) as Cores_Capacity - h.ghz_provisioned - CASE WHEN hosts_in_maintenance > 0 THEN 0 ELSE h.ghz_subtract_ha END as GHz_Provisioned - h.gb_provisioned - CASE WHEN hosts_in_maintenance > 0 THEN 0 ELSE h.gb_subtract_ha END as GB_Provisioned - u.vm_ghz_reserved - u.vm_ghz_promised - round((u.vm_ghz_promised/h.ghz_provisioned)::numeric,2)*100 as GHz_provision_rate - - u.vm_ram_alloc - u.vm_ram_used - round((u.vm_ram_alloc/h.gb_provisioned)::numeric,2)*100 as GB_alloc_perc - round((u.vm_ram_used/h.gb_provisioned)::numeric,2)*100 as GB_usage_perc - round((u.vm_cores/h.cores)::numeric,1) as oversubscription - u.vm_cores - u.vms - u.vm_ghz_usage/h.ghz_in_service*100 as vm_cpu_usage_perc + coalesce(h.ghz_provisioned - CASE WHEN hosts_in_maintenance > 0 THEN 0 ELSE h.ghz_subtract_ha END,0) as GHz_Provisioned + coalesce(h.gb_provisioned - CASE WHEN hosts_in_maintenance > 0 THEN 0 ELSE h.gb_subtract_ha END,0) as GB_Provisioned + coalesce(u.vm_ghz_reserved,0) as vm_ghz_reserved + coalesce(u.vm_ghz_promised,0) as vm_ghz_promised + coalesce(round((u.vm_ghz_promised/h.ghz_provisioned)::numeric,2)*100,0) as GHz_provision_rate + coalesce(u.vm_ram_alloc,0) as vm_ram_alloc + coalesce(u.vm_ram_used,0) as vm_ram_used + coalesce(round((u.vm_ram_alloc/h.gb_provisioned)::numeric,2)*100,0) as GB_alloc_perc + coalesce(round((u.vm_ram_used/h.gb_provisioned)::numeric,2)*100,0) as GB_usage_perc + coalesce(round((u.vm_cores/h.cores)::numeric,1),0) as oversubscription + coalesce(u.vm_cores,0) as vm_cores + coalesce(u.vms,0) as vms + coalesce(u.vm_ghz_usage/h.ghz_in_service*100,0) as vm_cpu_usage_perc from cluster_stat h left outer join usage u on (h.cluster=u.cluster) @@ -213,19 +262,19 @@ from qRead #hosts_total# - #numberFormat(gb_provisioned-vm_ram_alloc,"0")# - #numberFormat(gb_provisioned-vm_ram_used,"0")# + err" style="font-size:130%"> + #safeNumberFormat(gb_provisioned-vm_ram_alloc,"0")# + err" style="font-size:130%">#safeNumberFormat(gb_provisioned - vm_ram_used,"0")# - #numberFormat(ghz_provisioned-vm_ghz_reserved,".0")# - #numberFormat((ghz_provisioned-vm_ghz_reserved)/ghz/0.2,"0")# - #numberFormat((ghz_provisioned-vm_ghz_reserved)/ghz/0.5,"0")# - #numberFormat((ghz_provisioned-vm_ghz_reserved)/ghz/0.8,"0")# - - #numberFormat(ghz_provisioned-vm_ghz_promised,".0")# - #numberFormat((ghz_provisioned-vm_ghz_promised)/ghz/0.2,"0")# - #numberFormat((ghz_provisioned-vm_ghz_promised)/ghz/0.5,"0")# - #numberFormat((ghz_provisioned-vm_ghz_promised)/ghz/0.8,"0")# + err" style="font-size:130%">#safeNumberFormat(ghz_provisioned-vm_ghz_reserved,".0")# + err" style="font-size:130%">#safeNumberFormat((ghz_provisioned-vm_ghz_reserved)/ghz/0.2,"0")# + err" style="font-size:130%">#safeNumberFormat((ghz_provisioned-vm_ghz_reserved)/ghz/0.5,"0")# + err" style="font-size:130%">#safeNumberFormat((ghz_provisioned-vm_ghz_reserved)/ghz/0.8,"0")# + err" style="font-size:130%">#safeNumberFormat(ghz_provisioned-vm_ghz_promised,".0")# + err" style="font-size:130%">#safeNumberFormat((ghz_provisioned-vm_ghz_promised)/ghz/0.2,"0")# + err" style="font-size:130%">#safeNumberFormat((ghz_provisioned-vm_ghz_promised)/ghz/0.5,"0")# + err" style="font-size:130%">#safeNumberFormat((ghz_provisioned-vm_ghz_promised)/ghz/0.8,"0")# #vms# diff --git a/inc/functions.cfm b/inc/functions.cfm index 6959b87..ffe9f4f 100644 --- a/inc/functions.cfm +++ b/inc/functions.cfm @@ -29,7 +29,7 @@ function numFmt(num, decimalPlaces = 0){ request.numFmt = numFmt; function nFmt(num, decimalPlaces = 2){ - if (num EQ 0) return ""; + if (num EQ 0 OR NOT isNumeric(num)) return ""; return numFmt(num, decimalPlaces); } request.nFmt = nFmt;