# Widget SentinelMesh — Métriques système
# À copier dans votre glance.yml
#
# Prérequis :
# - Backend SentinelMesh démarré (port 8080)
# - agent-metric en cours d'exécution sur chaque machine
# - Fichier CSS custom : assets/sentinelmesh.css
- type: custom-api
title: Métriques systèmes
cache: 5s
url: http://sentinelmesh:8080/api/v1/widgets/metrics
template: |
{{ range .JSON.Array "agents" }}
{{- $cpu := .Float "cpu_percent" -}}
{{- $ram := .Float "ram_percent" -}}
{{- $disk := .Float "disk_percent" -}}
{{- $temp := .Float "temperature_c" -}}
{{- $up := eq (.String "status") "online" -}}
-
{{ .String "hostname" }}
{{ if $up }}
CPU
{{ printf "%.0f" $cpu }}%
RAM
{{ printf "%.0f" $ram }}%
Disque
{{ printf "%.0f" $disk }}%
{{ if gt $temp 0.0 }}
Temp
{{ printf "%.0f" $temp }}°C
{{ end }}
{{ else }}
Agent hors ligne
{{ end }}
{{ end }}