Compare commits

..
2 Commits
Author SHA1 Message Date
smishchuk 02e5a63572 052 capacity section 2026-06-30 17:41:10 +03:00
smishchuk 0b33a5a29e 052 capacity section 2026-06-30 17:40:26 +03:00
2 changed files with 53 additions and 36 deletions
+1 -1
View File
@@ -76,7 +76,7 @@
<!--- global settings --->
<cfset request.RECORDS_PER_PAGE=500/>s
<cfset request.APP_VERSION="0.00.052"/>
<cfset request.APP_VERSION="0.00.053"/>
<cfset request.STAND=getStand()/>
<cflock scope="application" type="readonly" timeout=3>
+51 -34
View File
@@ -55,7 +55,7 @@
</cftry>
</cffunction>
<m:prepare_ls entity="crm2cloud" settingsKey="crm2cloud" accessObject="" pageInfoOut="pageInfo" trackOut="tr"/>
<m:prepare_ls entity="cloud_capacity" settingsKey="cloud_capacity" accessObject="" pageInfoOut="pageInfo" trackOut="tr"/>
<cfquery name="qTS">
select
@@ -84,7 +84,9 @@ 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
@@ -94,6 +96,7 @@ select "Cluster" as cluster
,sum("VM_RAM_Used") as vm_ram_used
,sum("VM_CPU_Used_AVG") as vm_ghz_usage
,sum("VM_is_ON") as vms_on
from vmreports.compute
where ts=(select max(ts) from vmreports.compute)
group by "Cluster"),
@@ -119,6 +122,7 @@ SELECT
,avg(CASE WHEN "Maintenance"='notInMaintenance' THEN "CPU_Speed" ELSE 0 END) as ghz
,max("CPUtoVM") as ghz_subtract_ha
,max("RAMtoVM") as gb_subtract_ha
,sum("RAM_Total")/sum("CPU_Cores") as gb_per_core
,CASE WHEN sum("CPU_Cores"*"CPU_Speed") > 0 THEN sum("CPU_Used_AVG")/sum("CPU_Cores"*"CPU_Speed")*100 ELSE NULL END as cpu_usage_perc
FROM vmreports.host h
LEFT OUTER JOIN (
@@ -151,36 +155,38 @@ select
<d:field title="cluster v2">h.cluster_v2</d:field>
<d:field title="Коммерческое название">n.commercial_name</d:field>
<d:field title="Models">h.models</d:field>
<d:field title="Hosts total">coalesce(h.hosts_total,0) as hosts_total</d:field>
<d:field title="Hosts HA">coalesce(h.hosts_ha,0) as hosts_ha</d:field>
<d:field title="Hosts in mainte nance">coalesce(h.hosts_in_maintenance,0) as hosts_in_maintenance</d:field>
<d:field title="Hosts in service">coalesce(h.hosts_in_service,0) as hosts_in_service</d:field>
<d:field title="Cores Total">coalesce(h.cores,0) as cores</d:field>
<d:field title="Cores in service">coalesce(h.cores_in_service,0) as cores_in_service</d:field>
<d:field title="GHz in service">coalesce(h.ghz_in_service,0) as ghz_in_service</d:field>
<d:field title="Host GHz used">coalesce(h.host_ghz_usage,0) as host_ghz_usage</d:field>
<d:field title="Payload GHz used">coalesce(u.vm_ghz_usage,0) as vm_ghz_usage</d:field>
<d:field title="CPU GHz">coalesce(h.ghz,0) as ghz</d:field>
<d:field title="RAM GB in service">coalesce(h.ram_in_service,0) as ram_in_service</d:field>
<d:field title="Host CPU usage %">coalesce(h.cpu_usage_perc,0) as cpu_usage_perc</d:field>
<d:field title="Hosts total" cfSqlType="CF_SQL_INTEGER">coalesce(h.hosts_total,0) as hosts_total</d:field>
<d:field title="Hosts HA" cfSqlType="CF_SQL_INTEGER">coalesce(h.hosts_ha,0) as hosts_ha</d:field>
<d:field title="Hosts in mainte nance" cfSqlType="CF_SQL_INTEGER">coalesce(h.hosts_in_maintenance,0) as hosts_in_maintenance</d:field>
<d:field title="Hosts in service" cfSqlType="CF_SQL_INTEGER">coalesce(h.hosts_in_service,0) as hosts_in_service</d:field>
<d:field title="Cores Total" cfSqlType="CF_SQL_INTEGER">coalesce(h.cores,0) as cores</d:field>
<d:field title="Cores in service" cfSqlType="CF_SQL_INTEGER">coalesce(h.cores_in_service,0) as cores_in_service</d:field>
<d:field title="GHz in service" cfSqlType="CF_SQL_NUMERIC">coalesce(h.ghz_in_service,0) as ghz_in_service</d:field>
<d:field title="Host GHz used" cfSqlType="CF_SQL_NUMERIC">coalesce(h.host_ghz_usage,0) as host_ghz_usage</d:field>
<d:field title="Payload GHz used" cfSqlType="CF_SQL_NUMERIC">coalesce(u.vm_ghz_usage,0) as vm_ghz_usage</d:field>
<d:field title="CPU freq GHz" cfSqlType="CF_SQL_NUMERIC">coalesce(h.ghz,0) as ghz</d:field>
<d:field title="RAM GB in service" cfSqlType="CF_SQL_NUMERIC">coalesce(h.ram_in_service,0) as ram_in_service</d:field>
<d:field title="Host CPU usage %" cfSqlType="CF_SQL_NUMERIC">coalesce(h.cpu_usage_perc,0) as cpu_usage_perc</d:field>
<!--- <d:field title="Hosts in use">h.hosts</d:field> --->
<d:field title="Cores Total">coalesce(h.cores,0) as cores_total</d:field>
<d:field title="Cores Total" cfSqlType="CF_SQL_INTEGER">coalesce(h.cores,0) as cores_total</d:field>
<!--- <d:field title="GHz Capacity">c.ghz as GHz_Capacity</d:field> --->
<d:field title="GHz Provisioned">coalesce(h.ghz_provisioned - CASE WHEN hosts_in_maintenance > 0 THEN 0 ELSE h.ghz_subtract_ha END,0) as GHz_Provisioned</d:field><!--- за вычетом согласованных резервов на хосте и на HA --->
<d:field title="GB Provisioned">coalesce(h.gb_provisioned - CASE WHEN hosts_in_maintenance > 0 THEN 0 ELSE h.gb_subtract_ha END,0) as GB_Provisioned</d:field><!--- за вычетом согласованных резервов на хосте и на HA --->
<d:field title="Payload GHz reserved">coalesce(u.vm_ghz_reserved,0) as vm_ghz_reserved</d:field>
<d:field title="GHz обещанные">coalesce(u.vm_ghz_promised,0) as vm_ghz_promised</d:field>
<d:field title="CPU GHz provision rate %">coalesce(round((u.vm_ghz_promised/h.ghz_provisioned)::numeric,2)*100,0) as GHz_provision_rate</d:field>
<d:field title="Payload RAM GB alloc">coalesce(u.vm_ram_alloc,0) as vm_ram_alloc</d:field>
<d:field title="Payload RAM GB alloc ВКЛ">coalesce(u.vm_ram_alloc_on,0) as vm_ram_alloc_on</d:field>
<d:field title="Payload RAM GB used">coalesce(u.vm_ram_used,0) as vm_ram_used</d:field>
<d:field title="RAM alloc %">coalesce(round((u.vm_ram_alloc/h.gb_provisioned)::numeric,2)*100,0) as GB_alloc_perc</d:field>
<d:field title="RAM usage %">coalesce(round((u.vm_ram_used/h.gb_provisioned)::numeric,2)*100,0) as GB_usage_perc</d:field>
<d:field title="Пере подписка vCPU">coalesce(round((u.vm_cores/h.cores)::numeric,1),0) as oversubscription</d:field>
<d:field title="Payload cores">coalesce(u.vm_cores,0) as vm_cores</d:field>
<d:field title="VMs">coalesce(u.vms,0) as vms</d:field>
<d:field title="VMs ON">coalesce(u.vms_on,0) as vms_on</d:field>
<d:field title="Payload CPU Usage %">coalesce(u.vm_ghz_usage/h.ghz_in_service*100,0) as vm_cpu_usage_perc</d:field>
<d:field title="GHz Provisioned" cfSqlType="CF_SQL_NUMERIC">coalesce(h.ghz_provisioned - CASE WHEN hosts_in_maintenance > 0 THEN 0 ELSE h.ghz_subtract_ha END,0) as GHz_Provisioned</d:field><!--- за вычетом согласованных резервов на хосте и на HA --->
<d:field title="GB Provisioned" cfSqlType="CF_SQL_NUMERIC">coalesce(h.gb_provisioned - CASE WHEN hosts_in_maintenance > 0 THEN 0 ELSE h.gb_subtract_ha END,0) as GB_Provisioned</d:field><!--- за вычетом согласованных резервов на хосте и на HA --->
<d:field title="Payload GHz reserved" cfSqlType="CF_SQL_NUMERIC">coalesce(u.vm_ghz_reserved,0) as vm_ghz_reserved</d:field>
<d:field title="GHz обещанные" cfSqlType="CF_SQL_NUMERIC">coalesce(u.vm_ghz_promised,0) as vm_ghz_promised</d:field>
<d:field title="CPU GHz provision rate %" cfSqlType="CF_SQL_NUMERIC">coalesce(round((u.vm_ghz_promised/h.ghz_provisioned)::numeric,2)*100,0) as GHz_provision_rate</d:field>
<d:field title="Payload RAM GB alloc" cfSqlType="CF_SQL_NUMERIC">coalesce(u.vm_ram_alloc,0) as vm_ram_alloc</d:field>
<d:field title="Payload RAM GB alloc ВКЛ" cfSqlType="CF_SQL_NUMERIC">coalesce(u.vm_ram_alloc_on,0) as vm_ram_alloc_on</d:field>
<d:field title="Payload RAM GB used" cfSqlType="CF_SQL_NUMERIC">coalesce(u.vm_ram_used,0) as vm_ram_used</d:field>
<d:field title="RAM alloc %" cfSqlType="CF_SQL_NUMERIC">coalesce(round((u.vm_ram_alloc/h.gb_provisioned)::numeric,2)*100,0) as GB_alloc_perc</d:field>
<d:field title="RAM usage %" cfSqlType="CF_SQL_NUMERIC">coalesce(round((u.vm_ram_used/h.gb_provisioned)::numeric,2)*100,0) as GB_usage_perc</d:field>
<d:field title="Пере подписка vCPU" cfSqlType="CF_SQL_NUMERIC">coalesce(round((u.vm_cores/h.cores)::numeric,1),0) as oversubscription</d:field>
<d:field title="Payload cores" cfSqlType="CF_SQL_INTEGER">coalesce(u.vm_cores,0) as vm_cores</d:field>
<d:field title="Payload cores ВКЛ" cfSqlType="CF_SQL_INTEGER">coalesce(u.vm_cores_on,0) as vm_cores_on</d:field>
<d:field title="VMs" cfSqlType="CF_SQL_INTEGER">coalesce(u.vms,0) as vms</d:field>
<d:field title="VMs ВКЛ" cfSqlType="CF_SQL_INTEGER">coalesce(u.vms_on,0) as vms_on</d:field>
<d:field title="Payload CPU Usage %" cfSqlType="CF_SQL_NUMERIC">coalesce(u.vm_ghz_usage/h.ghz_in_service*100,0) as vm_cpu_usage_perc</d:field>
<d:field title="GB/pCore" cfSqlType="CF_SQL_NUMERIC">gb_per_core</d:field>
</d:field_set>
from cluster_stat h
left outer join usage u on (h.cluster=u.cluster)
@@ -446,6 +452,12 @@ from qRead
<h3>Техническая утилизация</h3>
<layout:grid_summary
recordCount=#qRead.recordCount#
footerOut="gridFooter"
excelLink="Yes"
jsonLink="Yes"
/>
<table class="worktable">
<thead>
@@ -457,6 +469,7 @@ from qRead
<th width="3%"><layout:column_head name="hosts_total"/></th>
<th width="3%"><layout:column_head name="ghz"/></th>
<th width="3%"><layout:column_head name="gb_per_core"/></th>
<th width="3%"><layout:column_head name="vms"/></th>
<th width="3%"><layout:column_head name="vms_on"/></th>
@@ -469,14 +482,15 @@ from qRead
<th width="3%"><layout:column_head name="vm_ghz_reserved"/></th>
<th width="3%"><layout:column_head name="vm_ghz_usage"/></th>
<th width="3%"><layout:column_head name="vm_cores"/></th>
<th width="3%"><layout:column_head name="vm_cores_on"/></th>
<th width="3%"><layout:column_head name="gb_provisioned"/></th>
<th width="3%"><layout:column_head name="vm_ram_alloc"/></th>
<th width="3%"><layout:column_head name="vm_ram_alloc_on"/></th>
<th width="3%"><layout:column_head name="vm_ram_used"/></th>
<th width="3%"><layout:column_head name="GB_alloc_perc"/></th>
<th width="3%">RAM allloc вкл. ВМ %</th>
<th width="3%">RAM allloc %</th>
<th width="3%">RAM allloc ВКЛ %</th>
<th width="3%"><layout:column_head name="GB_usage_perc"/></th>
@@ -493,6 +507,7 @@ from qRead
<td class="r">#hosts_total#</td>
<td class="r" style="font-size:120%">#numberFormat(ghz,".0")#</td>
<td class="r" style="font-size:120%">#numberFormat(gb_per_core,".0")#</td>
<td class="r" style="font-size:120%">#numberFormat(vms,"0")#</td>
<td class="r" style="font-size:120%">#numberFormat(vms_on,"0")#</td>
@@ -504,14 +519,16 @@ from qRead
<td class="r">#numberFormat(vm_ghz_reserved,".0")#</td>
<td class="r">#numberFormat(vm_ghz_usage,".0")#</td>
<td class="r">#vm_cores#</td>
<td class="r">#vm_cores_on#</td>
<td class="r">#numberFormat(gb_provisioned,"0")#</td>
<td class="r">#numberFormat(vm_ram_alloc,"0")#</td>
<td class="r">#numberFormat(vm_ram_alloc_on,"0")#</td>
<td class="r">#numberFormat(vm_ram_used,"0")#</td>
<td class="c" style="font-size:130%;"><cfif ram_in_service NEQ 0>#numberFormat(vm_ram_alloc/ram_in_service*100,"0")#</cfif></td>
<td class="c" style="font-size:130%;"><cfif ram_in_service NEQ 0>#numberFormat(vm_ram_alloc_on/ram_in_service*100,"0")#</cfif></td>
<td class="c" style="font-size:130%;"><cfif ram_in_service NEQ 0>#numberFormat(vm_ram_used/ram_in_service*100,"0")#</cfif></td>
<!--- <td class="c" style="font-size:130%;"><cfif ram_in_service NEQ 0>#numberFormat(vm_ram_alloc/ram_in_service*100,"0")#</cfif></td> --->
<td class="c" style="font-size:130%;">#numberFormat(GB_alloc_perc,"0")#</td>
<td class="c" style="font-size:130%;"><cfif gb_provisioned NEQ 0>#numberFormat(vm_ram_alloc_on/gb_provisioned*100,"0")#</cfif></td>
<td class="c" style="font-size:130%;"><cfif gb_provisioned NEQ 0>#numberFormat(vm_ram_used/gb_provisioned*100,"0")#</cfif></td>
</tr>
</cfoutput>
</table>