trigger

package
v0.0.1-dev-91bd0ef Latest Latest
Warning

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

Go to latest
Published: Mar 10, 2025 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Triggers         = "triggers"
	DB               = "triggers"
	Collection       = "triggers"
	ResponsePolicyV2 = "/etc/policies/alert_trigger/alert_resp2_0.yml"
)

Variables

View Source
var DefaultOptions = []Options{
	{
		Name:        "Administrative Level Notification",
		Description: `Configure how you are going to be notified for system events and host alerts, including levels 'warning', 'error', and 'critical'.`,
		Attributes: []Attribute{
			{
				Name:    "severity",
				Type:    "string",
				Value:   "W",
				Enabled: true,
			},
			{
				Name:    "severity",
				Type:    "string",
				Value:   "E",
				Enabled: true,
			},
			{
				Name:    "severity",
				Type:    "string",
				Value:   "C",
				Enabled: true,
			},
			{
				Name:    "category",
				Type:    "string",
				Value:   "DEV",
				Enabled: false,
			},
			{
				Name:    "category",
				Type:    "string",
				Value:   "CPU",
				Enabled: false,
			},
			{
				Name:    "category",
				Type:    "string",
				Value:   "DSK",
				Enabled: false,
			},
			{
				Name:    "category",
				Type:    "string",
				Value:   "MEM",
				Enabled: false,
			},
			{
				Name:    "category",
				Type:    "string",
				Value:   "NET",
				Enabled: false,
			},
			{
				Name:    "category",
				Type:    "string",
				Value:   "SRV",
				Enabled: false,
			},
			{
				Name:    "category",
				Type:    "string",
				Value:   "VRT",
				Enabled: false,
			},
		},
		Enabled: false,
	},
	{
		Name:        "Instance Level Notification",
		Description: `Configure how you are going to be notified for instance alerts, including levels 'warning', and 'critical'.`,
		Attributes: []Attribute{
			{
				Name:    "severity",
				Type:    "string",
				Value:   "W",
				Enabled: true,
			},
			{
				Name:    "severity",
				Type:    "string",
				Value:   "E",
				Enabled: false,
			},
			{
				Name:    "severity",
				Type:    "string",
				Value:   "C",
				Enabled: true,
			},
			{
				Name:    "category",
				Type:    "string",
				Value:   "DEV",
				Enabled: false,
			},
			{
				Name:    "category",
				Type:    "string",
				Value:   "CPU",
				Enabled: false,
			},
			{
				Name:    "category",
				Type:    "string",
				Value:   "DSK",
				Enabled: false,
			},
			{
				Name:    "category",
				Type:    "string",
				Value:   "MEM",
				Enabled: false,
			},
			{
				Name:    "category",
				Type:    "string",
				Value:   "NET",
				Enabled: false,
			},
			{
				Name:    "category",
				Type:    "string",
				Value:   "SRV",
				Enabled: false,
			},
			{
				Name:    "category",
				Type:    "string",
				Value:   "VRT",
				Enabled: false,
			},
		},
		Enabled: false,
	},
}

Functions

This section is empty.

Types

type Attribute

type Attribute struct {
	Name    string `json:"name"`
	Type    string `json:"type"`
	Value   any    `json:"value"`
	Enabled bool   `json:"enabled"`
}

type Options

type Options struct {
	Id          string      `json:"-" yaml:"-" bson:"id"`
	Name        string      `json:"name" yaml:"name" bson:"name"`
	Description string      `json:"description" yaml:"description"`
	Match       string      `json:"-" yaml:"match"`
	Attributes  []Attribute `json:"attributes" yaml:"-"`
	Response    `json:"response" yaml:"response"`
	Enabled     bool            `json:"enabled" yaml:"enabled"`
	Status      *status.Details `json:"status" yaml:"-" bson:"status"`
}

func (*Options) GenMatchRule

func (o *Options) GenMatchRule()

func (*Options) GenTaskUpdate

func (o *Options) GenTaskUpdate() Options

func (*Options) HasEmailRecipients

func (o *Options) HasEmailRecipients() bool

func (*Options) HasSlackChannels

func (o *Options) HasSlackChannels() bool

func (*Options) InitResponse

func (o *Options) InitResponse()

func (*Options) InitStatus

func (o *Options) InitStatus(current, desired string)

func (*Options) SetCompleted

func (o *Options) SetCompleted()

func (*Options) SetError

func (o *Options) SetError()

type Policy

type Policy struct {
	Name     string    `json:"name" yaml:"name"`
	Version  string    `json:"version" yaml:"version"`
	Enabled  bool      `json:"enabled" yaml:"enabled"`
	Triggers []Options `json:"triggers" yaml:"triggers"`
}

func (*Policy) AppendTrigger

func (p *Policy) AppendTrigger(trigger Options)

func (*Policy) UpdateOrAppendTrigger

func (p *Policy) UpdateOrAppendTrigger(trigger Options)

type Response

type Response struct {
	Types  []string          `json:"types" yaml:"-"`
	Slacks []slack.Channel   `json:"slacks" yaml:"slacks"`
	Emails []email.Recipient `json:"emails" yaml:"emails"`
}

Jump to

Keyboard shortcuts

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