51 lines
1.8 KiB
Go
51 lines
1.8 KiB
Go
package model
|
|
|
|
import "time"
|
|
|
|
// AlertRule 是告警规则
|
|
type AlertRule struct {
|
|
ID string `json:"id"`
|
|
Name string `json:"name"`
|
|
MetricSource string `json:"metric_source"`
|
|
MetricName string `json:"metric_name"`
|
|
ThresholdType string `json:"threshold_type"`
|
|
ThresholdValue string `json:"threshold_value"`
|
|
DurationMin int `json:"duration_min"`
|
|
Level string `json:"level"`
|
|
ChannelIDs []string `json:"channel_ids"`
|
|
HealingAction *string `json:"healing_action,omitempty"`
|
|
HealingConfig map[string]any `json:"healing_config,omitempty"`
|
|
IsSandboxed bool `json:"is_sandboxed"`
|
|
Enabled bool `json:"enabled"`
|
|
Version int `json:"version"`
|
|
CreatedBy string `json:"created_by"`
|
|
CreatedAt time.Time `json:"created_at"`
|
|
UpdatedAt time.Time `json:"updated_at"`
|
|
}
|
|
|
|
// AlertEvent 是告警事件
|
|
type AlertEvent struct {
|
|
ID string `json:"id"`
|
|
RuleID string `json:"rule_id"`
|
|
Level string `json:"level"`
|
|
ResourceType string `json:"resource_type"`
|
|
ResourceID string `json:"resource_id"`
|
|
CurrentValue string `json:"current_value"`
|
|
ThresholdValue string `json:"threshold_value"`
|
|
Status string `json:"status"`
|
|
IsAggregated bool `json:"is_aggregated"`
|
|
AggregatedCount int `json:"aggregated_count"`
|
|
ParentAlertID *string `json:"parent_alert_id,omitempty"`
|
|
StartedAt time.Time `json:"started_at"`
|
|
ResolvedAt *time.Time `json:"resolved_at,omitempty"`
|
|
}
|
|
|
|
// AlertCount 是告警统计
|
|
type AlertCount struct {
|
|
Open int `json:"open"`
|
|
P0 int `json:"p0"`
|
|
P1 int `json:"p1"`
|
|
P2 int `json:"p2"`
|
|
P3 int `json:"p3"`
|
|
}
|