055 vm storage
This commit is contained in:
+47
-20
@@ -81,25 +81,30 @@ from (
|
||||
group by "Cluster"), --->
|
||||
|
||||
usage as (
|
||||
select "Cluster" as cluster
|
||||
,count("UUID_VM") as vms
|
||||
,sum("VM_vCPU_count") as vm_cores
|
||||
,sum("VM_vCPU_count"*"VM_is_ON") as vm_cores_on
|
||||
,sum("VM_vCPU_count"*"VDC_CPU_Speed") as vm_ghz
|
||||
,sum("VM_vCPU_count"*"VDC_CPU_Speed"*"VM_is_ON") as vm_ghz_on
|
||||
,sum("VM_CPU_Reserv_GHz") as vm_ghz_reserved
|
||||
,sum("VM_vCPU_count"*"VDC_CPU_Speed"*"VM_CPU_Reserv_perc"/100) as vm_ghz_reserved_c
|
||||
,sum("VM_vCPU_count"*"VDC_CPU_Speed"*(case when "VM_CPU_Reserv_perc" IS null then 20 when "VM_CPU_Reserv_perc"<=20 then 20 else "VM_CPU_Reserv_perc" end)/100) as vm_ghz_promised
|
||||
select c."Cluster" as cluster
|
||||
,count(c."UUID_VM") as vms
|
||||
,sum(c."VM_vCPU_count") as vm_cores
|
||||
,sum(c."VM_vCPU_count"*c."VM_is_ON") as vm_cores_on
|
||||
,sum(c."VM_vCPU_count"*c."VDC_CPU_Speed") as vm_ghz
|
||||
,sum(c."VM_vCPU_count"*c."VDC_CPU_Speed"*c."VM_is_ON") as vm_ghz_on
|
||||
,sum(c."VM_CPU_Reserv_GHz") as vm_ghz_reserved
|
||||
,sum(c."VM_vCPU_count"*c."VDC_CPU_Speed"*c."VM_CPU_Reserv_perc"/100) as vm_ghz_reserved_c
|
||||
,sum(c."VM_vCPU_count"*c."VDC_CPU_Speed"*(case when c."VM_CPU_Reserv_perc" IS null then 20 when c."VM_CPU_Reserv_perc"<=20 then 20 else c."VM_CPU_Reserv_perc" end)/100) as vm_ghz_promised
|
||||
-- promised - зарезервированные ГГц, если включить минимальное согласованное резервирование
|
||||
,sum("VM_RAM_Allocated"*"VM_is_ON") as vm_ram_alloc_on
|
||||
,sum("VM_RAM_Allocated") as vm_ram_alloc
|
||||
,sum("VM_RAM_Used") as vm_ram_used
|
||||
,sum("VM_CPU_Used_AVG") as vm_ghz_usage
|
||||
,sum("VM_is_ON") as vms_on
|
||||
,sum(c."VM_RAM_Allocated"*c."VM_is_ON") as vm_ram_alloc_on
|
||||
,sum(c."VM_RAM_Allocated") as vm_ram_alloc
|
||||
,sum(c."VM_RAM_Used") as vm_ram_used
|
||||
,sum(c."VM_CPU_Used_AVG") as vm_ghz_usage
|
||||
,sum(c."VM_is_ON") as vms_on
|
||||
,sum(s."Disk_Allocated") as disk_allocated
|
||||
,sum(s."Disk_Used") as disk_used
|
||||
|
||||
from vmreports.compute
|
||||
where ts=(select max(ts) from vmreports.compute)
|
||||
group by "Cluster"),
|
||||
|
||||
from vmreports.compute c
|
||||
left outer join vmreports.storage s on(c."UUID_VM"=s."VM_UUID")
|
||||
where c.ts=(select max(ts) from vmreports.compute)
|
||||
AND s.ts=(select max(ts) from vmreports.storage)
|
||||
group by c."Cluster"),
|
||||
|
||||
cluster_stat as (
|
||||
SELECT
|
||||
@@ -198,6 +203,10 @@ select
|
||||
<d:field title="vSAN Usable" cfSqlType="CF_SQL_NUMERIC">s.usable</d:field>
|
||||
<d:field title="vSAN Used" cfSqlType="CF_SQL_NUMERIC">s.used</d:field>
|
||||
<d:field title="vSAN Effective Free" cfSqlType="CF_SQL_NUMERIC">s.effective_free</d:field>
|
||||
|
||||
<d:field title="Disk Allocated" cfSqlType="CF_SQL_NUMERIC">u.disk_allocated</d:field>
|
||||
<d:field title="Disk Used" cfSqlType="CF_SQL_NUMERIC">u.disk_used</d:field>
|
||||
|
||||
</d:field_set>
|
||||
from cluster_stat h
|
||||
left outer join usage u on (h.cluster=u.cluster)
|
||||
@@ -228,6 +237,8 @@ select
|
||||
,sum(vm_ram_used) as vm_ram_used
|
||||
,sum(vms) as vms
|
||||
,sum(cores*ghz)/sum(cores) as ghz <!--- рискованно все же делить --->
|
||||
,sum(disk_allocated) as disk_allocated
|
||||
,sum(disk_used) as disk_used
|
||||
from qRead
|
||||
</cfquery>
|
||||
|
||||
@@ -276,7 +287,7 @@ from qRead
|
||||
<th width="5%">Ядра 50% (текущий резерв)</th>
|
||||
<th width="5%">Ядра 80% (текущий резерв)</th>
|
||||
|
||||
<th width="5%">vSAN GB</th>
|
||||
<th width="5%">vSAN GB</th>
|
||||
</tr>
|
||||
</thead>
|
||||
|
||||
@@ -389,7 +400,13 @@ from qRead
|
||||
<td class="r">#numberFormat(GB_alloc_perc,"0")#</td>
|
||||
<td class="r">#numberFormat(GB_usage_perc,"0")#</td>
|
||||
<td class="r">#vms#</td>
|
||||
<td class="r"><cftry>#numberFormat(vm_cores/vms,".0")# core #numberFormat(vm_ghz_usage/vms,".0")# GHz #numberFormat(vm_ghz_usage/vm_cores/ghz*100,"0")#% #numberFormat(vm_ram_alloc/vms,".0")#(#numberFormat(vm_ram_used/vms,".0")#) GB <cfcatch></cfcatch></cftry></td>
|
||||
<td class="r"><cftry>
|
||||
#numberFormat(vm_cores/vms,".0")# core
|
||||
#numberFormat(vm_ghz_usage/vms,".0")# GHz
|
||||
#numberFormat(vm_ghz_usage/vm_cores/ghz*100,"0")#%
|
||||
#numberFormat(vm_ram_alloc/vms,".0")#(#numberFormat(vm_ram_used/vms,".0")#) GB
|
||||
#numberFormat(disk_allocated/vms,".0")#(#numberFormat(disk_used/vms,".0")#) GB
|
||||
<cfcatch></cfcatch></cftry></td>
|
||||
</tr>
|
||||
</cfoutput>
|
||||
<cfoutput query="qTotal">
|
||||
@@ -428,6 +445,7 @@ from qRead
|
||||
<cfif vms NEQ 0>#numberFormat(vm_ghz_usage/vms,".0")# GHz</cfif>
|
||||
<cfif vm_cores NEQ 0 AND ghz NEQ 0>#numberFormat(vm_ghz_usage/vm_cores/ghz*100,"0")#%</cfif> <!--- *** тут не уверен --->
|
||||
<cfif vms NEQ 0>#numberFormat(vm_ram_alloc/vms,".0")#(#numberFormat(vm_ram_used/vms,".0")#) GB</cfif>
|
||||
<cfif vms NEQ 0>#numberFormat(disk_allocated/vms,".0")#(#numberFormat(disk_used/vms,".0")#) GB</cfif>
|
||||
<cfcatch></cfcatch></cftry>
|
||||
</td>
|
||||
</tr>
|
||||
@@ -509,7 +527,8 @@ from qRead
|
||||
<th width="3%">RAM allloc ВКЛ %</th>
|
||||
<th width="3%"><layout:column_head name="GB_usage_perc"/></th>
|
||||
<th width="3%">Емкость vSAN GB</th>
|
||||
<th width="3%">Свободно vSAN %</th>
|
||||
<th width="3%">Свободно vSAN % alloc</th>
|
||||
<th width="3%">Свободно vSAN % used</th>
|
||||
|
||||
|
||||
</layout:grid_head>
|
||||
@@ -555,6 +574,14 @@ from qRead
|
||||
<cfcatch type="any"></cfcatch>
|
||||
</cftry>
|
||||
</cfif>
|
||||
</td>
|
||||
<td class="c" style="font-size:130%;">
|
||||
<cfif usable GT 0>
|
||||
<cftry>
|
||||
#numberFormat((usable-used)/usable*100,"0")#
|
||||
<cfcatch type="any"></cfcatch>
|
||||
</cftry>
|
||||
</cfif>
|
||||
</td>
|
||||
</tr>
|
||||
</cfoutput>
|
||||
|
||||
Reference in New Issue
Block a user