057 orrganization_status

This commit is contained in:
2026-07-02 19:34:41 +03:00
parent 6c952ca443
commit 228023ba49
3 changed files with 131 additions and 51 deletions
+1 -1
View File
@@ -76,7 +76,7 @@
<!--- global settings ---> <!--- global settings --->
<cfset request.RECORDS_PER_PAGE=500/> <cfset request.RECORDS_PER_PAGE=500/>
<cfset request.APP_VERSION="0.00.056"/> <cfset request.APP_VERSION="0.00.057"/>
<cfset request.STAND=getStand()/> <cfset request.STAND=getStand()/>
<cflock scope="application" type="readonly" timeout=3> <cflock scope="application" type="readonly" timeout=3>
+81 -6
View File
@@ -81,7 +81,8 @@ from (
group by "Cluster"), ---> group by "Cluster"), --->
usage as ( usage as (
select c."Cluster" as cluster select
c."Cluster" as cluster
,count(c."UUID_VM") as vms ,count(c."UUID_VM") as vms
,sum(c."VM_vCPU_count") as vm_cores ,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."VM_is_ON") as vm_cores_on
@@ -99,6 +100,9 @@ select c."Cluster" as cluster
,sum(s."Disk_Allocated") as disk_allocated ,sum(s."Disk_Allocated") as disk_allocated
,sum(s."Disk_Used") as disk_used ,sum(s."Disk_Used") as disk_used
,sum(CASE WHEN c."Organization_Status"='prod' THEN c."VM_CPU_Used_AVG" ELSE 0 END ) as ghz_used_prod
,sum(CASE WHEN c."Organization_Status"='prod' THEN c."VM_RAM_Used" ELSE 0 END ) as ram_used_prod
,sum(CASE WHEN c."Organization_Status"='prod' THEN s."Disk_Used" ELSE 0 END ) as disk_used_prod
from vmreports.compute c from vmreports.compute c
left outer join vmreports.storage s on(c."UUID_VM"=s."VM_UUID") left outer join vmreports.storage s on(c."UUID_VM"=s."VM_UUID")
@@ -159,7 +163,6 @@ FROM vmreports.vsan_storage
WHERE ts=(SELECT max(ts) FROM vmreports.vsan_storage) WHERE ts=(SELECT max(ts) FROM vmreports.vsan_storage)
) )
select select
<d:field_set titleMapOut="titleMap" lengthOut="fieldCount"> <d:field_set titleMapOut="titleMap" lengthOut="fieldCount">
<d:field title="cluster v1">h.cluster as cluster_v1</d:field> <d:field title="cluster v1">h.cluster as cluster_v1</d:field>
@@ -207,6 +210,10 @@ select
<d:field title="Disk Allocated" cfSqlType="CF_SQL_NUMERIC">coalesce(u.disk_allocated,0) as disk_allocated</d:field> <d:field title="Disk Allocated" cfSqlType="CF_SQL_NUMERIC">coalesce(u.disk_allocated,0) as disk_allocated</d:field>
<d:field title="Disk Used" cfSqlType="CF_SQL_NUMERIC">coalesce(u.disk_used,0) as disk_used</d:field> <d:field title="Disk Used" cfSqlType="CF_SQL_NUMERIC">coalesce(u.disk_used,0) as disk_used</d:field>
<d:field title="GHz Used Prod" cfSqlType="CF_SQL_NUMERIC">coalesce(u.ghz_used_prod,0) as ghz_used_prod</d:field>
<d:field title="RAM Used PROD" cfSqlType="CF_SQL_NUMERIC">coalesce(u.ram_used_prod,0) as ram_used_prod</d:field>
<d:field title="Disk Used Prod" cfSqlType="CF_SQL_NUMERIC">coalesce(u.disk_used_prod,0) as disk_used_prod</d:field>
</d:field_set> </d:field_set>
from cluster_stat h from cluster_stat h
left outer join usage u on (h.cluster=u.cluster) left outer join usage u on (h.cluster=u.cluster)
@@ -235,12 +242,21 @@ select
,sum(vm_ghz_reserved) as vm_ghz_reserved ,sum(vm_ghz_reserved) as vm_ghz_reserved
,sum(vm_ghz_promised) as vm_ghz_promised ,sum(vm_ghz_promised) as vm_ghz_promised
,sum(vm_ram_alloc) as vm_ram_alloc ,sum(vm_ram_alloc) as vm_ram_alloc
,sum(vm_ram_alloc_on) as vm_ram_alloc_on
,sum(vm_ram_used) as vm_ram_used ,sum(vm_ram_used) as vm_ram_used
,sum(vms) as vms ,sum(vms) as vms
,sum(vms_on) as vms_on ,sum(vms_on) as vms_on
,sum(cores*ghz)/sum(cores) as ghz <!--- рискованно все же делить ---> ,sum(cores*ghz)/sum(cores) as ghz <!--- рискованно все же делить --->
,sum(disk_allocated) as disk_allocated ,sum(disk_allocated) as disk_allocated
,sum(disk_used) as disk_used ,sum(disk_used) as disk_used
,sum(usable) as usable
,sum(ghz_used_prod) as ghz_used_prod
,sum(ram_used_prod) as ram_used_prod
,sum(disk_used_prod) as disk_used_prod
from qRead from qRead
</cfquery> </cfquery>
@@ -482,7 +498,7 @@ from qRead
<!--- <cfdump var=#qTotal#/> ---> <!--- <cfdump var=#qTotal#/> --->
<i>Пока выводим избыточный набор колонок для контроля. Кроме того, еще не выбрали, какие колонки удобнее и релевантнее</i> <i>Пока выводим избыточный набор колонок для контроля. Кроме того, еще не выбрали, какие колонки удобнее и релевантнее</i>
<br/> <br/>
<i>* CPU GHz provision rate % - отношение зарезервированной частоты (с учетом 20% резерва по умолчанию) к наличной частоте процессоров</i> <i>* CPU GHz provision rate % - отношение зарезервированной частоты (с учетом 20% резерва по умолчанию) к наличной частоте процессоров (считая выключенные ВМ - поэтому "мертвые" ВМ искажают статистику, кроме того, что занимают диск)</i>
<br/> <br/>
<i>* Для средней ВМ указана аллоцированная память, в скобках - используемая, далее аллоцированное дисковое пространство, в скобках используемое. Диск считается без разделения по политикам (2do). ГГц на ВМ, процент загрузки ядер (** проверить), используемая память - считается по включенным ВМ. Количество ядер, аллоцированная память и диск - по всем ВМ</i> <i>* Для средней ВМ указана аллоцированная память, в скобках - используемая, далее аллоцированное дисковое пространство, в скобках используемое. Диск считается без разделения по политикам (2do). ГГц на ВМ, процент загрузки ядер (** проверить), используемая память - считается по включенным ВМ. Количество ядер, аллоцированная память и диск - по всем ВМ</i>
<br/> <br/>
@@ -539,6 +555,8 @@ from qRead
<th width="3%"><layout:column_head name="vm_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="3%"><layout:column_head name="oversubscription"/></th>
<th width="3%"><layout:column_head name="cores_total"/></th> <th width="3%"><layout:column_head name="cores_total"/></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_provisioned"/></th> <th width="3%"><layout:column_head name="ghz_provisioned"/></th>
<th width="3%"><layout:column_head name="vm_ghz_reserved"/></th> <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_ghz_usage"/></th>
@@ -557,10 +575,10 @@ from qRead
<th width="3%">Свободно vSAN % alloc</th> <th width="3%">Свободно vSAN % alloc</th>
<th width="3%">Свободно vSAN % used</th> <th width="3%">Свободно vSAN % used</th>
<th width="3%"><layout:column_head name="ghz_used_prod"/></th>
<th width="3%"><layout:column_head name="ram_used_prod"/></th>
<th width="3%"><layout:column_head name="disk_used_prod"/></th>
</layout:grid_head> </layout:grid_head>
</thead> </thead>
<cfoutput query="qRead"> <cfoutput query="qRead">
@@ -579,6 +597,8 @@ from qRead
<td class="c" style="font-size:130%;">#numberFormat(vm_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">#oversubscription#</td>
<td class="r">#cores_total#</td> <td class="r">#cores_total#</td>
<td class="r">#cores_in_service#</td>
<td class="r">#safeNumberFormat(ghz_in_service,".0")#</td>
<td class="r">#numberFormat(ghz_provisioned,".0")#</td> <td class="r">#numberFormat(ghz_provisioned,".0")#</td>
<td class="r">#numberFormat(vm_ghz_reserved,".0")#</td> <td class="r">#numberFormat(vm_ghz_reserved,".0")#</td>
<td class="r">#numberFormat(vm_ghz_usage,".0")#</td> <td class="r">#numberFormat(vm_ghz_usage,".0")#</td>
@@ -610,6 +630,61 @@ from qRead
</cftry> </cftry>
</cfif> </cfif>
</td> </td>
<td class="c">#safeNumberFormat(ghz_used_prod,".0")#</td>
<td class="c">#safeNumberFormat(ram_used_prod,"0")#</td>
<td class="c">#safeNumberFormat(disk_used_prod,"0")#</td>
</tr>
</cfoutput>
<cfoutput query="qTotal">
<tr class="b">
<td colspan="3" class="r b"> Итого</td>
<td class="r">#hosts_total#</td>
<td class="r" style="font-size:120%">#numberFormat(ghz,".0")#</td>
<td class="r" style="font-size:120%"></td>
<td class="r" style="font-size:120%">#numberFormat(vms,"0")#</td>
<td class="r" style="font-size:120%">#numberFormat(vms_on,"0")#</td>
<td class="c" style="font-size:130%;"></td>
<td class="c" style="font-size:130%;"></td>
<td class="r"></td>
<td class="r">#cores_total#</td>
<td class="r">#cores_in_service#</td>
<td class="r">#safeNumberFormat(ghz_in_service,".0")#</td>
<td class="r">#numberFormat(ghz_provisioned,".0")#</td>
<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%;"></td>
<td class="c" style="font-size:130%;"></td>
<td class="c" style="font-size:130%;"></td>
<td class="c" style="font-size:130%;">#safeNumberFormat(usable,"0")#</td>
<td class="c" style="font-size:130%;">
<cfif usable GT 0>
<cftry>
#numberFormat(effective_free/usable*100,"0")#
<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>
<td class="c">#safeNumberFormat(ghz_used_prod,".0")#</td>
<td class="c">#safeNumberFormat(ram_used_prod,"0")#</td>
<td class="c">#safeNumberFormat(disk_used_prod,"0")#</td>
</tr> </tr>
</cfoutput> </cfoutput>
</table> </table>
+10 -5
View File
@@ -111,6 +111,8 @@ AS (
,round(sum(CASE WHEN "VM_is_ON" > 0 THEN c."VM_RAM_Allocated" ELSE 0 END)) AS ram_on ,round(sum(CASE WHEN "VM_is_ON" > 0 THEN c."VM_RAM_Allocated" ELSE 0 END)) AS ram_on
,round(sum(c."VM_vCPU_count")) AS cpu ,round(sum(c."VM_vCPU_count")) AS cpu
,round(sum(CASE WHEN "VM_is_ON" > 0 THEN c."VM_vCPU_count" ELSE 0 END)) AS cpu_on ,round(sum(CASE WHEN "VM_is_ON" > 0 THEN c."VM_vCPU_count" ELSE 0 END)) AS cpu_on
,STRING_AGG(DISTINCT "Organization_Status",',') as organization_status
,COUNT(DISTINCT "Organization_UUID") as org_count
FROM vmreports.compute c FROM vmreports.compute c
WHERE ts = ( WHERE ts = (
SELECT max(ts) SELECT max(ts)
@@ -269,6 +271,7 @@ select
<d:field title="Клиент">r.client as client_sold</d:field> <d:field title="Клиент">r.client as client_sold</d:field>
<d:field>r.company_uid</d:field> <d:field>r.company_uid</d:field>
<d:field title="WZ Cloud">a.wz as wz_alloc</d:field> <d:field title="WZ Cloud">a.wz as wz_alloc</d:field>
<d:field title="Статусы из VCD">a.organization_status</d:field><!--- список статусов через запятую --->
<d:field title="Статусы">ds.status_ids</d:field> <d:field title="Статусы">ds.status_ids</d:field>
<d:field title="Модели оплаты">ds.line_pricing_model_ids</d:field> <d:field title="Модели оплаты">ds.line_pricing_model_ids</d:field>
<d:field title="Коды RAM">r.codes as ram_codes</d:field> <d:field title="Коды RAM">r.codes as ram_codes</d:field>
@@ -357,6 +360,7 @@ S3 операции и трафик: <b>#dateFormat(qS3OpsTrfAge.dt_load,'YYYY-M
<th width="10%"><layout:column_head name="client_sold"/></th> <th width="10%"><layout:column_head name="client_sold"/></th>
<th width="5%"><layout:column_head name="wz_alloc"/></th> <th width="5%"><layout:column_head name="wz_alloc"/></th>
<th width="3%"><layout:column_head name="status_ids"/></th> <th width="3%"><layout:column_head name="status_ids"/></th>
<th width="5%"><layout:column_head name="organization_status"/></th>
<th width="3%"><layout:column_head name="line_pricing_model_ids"/></th> <th width="3%"><layout:column_head name="line_pricing_model_ids"/></th>
<th width="10%"><layout:column_head name="cpu_codes"/></th> <th width="10%"><layout:column_head name="cpu_codes"/></th>
@@ -396,24 +400,25 @@ S3 операции и трафик: <b>#dateFormat(qS3OpsTrfAge.dt_load,'YYYY-M
</td> </td>
<td>#wz_alloc#</td> <td>#wz_alloc#</td>
<td>#status_ids#</td> <td>#status_ids#</td>
<td>#organization_status#</td>
<td>#line_pricing_model_ids#</td> <td>#line_pricing_model_ids#</td>
<td>#cpu_codes#</td> <td>#cpu_codes#</td>
<td class="r"<cfif cpu_sold GT cpu_alloc> style="background:lightgreen;"</cfif>>#cpu_sold#</td> <td class="r"<cfif len(wz_alloc)><cfif cpu_sold GT cpu_alloc> style="background:lightgreen;"</cfif><cfelse> style="background:yellow;"</cfif>>#cpu_sold#</td>
<td class="r"<cfif cpu_sold LT cpu_alloc> style="background:lightcoral;"</cfif>>#cpu_alloc#</td> <td class="r"<cfif cpu_sold LT cpu_alloc> style="background:lightcoral;"</cfif>>#cpu_alloc#</td>
<td class="r"<cfif cpu_sold LT cpu_alloc_on> style="background:lightcoral;"</cfif>>#cpu_alloc_on#</td> <td class="r"<cfif cpu_sold LT cpu_alloc_on> style="background:lightcoral;"</cfif>>#cpu_alloc_on#</td>
<td>#ram_codes#</td> <td>#ram_codes#</td>
<td class="r"<cfif ram_sold GT ram_alloc> style="background:lightgreen;"</cfif>>#ram_sold#</td> <td class="r"<cfif len(wz_alloc)><cfif ram_sold GT ram_alloc> style="background:lightgreen;"</cfif><cfelse> style="background:yellow;"</cfif>>#ram_sold#</td>
<td class="r"<cfif ram_sold LT ram_alloc> style="background:lightcoral;"</cfif>>#ram_alloc#</td> <td class="r"<cfif ram_sold LT ram_alloc> style="background:lightcoral;"</cfif>>#ram_alloc#</td>
<td class="r"<cfif ram_sold LT ram_alloc_on> style="background:lightcoral;"</cfif>>#ram_alloc_on#</td> <td class="r"<cfif ram_sold LT ram_alloc_on> style="background:lightcoral;"</cfif>>#ram_alloc_on#</td>
<td>#disk_codes#</td> <td>#disk_codes#</td>
<td class="r"<cfif disk_sold GT disk_alloc> style="background:lightgreen;"</cfif>>#disk_sold#</td> <td class="r"<cfif len(wz_alloc)><cfif disk_sold GT disk_alloc> style="background:lightgreen;"</cfif><cfelse> style="background:yellow;"</cfif>>#disk_sold#</td>
<td class="r"<cfif disk_sold LT disk_alloc> style="background:lightcoral;"</cfif>>#disk_alloc#</td> <td class="r"<cfif disk_sold LT disk_alloc> style="background:lightcoral;"</cfif>>#disk_alloc#</td>
<td>#gpu_codes#</td> <td>#gpu_codes#</td>
<td class="r"<cfif gpu_sold GT gpu_alloc> style="background:lightgreen;"</cfif>>#gpu_sold#</td> <td class="r"<cfif len(wz_alloc)><cfif gpu_sold GT gpu_alloc> style="background:lightgreen;"</cfif><cfelse> style="background:yellow;"</cfif>>#gpu_sold#</td>
<td class="r"<cfif gpu_sold LT gpu_alloc> style="background:lightcoral;"</cfif>>#gpu_alloc#</td> <td class="r"<cfif gpu_sold LT gpu_alloc> style="background:lightcoral;"</cfif>>#gpu_alloc#</td>
<td>#gpu#</td> <td>#gpu#</td>
</tr> </tr>
@@ -436,7 +441,7 @@ S3 операции и трафик: <b>#dateFormat(qS3OpsTrfAge.dt_load,'YYYY-M
<cfoutput query="qTotal"> <cfoutput query="qTotal">
<tr class="b r"> <tr class="b r">
<td colspan="6">Итого</td> <td colspan="7">Итого</td>
<td class="r"<cfif cpu_sold GT ram_alloc> style="background:lightgreen;"</cfif>>#cpu_sold#</td> <td class="r"<cfif cpu_sold GT ram_alloc> style="background:lightgreen;"</cfif>>#cpu_sold#</td>
<td class="r"<cfif cpu_sold LT cpu_alloc> style="background:lightcoral;"</cfif>>#cpu_alloc#</td> <td class="r"<cfif cpu_sold LT cpu_alloc> style="background:lightcoral;"</cfif>>#cpu_alloc#</td>