Documentation
¶
Index ¶
- Constants
- func FsWatcher(path string, callback func(event *fsnotify.Event, e error))
- func RenderAlertMessage(writer http.ResponseWriter, request *http.Request)
- type AlertContent
- type AlertMessage
- type AlertSampleMessage
- type AlertState
- type ElasticAlert
- type ElasticAlertPrometheusMetrics
- type ElasticJob
- type FileLoader
- type FrequencyRule
- type Loader
- type Match
- type OpRedisMetrics
- type QueryMetrics
- type RuleStatusCollector
- type RuleType
- type WebhookNotifyMetrics
Constants ¶
View Source
const (
RuleFileSuffix = ".rule.yaml"
)
View Source
const (
Version = "1.0.0"
)
Variables ¶
This section is empty.
Functions ¶
func FsWatcher ¶
FsWatcher can listen file or dir change, if you get a change event, will call callback function
func RenderAlertMessage ¶
func RenderAlertMessage(writer http.ResponseWriter, request *http.Request)
Types ¶
type AlertContent ¶
type AlertContent struct { Rule *conf.Rule Match *Match StartsAt *time.Time EndsAt *time.Time State AlertState }
func (*AlertContent) GetAlertMessage ¶
func (ac *AlertContent) GetAlertMessage(generatorURL string) string
func (*AlertContent) HasResolved ¶
func (ac *AlertContent) HasResolved() bool
type AlertMessage ¶
type AlertSampleMessage ¶
type ElasticAlert ¶
type ElasticAlert struct {
// contains filtered or unexported fields
}
func NewElasticAlert ¶
func NewElasticAlert(c *conf.AppConfig, opts *conf.FlagOption) *ElasticAlert
func (*ElasticAlert) SetAppConf ¶
func (ea *ElasticAlert) SetAppConf(c *conf.AppConfig)
func (*ElasticAlert) Start ¶
func (ea *ElasticAlert) Start()
func (*ElasticAlert) Stop ¶
func (ea *ElasticAlert) Stop()
type ElasticAlertPrometheusMetrics ¶
type ElasticAlertPrometheusMetrics struct { Query sync.Map // map[string]QueryMetrics OpRedis sync.Map // map[string]OpRedisMetrics WebhookNotify sync.Map // map[string]WebhookNotifyMetrics }
func NewElasticAlertPrometheusMetrics ¶
func NewElasticAlertPrometheusMetrics() *ElasticAlertPrometheusMetrics
type ElasticJob ¶
type FileLoader ¶
type FileLoader struct { RulesFolder string `default:"rules"` RulesFolderRecursion bool `default:"true"` // contains filtered or unexported fields }
func (*FileLoader) InjectConfig ¶
func (fl *FileLoader) InjectConfig(config map[string]any)
func (*FileLoader) ReloadSchedulerJob ¶
func (fl *FileLoader) ReloadSchedulerJob(engine *ElasticAlert)
type FrequencyRule ¶
type FrequencyRule struct { }
func (*FrequencyRule) FilterMatchCondition ¶
func (fr *FrequencyRule) FilterMatchCondition(r *conf.Rule, matches []Match) *Match
func (*FrequencyRule) GetMatches ¶
func (fr *FrequencyRule) GetMatches(r *conf.Rule, resultHits []any) []Match
type Loader ¶
type Loader interface { InjectConfig(config map[string]any) GetRules() map[string]*conf.Rule ReloadSchedulerJob(*ElasticAlert) }
func NewLoaderInstance ¶
type Match ¶
type Match struct { Ids []string StartsAt time.Time EndsAt time.Time HitsNumber int // contains filtered or unexported fields }
func (*Match) Fingerprint ¶
type OpRedisMetrics ¶
type QueryMetrics ¶
type RuleStatusCollector ¶
type RuleStatusCollector struct { Ea *ElasticAlert AppInfoDesc *prometheus.Desc RuleStatusDesc *prometheus.Desc LinkRedisDesc *prometheus.Desc QueryDesc *prometheus.Desc OpRedisDesc *prometheus.Desc WebhookNotifyDesc *prometheus.Desc }
func NewRuleStatusCollector ¶
func NewRuleStatusCollector(ea *ElasticAlert) *RuleStatusCollector
func (*RuleStatusCollector) Collect ¶
func (rc *RuleStatusCollector) Collect(ch chan<- prometheus.Metric)
func (*RuleStatusCollector) Describe ¶
func (rc *RuleStatusCollector) Describe(ch chan<- *prometheus.Desc)
Click to show internal directories.
Click to hide internal directories.