rule

package
v0.0.0-...-8d97d4a Latest Latest
Warning

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

Go to latest
Published: May 29, 2024 License: MIT Imports: 22 Imported by: 6

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Conf

type Conf struct {
	Vars conf.Vars
	Name string // Config file name

	Templates     map[string]*conf.Template
	Alerts        map[string]*conf.Alert
	Notifications map[string]*conf.Notification `json:"-"`
	RawText       string
	Macros        map[string]*conf.Macro
	Lookups       map[string]*conf.Lookup
	Squelch       conf.Squelches `json:"-"`
	NoSleep       bool

	Hash string
	// contains filtered or unexported fields
}

func NewConf

func NewConf(name string, backends conf.EnabledBackends, sysVars map[string]string, text string) (c *Conf, err error)

func ParseFile

func ParseFile(fname string, backends conf.EnabledBackends, sysVars map[string]string) (*Conf, error)

func (*Conf) AlertSquelched

func (c *Conf) AlertSquelched(a *conf.Alert) func(opentsdb.TagSet) bool

func (*Conf) BulkEdit

func (c *Conf) BulkEdit(edits conf.BulkEditRequest) error

BulkEdit applies sequental edits to the configuration file. Each individual edit must generate a valid configuration or the edit request will fail.

func (*Conf) Expand

func (c *Conf) Expand(v string, vars map[string]string, ignoreBadExpand bool) string

func (*Conf) GetAlert

func (c *Conf) GetAlert(s string) *conf.Alert

func (*Conf) GetAlerts

func (c *Conf) GetAlerts() map[string]*conf.Alert

func (*Conf) GetFuncs

func (c *Conf) GetFuncs(backends conf.EnabledBackends) map[string]eparse.Func

func (*Conf) GetHash

func (c *Conf) GetHash() string

func (*Conf) GetLookup

func (c *Conf) GetLookup(s string) *conf.Lookup

func (*Conf) GetMacro

func (c *Conf) GetMacro(s string) *conf.Macro

func (*Conf) GetNotification

func (c *Conf) GetNotification(s string) *conf.Notification

func (*Conf) GetNotifications

func (c *Conf) GetNotifications() map[string]*conf.Notification

func (*Conf) GetRawText

func (c *Conf) GetRawText() string

func (*Conf) GetSquelches

func (c *Conf) GetSquelches() conf.Squelches

func (*Conf) GetTemplate

func (c *Conf) GetTemplate(s string) *conf.Template

func (*Conf) NewExpr

func (c *Conf) NewExpr(s string) *expr.Expr

func (*Conf) RawDiff

func (c *Conf) RawDiff(rawConf string) (string, error)

RawDiff returns a contextual diff of the running rule configuration against the provided configuration. This contextual diff library does not guarantee that the generated unified diff can be applied so this is only used for human consumption and verifying that the diff has not change since an edit request was issued

func (*Conf) Reload

func (c *Conf) Reload() error

func (*Conf) SaveConf

func (c *Conf) SaveConf(newConf *Conf) error

func (*Conf) SaveRawText

func (c *Conf) SaveRawText(rawConfig, diff, user, message string, args ...string) error

SaveRawText saves a new configuration file. The contextual diff of the change is provided to verify that no other changes have happened since the save request is issue. User, message, and args are passed to an optionally configured save hook. If the config file is not valid the file will not be saved. If the savehook fails to run or returns an error thaen the orginal config will be restored and the reload will not take place.

func (*Conf) SetReload

func (c *Conf) SetReload(reload func() error)

func (*Conf) SetSaveHook

func (c *Conf) SetSaveHook(sh conf.SaveHook)

func (*Conf) Squelched

func (c *Conf) Squelched(a *conf.Alert, tags opentsdb.TagSet) bool

type Location

type Location []int

Location stores the start byte position and end byte position of an object in the raw configuration

Directories

Path Synopsis
Package parse builds parse trees for configurations as defined by conf.
Package parse builds parse trees for configurations as defined by conf.

Jump to

Keyboard shortcuts

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