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:
Łukasz Mierzwa
2017-07-05 18:26:50 -07:00
parent cd63ee512e
commit 6166fdd474
2 changed files with 12 additions and 0 deletions

View File

@@ -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)
}

View File

@@ -264,6 +264,10 @@ func (am *Alertmanager) Pull() error {
return err
}
metricCollectRuns.With(prometheus.Labels{
"alertmanager": am.Name,
}).Inc()
am.lastError = ""
return nil
}