mirror of
https://github.com/prymitive/karma
synced 2026-05-05 03:16:51 +00:00
Expose number of time unsee collected alerts from Alertmanager API
This way one can alert if unsee stops collecting alerts.
This commit is contained in:
@@ -24,10 +24,18 @@ var (
|
||||
},
|
||||
[]string{"alertmanager", "endpoint"},
|
||||
)
|
||||
metricCollectRuns = prometheus.NewGaugeVec(
|
||||
prometheus.GaugeOpts{
|
||||
Name: "unsee_collect_cycles_total",
|
||||
Help: "Total number of alert collection cycles run",
|
||||
},
|
||||
[]string{"alertmanager"},
|
||||
)
|
||||
)
|
||||
|
||||
func init() {
|
||||
prometheus.MustRegister(metricAlerts)
|
||||
prometheus.MustRegister(metricAlertGroups)
|
||||
prometheus.MustRegister(metricAlertmanagerErrors)
|
||||
prometheus.MustRegister(metricCollectRuns)
|
||||
}
|
||||
|
||||
@@ -264,6 +264,10 @@ func (am *Alertmanager) Pull() error {
|
||||
return err
|
||||
}
|
||||
|
||||
metricCollectRuns.With(prometheus.Labels{
|
||||
"alertmanager": am.Name,
|
||||
}).Inc()
|
||||
|
||||
am.lastError = ""
|
||||
return nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user