ops: glance borg-widget fix - alter via promql berechnen statt now.Unix im template
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
@@ -459,20 +459,19 @@
|
||||
title: Borg Backup
|
||||
title-url: https://borg.kaleschke.info
|
||||
cache: 15m
|
||||
url: http://monitoring-prometheus:9090/api/v1/query?query=homelab_borg_last_completed_timestamp_seconds
|
||||
url: http://monitoring-prometheus:9090/api/v1/query?query=(time()-homelab_borg_last_completed_timestamp_seconds)/3600
|
||||
subrequests:
|
||||
success:
|
||||
url: http://monitoring-prometheus:9090/api/v1/query?query=homelab_borg_last_success
|
||||
template: |
|
||||
{{ $ts := .JSON.Float "data.result.0.value.1" }}
|
||||
{{ $ageHours := .JSON.Float "data.result.0.value.1" }}
|
||||
{{ $archive := .JSON.String "data.result.0.metric.archive" }}
|
||||
{{ $succ := .Subrequest "success" }}
|
||||
{{ $ok := $succ.JSON.Float "data.result.0.value.1" }}
|
||||
{{ $status := $succ.JSON.String "data.result.0.metric.status" }}
|
||||
{{ if eq $ts 0.0 }}
|
||||
{{ if eq (len (.JSON.Array "data.result")) 0 }}
|
||||
<div class="text-center color-subdue">Keine Backup-Metrik gefunden</div>
|
||||
{{ else }}
|
||||
{{ $ageHours := div (sub (toFloat now.Unix) $ts) 3600.0 }}
|
||||
<div class="text-center">
|
||||
<div class="size-h2 {{ if gt $ageHours 30.0 }}color-negative{{ else }}color-positive{{ end }}">vor {{ printf "%.0f" $ageHours }} h</div>
|
||||
<div class="size-h6 color-subdue" style="margin-top: 4px;">letztes abgeschlossenes Backup</div>
|
||||
|
||||
Reference in New Issue
Block a user