VictoriaMetrics/app/vmalert/config/parser.go
kreedom a746cb62b6
vmalert add vm datasource, change alertmanager (#364)
* vmalert add vm datasource, change alertmanager

* make linter be happy

* make linter be happy.2

* PR comments

* PR comments.1
2020-03-13 12:19:31 +02:00

38 lines
739 B
Go

package config
import "time"
// Rule is basic alert entity
type Rule struct {
Name string
Expr string
For time.Duration
Labels map[string]string
Annotations map[string]string
}
// Group grouping array of alert
type Group struct {
Name string
Rules []Rule
}
// Parse parses config from given file
func Parse(filepath string) ([]Group, error) {
return []Group{{
Name: "foobar",
Rules: []Rule{{
Name: "vmrowsalert",
Expr: "vm_rows",
For: 1 * time.Second,
Labels: map[string]string{
"alert_label": "value1",
"alert_label2": "value2",
},
Annotations: map[string]string{
"summary": "{{ $value }}",
"description": "LABELS: {{ $labels }}",
},
}},
}}, nil
}