Index | Files | Directories

package rule

import ""


Package Files

loaders.go modify.go rule.go

type Conf Uses

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 Uses

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

func ParseFile Uses

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

func (*Conf) AlertSquelched Uses

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

func (*Conf) BulkEdit Uses

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 Uses

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

func (*Conf) GetAlert Uses

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

func (*Conf) GetAlerts Uses

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

func (*Conf) GetFuncs Uses

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

func (*Conf) GetHash Uses

func (c *Conf) GetHash() string

func (*Conf) GetLookup Uses

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

func (*Conf) GetMacro Uses

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

func (*Conf) GetNotification Uses

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

func (*Conf) GetNotifications Uses

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

func (*Conf) GetRawText Uses

func (c *Conf) GetRawText() string

func (*Conf) GetSquelches Uses

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

func (*Conf) GetTemplate Uses

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

func (*Conf) NewExpr Uses

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

func (*Conf) RawDiff Uses

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 Uses

func (c *Conf) Reload() error

func (*Conf) SaveConf Uses

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

func (*Conf) SaveRawText Uses

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 Uses

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

func (*Conf) SetSaveHook Uses

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

func (*Conf) Squelched Uses

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

type Location Uses

type Location []int

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


parsePackage parse builds parse trees for configurations as defined by conf.

Package rule imports 22 packages (graph) and is imported by 3 packages. Updated 2020-08-14. Refresh now. Tools for package owners.