forked from feiyu563/PrometheusAlert
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmetrics.go
33 lines (30 loc) · 968 Bytes
/
metrics.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
package models
import "github.com/prometheus/client_golang/prometheus"
var (
AlertsFromCounter = prometheus.NewCounterVec(prometheus.CounterOpts{
Name: "alers_from_count",
Help: "count alers from any where",
},
[]string{"alert_from"},
)
//model.AlertsFromCounter.WithLabelValues("from","to","message","level","host","index").Add(1)
AlertToCounter = prometheus.NewCounterVec(prometheus.CounterOpts{
Name: "alers_to_count",
Help: "count alers to any where",
},
[]string{"send_to"},
)
//model.AlertToCounter.WithLabelValues("to","message").Add(1)
AlertFailedCounter = prometheus.NewCounterVec(prometheus.CounterOpts{
Name: "alers_send_failed_count",
Help: "count alers send failed",
},
[]string{"send_to"},
)
//model.AlertFailedCounter.WithLabelValues("to","message","phone").Add(1)
)
func MetricsInit() {
prometheus.MustRegister(AlertsFromCounter)
prometheus.MustRegister(AlertToCounter)
prometheus.MustRegister(AlertFailedCounter)
}