types

package
v0.9.0 Latest Latest
Warning

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

Go to latest
Published: Mar 2, 2026 License: AGPL-3.0 Imports: 0 Imported by: 0

Documentation

Index

Constants

View Source
const (
	EventStatusCritical = "Critical"
	EventStatusWarning  = "Warning"
	EventStatusInfo     = "Info"
	EventStatusOk       = "Ok"

	AttrPrefix = "_attr_"
)

Variables

This section is empty.

Functions

func EvaluateGeThreshold

func EvaluateGeThreshold(value, warnGe, criticalGe float64) string

EvaluateGeThreshold returns the event status for a "greater-than-or-equal" threshold pair. A threshold value of 0 means "not configured / disabled".

func EventStatusValid

func EventStatusValid(status string) bool

Types

type Event

type Event struct {
	EventTime   int64             `json:"event_time"`
	EventStatus string            `json:"event_status"`
	AlertKey    string            `json:"alert_key"`
	Labels      map[string]string `json:"labels"`
	TitleRule   string            `json:"title_rule"` // $a::b::$c
	Description string            `json:"description"`

	// for internal use
	FirstFireTime int64 `json:"-"`
	NotifyCount   int64 `json:"-"`
	LastSent      int64 `json:"-"`
}

func BuildEvent

func BuildEvent(labelMaps ...map[string]string) *Event

func (*Event) SetDescription

func (e *Event) SetDescription(desc string) *Event

func (*Event) SetEventStatus

func (e *Event) SetEventStatus(status string) *Event

func (*Event) SetEventTime

func (e *Event) SetEventTime(t int64) *Event

func (*Event) SetTitleRule

func (e *Event) SetTitleRule(rule string) *Event

Jump to

Keyboard shortcuts

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