@@ -532,6 +532,19 @@ export default defineNuxtComponent({
532532 }
533533 return ` ${Math .round (cores )} `
534534 })
535+ const cpuResourcesStatus = computed (() => {
536+ const cpuDetails = (healthPayload .value ?.details ?.cpu || {}) as Record <string , unknown >
537+ return typeof cpuDetails [' status' ] === ' string' ? cpuDetails [' status' ] : ' unknown'
538+ })
539+ const currentCpuThresholdPercent = computed (() => {
540+ const cpuDetails = (healthPayload .value ?.details ?.cpu || healthPayload .value ?.system ?.cpu || {}) as Record <string , unknown >
541+ const threshold = cpuDetails [' threshold' ]
542+ if (typeof threshold !== ' number' || Number .isNaN (threshold )) {
543+ return ' -'
544+ }
545+ const normalized = threshold <= 1 ? threshold * 100 : threshold
546+ return ` ${Math .round (normalized )}% `
547+ })
535548
536549 const statsCards = computed (() => {
537550 const cards = [
@@ -557,13 +570,13 @@ export default defineNuxtComponent({
557570 },
558571 {
559572 key: ' cpu' ,
560- label: ' CPU 1m/core ' ,
561- value: currentCpuLoadPercent .value ,
573+ label: ' Ressources CPU ' ,
574+ value: ` ${ cpuResourcesStatus . value . toUpperCase ()} • ${ currentCpuLoadPercent .value } ` ,
562575 icon: ' mdi-cpu-64-bit' ,
563- color: ' primary ' ,
564- tooltipTag: ' Charge ' ,
565- tooltipMeaning: ' Charge CPU moyenne sur 1 minute, normalisee par nombre de coeurs .' ,
566- tooltipHow: ' Exemple: 75% signifie une charge moderee; >90% de facon durable merite investigation. ' ,
576+ color: statusColor ( cpuResourcesStatus . value ) ,
577+ tooltipTag: ' Sonde CPU ' ,
578+ tooltipMeaning: ' Statut de la sonde CPU avec la charge moyenne 1 minute par core .' ,
579+ tooltipHow: ` Cores: ${ currentCpuCores . value } - Seuil: ${ currentCpuThresholdPercent . value } ` ,
567580 },
568581 {
569582 key: ' rss' ,
@@ -738,14 +751,20 @@ export default defineNuxtComponent({
738751 }
739752
740753 const normalizeMetricNumericValue = (label : string , value : unknown ): number | null => {
741- if (typeof value !== ' number' || Number .isNaN (value )) {
754+ const numericValue = typeof value === ' number'
755+ ? value
756+ : typeof value === ' string'
757+ ? Number .parseFloat (value )
758+ : NaN
759+
760+ if (! Number .isFinite (numericValue )) {
742761 return null
743762 }
744763 const unit = metricUnit (label )
745- if (unit === ' %' && value <= 1 ) {
746- return Math .round (value * 10000 ) / 100
764+ if (unit === ' %' && numericValue <= 1 ) {
765+ return Math .round (numericValue * 10000 ) / 100
747766 }
748- return value
767+ return numericValue
749768 }
750769
751770 const formatMetricWithUnit = (label : string , value : unknown ): { value: string ; unit: string ; numericValue: number | null } => {
0 commit comments