From d8e0b9c937dc974fef7484db3f85fabfe9272d7d Mon Sep 17 00:00:00 2001 From: Rasmus Dahlberg Date: Sat, 4 Jan 2025 14:22:20 +0100 Subject: prometheus: Add basic metrics for alerting - Detect if we're falling behind while downloading - Detect if there are any found certificates alerting --- pkg/storage/index/index.go | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'pkg/storage/index/index.go') diff --git a/pkg/storage/index/index.go b/pkg/storage/index/index.go index 0056565..bf94711 100644 --- a/pkg/storage/index/index.go +++ b/pkg/storage/index/index.go @@ -101,6 +101,13 @@ func (ix *Index) TriggerAlerts() ([]CertificateInfo, error) { return alerts, ioutil.CommitJSON(ix.cfg.IndexFile, ix.mem) } +func (ix *Index) Alerting() (ret []CertificateInfo) { + for _, ci := range ix.mem.Alerting { + ret = append(ret, ci[0]) // one is enough for the same crt ID + } + return +} + func (index *Index) Validate() error { return nil // FIXME: check that the index is populated with valid values } -- cgit v1.2.3