initial hopefully work setup

This commit is contained in:
Iru 2025-11-23 16:39:06 +01:00
commit 6307923dd9
4 changed files with 70 additions and 38 deletions

View file

@ -5,40 +5,6 @@ import (
"encoding/json"
)
type Alert struct {
Status string `json:"status"`
StartsAt string `json:"startsAt"`
EndsAt string `json:"endsAt"`
GeneratorURL string `json:"generatorURL"`
Fingerprint string `json:"fingerprint"`
SilenceURL string `json:"silenceURL"`
DashboardURL string `json:"dashboardURL"`
PanelURL string `json:"panelURL"`
ValueString string `json:"valueString"`
OrgId int `json:"orgId"`
Labels map[string]any `json:"labels"`
Annotations map[string]any `json:"annotations"`
values map[int]any `json:"values"`
}
type Payload struct {
Receiver string `json:"receiver"`
Status string `json:"firing"`
ExternalURL string `json:"externalURL"`
Version string `json:"version"`
GroupKey string `json:"groupKey"`
TruncatedAlerts int `json:"truncatedAlerts"`
OrgID int `json:"orgId"`
Title string `json:"title"`
State string `json"state"`
Message string `json:"message"`
Alerts []Alert `json:"alerts"`
GroupLabels map[string]any `json:"groupLabels"`
CommonLabels map[string]any `json:"groupLabels"`
CommonAnnotations map[string]any `json:"commonAnnotations"`
}
func ParseAlert(payload []byte) (string) {
var data Payload
p1 := json.Unmarshal(payload, &data)