diff --git a/.gitignore b/.gitignore index 8c0f4ef..27626c8 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,2 @@ postfix_exporter +.idea/ diff --git a/postfix_exporter.go b/postfix_exporter.go index 18df8c7..eb2b679 100644 --- a/postfix_exporter.go +++ b/postfix_exporter.go @@ -111,6 +111,12 @@ func CollectTextualShowqFromReader(file io.Reader, ch chan<- prometheus.Metric) }, []string{"queue"}) + // Initialize all queue buckets to zero. + for _, q := range []string{"active", "hold", "other"} { + sizeHistogram.WithLabelValues(q) + ageHistogram.WithLabelValues(q) + } + now := time.Now() location, _ := time.LoadLocation("Local") for scanner.Scan() { @@ -192,6 +198,12 @@ func CollectBinaryShowqFromReader(file io.Reader, ch chan<- prometheus.Metric) e }, []string{"queue"}) + // Initialize all queue buckets to zero. + for _, q := range []string{"active", "deferred", "hold", "incoming", "maildrop"} { + sizeHistogram.WithLabelValues(q) + ageHistogram.WithLabelValues(q) + } + now := float64(time.Now().UnixNano()) / 1e9 queue := "unknown" for scanner.Scan() {