aboutsummaryrefslogtreecommitdiff
path: root/pkg/storage/index/index.go
diff options
context:
space:
mode:
authorRasmus Dahlberg <rgdd@glasklarteknik.se>2025-01-04 14:22:20 +0100
committerRasmus Dahlberg <rgdd@glasklarteknik.se>2025-01-04 14:22:20 +0100
commitd8e0b9c937dc974fef7484db3f85fabfe9272d7d (patch)
treebfe3e8295f1e5d0919fcb331a3ba478be0d99031 /pkg/storage/index/index.go
parent80667f1f5707b75cbd4aff47b51bab103c429b24 (diff)
prometheus: Add basic metrics for alerting
- Detect if we're falling behind while downloading - Detect if there are any found certificates alerting
Diffstat (limited to 'pkg/storage/index/index.go')
-rw-r--r--pkg/storage/index/index.go7
1 files changed, 7 insertions, 0 deletions
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
}