model

package
v0.0.4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 10, 2023 License: MulanPSL-2.0 Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Alert

type Alert interface {
	InsertAlert(context.Context, *AlertData) error
}

type AlertData

type AlertData struct {
	Receiver          string            `json:"receiver"`
	Status            string            `json:"status"`
	Alerts            []*AlertRule      `json:"alerts"`
	GroupLabels       *GroupLabel       `json:"groupLabels"`
	CommonLabels      *CommonLabel      `json:"commonLabels"`
	CommonAnnotations *CommonAnnotation `json:"commonAnnotations"`
	ExternalURL       string            `json:"externalURL"`
	Version           string            `json:"version"`
	GroupKey          string            `json:"groupKey"`
	TruncatedAlerts   int               `json:"truncatedAlerts"`
}
{
	"receiver": "告警统计",
	"status": "firing",
	"alerts": [{
		"status": "firing",
		"labels": {
			"alertname": "STAGE-环境Kong实例挂掉了",
			"groupname": "map[:/usr/local/kong]",
			"idc": "STAGE",
			"instance": "40.2",
			"ip": "40.2",
			"job": "process",
			"people": "许宗超",
			"resolved_summary": "STAGE-环境Kong实例已恢复运行!",
			"response": "立即响应处理",
			"service": "kong",
			"severity": "高"
		},
		"annotations": {
			"description": "STAGE-环境Kong实例已经挂掉将近一分钟!",
			"summary": "STAGE-环境Kong实例挂掉了!"
		},
		"startsAt": "2023-02-01T06:25:07.057207341Z",
		"endsAt": "0001-01-01T00:00:00Z",
		"generatorURL": "http://optimus20a3:9090/graph?g0.expr=namedprocess_namegroup_num_procs%7Bgroupname%3D%22map%5B%3A%2Fusr%2Flocal%2Fkong%5D%22%2Cidc%3D%22STAGE%22%7D+%3D%3D+0\u0026g0.tab=1",
		"fingerprint": "d37b7bae8f00f452"
	}],
	"groupLabels": {
		"alertname": "STAGE-环境Kong实例挂掉了",
		"ip": "40.2"
	},
	"commonLabels": {
		"alertname": "STAGE-环境Kong实例挂掉了",
		"groupname": "map[:/usr/local/kong]",
		"idc": "STAGE",
		"instance": "40.2",
		"ip": "40.2",
		"job": "process",
		"people": "许宗超",
		"resolved_summary": "STAGE-环境Kong实例已恢复运行!",
		"response": "立即响应处理",
		"service": "kong",
		"severity": "高"
	},
	"commonAnnotations": {
		"description": "STAGE-环境Kong实例已经挂掉将近一分钟!",
		"summary": "STAGE-环境Kong实例挂掉了!"
	},
	"externalURL": "http://optimus20a6:9093",
	"version": "4",
	"groupKey": "{}:{alertname=\"STAGE-环境Kong实例挂掉了\", ip=\"40.2\"}",
	"truncatedAlerts": 0
}

func NewDefaultAlert

func NewDefaultAlert() *AlertData

type AlertRule

type AlertRule struct {
	Status       string      `json:"status"`
	Labels       *Label      `json:"labels"`
	Annotations  *Annotation `json:"annotations"`
	StartsAt     string      `json:"startsAt"`
	EndsAt       string      `json:"endsAt"`
	GeneratorURL string      `json:"generatorURL"`
	Fingerprint  string      `json:"fingerprint"`
}

type Annotation

type Annotation struct {
	Description string `json:"description"`
	Summary     string `json:"summary"`
}

type CommonAnnotation

type CommonAnnotation struct {
	Description string `json:"description"`
	Summary     string `json:"summary"`
}

type CommonLabel

type CommonLabel struct {
	Alertname       string `json:"alertname"`
	Groupname       string `json:"groupname"`
	Idc             string `json:"idc"`
	Instance        string `json:"instance"`
	IP              string `json:"ip"`
	Job             string `json:"job"`
	People          string `json:"people"`
	ResolvedSummary string `json:"resolved_summary"`
	Response        string `json:"response"`
	Service         string `json:"service"`
	Severity        string `json:"severity"`
}

type GroupLabel

type GroupLabel struct {
	Alertname string `json:"alertname"`
	IP        string `json:"ip"`
}

type Label

type Label struct {
	Alertname       string `json:"alertname"`
	Groupname       string `json:"groupname"`
	Idc             string `json:"idc"`
	Instance        string `json:"instance"`
	IP              string `json:"ip"`
	Job             string `json:"job"`
	People          string `json:"people"`
	ResolvedSummary string `json:"resolved_summary"`
	Response        string `json:"response"`
	Service         string `json:"service"`
	Severity        string `json:"severity"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL