040 maajor improvements

This commit is contained in:
2026-04-07 19:46:43 +03:00
parent a35f5a3ba2
commit 721a4da90d
2 changed files with 109 additions and 44 deletions
+1 -1
View File
@@ -76,7 +76,7 @@
<!--- global settings --->
<cfset request.RECORDS_PER_PAGE=500/>
<cfset request.APP_VERSION="0.00.039"/>
<cfset request.APP_VERSION="0.00.040"/>
<cfset request.STAND=getStand()/>
<cflock scope="application" type="readonly" timeout=3>
+108 -43
View File
@@ -31,13 +31,13 @@ usage as (
select "Cluster" as cluster
,count("UUID_VM") as vms
,sum("VM_vCPU_count") as vm_cores
,(sum("VM_vCPU_count"*"VDC_CPU_Speed")) as vm_ghz
,(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
,sum("VM_vCPU_count"*"VDC_CPU_Speed") as vm_ghz
,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
-- promised - зарезервированные ГГц, если включить минимальное согласованное резервирование
,(sum("VM_RAM_Allocated")) as vm_ram_alloc
,(sum("VM_RAM_Used")) as vm_ram_used
,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
from vmreports.compute
where ts=(select max(ts) from vmreports.compute)
@@ -99,7 +99,7 @@ select
<d:field title="GHz in service">h.ghz_in_service</d:field>
<d:field title="Host GHz usage">h.host_ghz_usage</d:field>
<d:field title="VM GHz usage">u.vm_ghz_usage</d:field>
<d:field title="GHz">h.ghz</d:field>
<d:field title="CPU GHz">h.ghz</d:field>
<d:field title="RAM GB in service">h.ram_in_service</d:field>
<d:field title="Host CPU usage %">h.cpu_usage_perc</d:field>
<d:field title="Hosts in use">c.hosts</d:field>
@@ -113,7 +113,7 @@ select
<d:field title="VM RAM GB used">u.vm_ram_used</d:field>
<d:field title="RAM alloc %">round((u.vm_ram_alloc/c.ram)::numeric,2)*100 as GB_alloc_perc</d:field>
<d:field title="RAM usage %">round((u.vm_ram_used/c.ram)::numeric,2)*100 as GB_usage_perc</d:field>
<d:field title="Пере&shy;подписка">round((u.vm_cores/c.cores)::numeric,1) as oversubscription</d:field>
<d:field title="Пере&shy;подписка vCPU">round((u.vm_cores/c.cores)::numeric,1) as oversubscription</d:field>
<d:field title="VM cores">u.vm_cores</d:field>
<d:field title="VM">u.vms</d:field>
<d:field title="VM CPU Usage %">u.vm_ghz_usage/h.ghz_in_service*100 as vm_cpu_usage_perc</d:field>
@@ -130,6 +130,9 @@ order by <m:order_build sortArray=#pageInfo.settings.sort.sortArray# fieldCount=
select
sum(hosts_total) as hosts_total
,sum(hosts_ha) as hosts_ha
,sum(hosts_in_maintenance) as hosts_in_maintenance
,sum(hosts) as hosts
,sum(host_ghz_usage) as host_ghz_usage
,sum(cores_in_service) as cores_in_service
,sum(ghz_in_service) as ghz_in_service
,sum(GHz_Capacity) as GHz_Capacity
@@ -137,11 +140,13 @@ select
,sum(RAM_Capacity) as RAM_Capacity
,sum(cores_in_service) as cores_in_service
,sum(vm_cores) as vm_cores
,sum(vm_ghz_usage) as vm_ghz_usage
,sum(vm_ghz_reserved) as vm_ghz_reserved
,sum(vm_ghz_promised) as vm_ghz_promised
,sum(vm_ram_alloc) as vm_ram_alloc
,sum(vm_ram_used) as vm_ram_used
,sum(vms) as vms
,sum(cores*ghz)/sum(cores) as ghz
from qRead
</cfquery>
@@ -168,8 +173,64 @@ from qRead
<b>VM:</b> #dateFormat(ts_compute,"YYYY-MM-DD")# #timeFormat(ts_compute,"HH:MM")#
<b>Хосты:</b> #dateFormat(ts_host,"YYYY-MM-DD")# #timeFormat(ts_host,"HH:MM")#
</cfoutput>
<!--- <cfdump var=#qRead#/> --->
<!--- Добавить время обновления наборов данных, итоги, коммерческие названия --->
<h3>Свободно</h3>
<table class="worktable">
<thead>
<layout:grid_head titleMap=#titleMap# sortArray=#pageInfo.settings.sort.sortArray#>
<th width="5%"><layout:column_head name="cluster_v1"/></th>
<th width="5%"><layout:column_head name="cluster_v2"/></th>
<th width="7%"><layout:column_head name="commercial_name"/></th>
<th width="3%"><layout:column_head name="ghz"/></th>
<th width="3%"><layout:column_head name="hosts_total"/></th>
<th width="3%">RAM GB</th>
<th width="3%">CPU GHz (текущий резерв)</th>
<th width="3%">Ядра (текущий резерв | 20%)</th>
<th width="3%">Ядра (текущий резерв | 50%)</th>
<th width="3%">Ядра (текущий резерв | 80%)</th>
<th width="3%">CPU GHz (жесткий резерв)</th>
<th width="3%">Ядра (жесткий резерв | 20%)</th>
<th width="3%">Ядра (жесткий резерв | 50%)</th>
<th width="3%">Ядра (жесткий резерв | 80%)</th>
<th width="3%">ВМ размещено</th>
</layout:grid_head>
</thead>
<cfoutput query="qRead">
<tr>
<td>#cluster_v1#</td>
<td>#cluster_v2#</td>
<td>#commercial_name#</td>
<td class="r">#numberFormat(ghz,".0")#</td>
<td class="r">#hosts_total#</td>
<td class="r<cfif RAM_Capacity-vm_ram_alloc LE 0> err</cfif>">#numberFormat(RAM_Capacity-vm_ram_alloc,"0")#</td>
<td class="r<cfif GHz_Capacity-vm_ghz_reserved LE 0> err</cfif>">#numberFormat(GHz_Capacity-vm_ghz_reserved,".0")#</td>
<td class="r<cfif GHz_Capacity-vm_ghz_reserved LE 0> err</cfif>">#numberFormat((GHz_Capacity-vm_ghz_reserved)/ghz/0.2,"0")#</td>
<td class="r<cfif GHz_Capacity-vm_ghz_reserved LE 0> err</cfif>">#numberFormat((GHz_Capacity-vm_ghz_reserved)/ghz/0.5,"0")#</td>
<td class="r<cfif GHz_Capacity-vm_ghz_reserved LE 0> err</cfif>">#numberFormat((GHz_Capacity-vm_ghz_reserved)/ghz/0.8,"0")#</td>
<td class="r<cfif GHz_Capacity-vm_ghz_promised LE 0> err</cfif>">#numberFormat(GHz_Capacity-vm_ghz_promised,".0")#</td>
<td class="r<cfif GHz_Capacity-vm_ghz_promised LE 0> err</cfif>">#numberFormat((GHz_Capacity-vm_ghz_promised)/ghz/0.2,"0")#</td>
<td class="r<cfif GHz_Capacity-vm_ghz_promised LE 0> err</cfif>">#numberFormat((GHz_Capacity-vm_ghz_promised)/ghz/0.5,"0")#</td>
<td class="r<cfif GHz_Capacity-vm_ghz_promised LE 0> err</cfif>">#numberFormat((GHz_Capacity-vm_ghz_promised)/ghz/0.8,"0")#</td>
<td class="r">#vms#</td>
</tr>
</cfoutput>
</table>
<i>Жесткий резерв - если включим минимальное резервирование 20%</i>
<h3>Использование</h3>
<layout:grid_summary
recordCount=#qRead.recordCount#
@@ -182,24 +243,23 @@ from qRead
<thead>
<layout:grid_head titleMap=#titleMap# sortArray=#pageInfo.settings.sort.sortArray#>
<th width="5%"><layout:column_head name="cluster_v1"/></th>
<th width="7%"><layout:column_head name="cluster_v2"/></th>
<th width="12%"><layout:column_head name="commercial_name"/></th>
<th width="20%"><layout:column_head name="models"/></th>
<th width="5%"><layout:column_head name="cluster_v2"/></th>
<th width="7%"><layout:column_head name="commercial_name"/></th>
<th width="15%"><layout:column_head name="models"/></th>
<th width="3%"><layout:column_head name="ghz"/></th>
<th width="3%"><layout:column_head name="hosts_total"/></th>
<th width="3%"><layout:column_head name="hosts_ha"/></th>
<th width="3%"><layout:column_head name="hosts_in_maintenance"/></th>
<th width="3%"><layout:column_head name="hosts_in_service"/></th>
<th width="3%"><layout:column_head name="hosts_in_maintenance"/></th>
<th width="3%"><layout:column_head name="hosts"/></th>
<!--- <th width="3%"><layout:column_head name="hosts_in_service"/></th>
<th width="3%"><layout:column_head name="ram_in_service"/></th>
<th width="3%"><layout:column_head name="cores_in_service"/></th>
<th width="3%"><layout:column_head name="ghz_in_service"/></th>
<th width="3%"><layout:column_head name="ghz_in_service"/></th> --->
<th width="3%"><layout:column_head name="host_ghz_usage"/></th>
<th width="3%"><layout:column_head name="vm_ghz_usage"/></th>
<th width="3%"><layout:column_head name="cpu_usage_perc"/></th>
<th width="3%"><layout:column_head name="vm_cpu_usage_perc"/></th>
<th width="3%"><layout:column_head name="oversubscription"/></th>
<th width="1%"></th>
<th width="3%"><layout:column_head name="hosts"/></th>
<th width="3%"><layout:column_head name="Cores_Capacity"/></th>
<th width="3%"><layout:column_head name="GHz_Capacity"/></th>
<th width="3%"><layout:column_head name="vm_ghz_reserved"/></th>
@@ -212,7 +272,7 @@ from qRead
<th width="3%"><layout:column_head name="GB_alloc_perc"/></th>
<th width="3%"><layout:column_head name="GB_usage_perc"/></th>
<th width="3%">ВМ шт.</th>
<th width="3%">Средн. ВМ core | GB</th>
<th width="10%">Средняя ВМ</th>
</layout:grid_head>
</thead>
@@ -225,18 +285,17 @@ from qRead
<td class="r">#numberFormat(ghz,".0")#</td>
<td class="r">#hosts_total#</td>
<td class="r">#hosts_ha#</td>
<td class="r">#hosts_in_maintenance#</td>
<td class="r">#hosts_in_service#</td>
<td class="r">#numberFormat(ram_in_service,"0")#</td>
<td class="r">#cores_in_service#</td>
<td class="r">#numberFormat(ghz_in_service,".0")#</td>
<td class="r">#numberFormat(host_ghz_usage,".0")#</td> <!--- style="background:lightcoral" --->
<td class="r"><cfif hosts_in_maintenance NEQ 0>#hosts_in_maintenance#</cfif></td> <!--- style="background:lightcoral" --->
<td class="r">#hosts#</td>
<!--- <td class="r">#hosts_in_service#</td>
<td class="r">#numberFormat(ram_in_service,"0")#</td>
<td class="r">#cores_in_service#</td>
<td class="r">#numberFormat(ghz_in_service,".0")#</td> --->
<td class="r">#numberFormat(host_ghz_usage,".0")#</td>
<td class="r">#numberFormat(vm_ghz_usage,".0")#</td>
<td class="r">#numberFormat(cpu_usage_perc,"0")#</td>
<td class="r">#numberFormat(vm_cpu_usage_perc,"0")#</td>
<td class="r">#oversubscription#</td>
<td></td>
<td class="r">#hosts#</td>
<td class="c" style="font-size:130%;">#numberFormat(cpu_usage_perc,"0")#</td>
<td class="c" style="font-size:130%;">#numberFormat(vm_cpu_usage_perc,"0")#</td>
<td class="r">#oversubscription#</td>
<td class="r">#Cores_Capacity#</td>
<td class="r">#numberFormat(GHz_Capacity,".0")#</td>
<td class="r">#numberFormat(vm_ghz_reserved,".0")#</td>
@@ -249,27 +308,26 @@ 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")# #numberFormat(vm_ram_alloc/vms,".0")#<cfcatch></cfcatch></cftry></td>
<td class="r"><cftry>#numberFormat(vm_cores/vms,".0")#&nbsp;core #numberFormat(vm_ghz_usage/vms,".0")#&nbsp;GHz #numberFormat(vm_ghz_usage/vm_cores/ghz*100,"0")#% #numberFormat(vm_ram_alloc/vms,".0")#&nbsp;GB <cfcatch></cfcatch></cftry></td>
</tr>
</cfoutput>
<cfoutput query="qTotal">
<tr class="b">
<td colspan="4" class="r b"> Итого</td>
<td colspan="4" class="r b"> Итого</td>
<td class="r">#numberFormat(ghz,".0")#</td>
<td class="r">#hosts_total#</td>
<td class="r">#hosts_ha#</td>
<td class="r"></td>
<td class="r"></td>
<td class="r"></td>
<td class="r">#hosts_ha#</td>
<td class="r">#hosts_in_maintenance#</td>
<td class="r">#hosts#</td>
<!--- <td class="r"></td>
<td class="r">#numberFormat(ram_in_service,"0")#</td>
<td class="r">#cores_in_service#</td>
<td class="r">#numberFormat(ghz_in_service,".0")#</td>
<td class="r"></td>
<td class="r"></td>
<td class="r">#numberFormat(ghz_in_service,".0")#</td> --->
<td class="r">#numberFormat(host_ghz_usage,".0")#</td>
<td class="r">#numberFormat(vm_ghz_usage,".0")#</td>
<td class="r"></td>
<td class="r"><!--- #cpu_usage_perc# ---></td>
<td class="r" style="font-size:130%;">#numberFormat(vm_cores/cores_in_service,".0")#</td>
<td></td>
<td class="r"></td>
<td class="r" style="font-size:130%;">#numberFormat(vm_cores/cores_in_service,".0")#</td>
<td class="r"></td>
<td class="r">#numberFormat(GHz_Capacity,".0")#</td>
<td class="r">#numberFormat(vm_ghz_reserved,".0")#</td>
@@ -282,7 +340,14 @@ from qRead
<td class="r" style="font-size:130%;">#numberFormat(vm_ram_alloc/ram_in_service*100,"0")#</td>
<td class="r" style="font-size:130%;">#numberFormat(vm_ram_used/ram_in_service*100,"0")#</td>
<td class="r">#vms#</td>
<td class="r"><cftry>#numberFormat(vm_cores/vms,".0")# #numberFormat(vm_ram_alloc/vms,".0")#<cfcatch></cfcatch></cftry></td>
<td class="r">
<cftry>
#numberFormat(vm_cores/vms,".0")#&nbsp;core
#numberFormat(vm_ghz_usage/vms,".0")#&nbsp;GHz
#numberFormat(vm_ghz_usage/vm_cores/ghz*100,"0")#% <!--- *** тут не уверен --->
#numberFormat(vm_ram_alloc/vms,".0")#&nbsp;GB
<cfcatch></cfcatch></cftry>
</td>
</tr>
</cfoutput>