diff --git a/postfix_exporter.go b/postfix_exporter.go index b853209..82376bb 100644 --- a/postfix_exporter.go +++ b/postfix_exporter.go @@ -238,11 +238,11 @@ func CollectBinaryShowqFromReader(file io.Reader, ch chan<- prometheus.Metric) e sizeHistogram.WithLabelValues(queue).Observe(size) } else if key == "time" { // Message time as a UNIX timestamp. - time, err := strconv.ParseFloat(value, 64) + utime, err := strconv.ParseFloat(value, 64) if err != nil { return err } - ageHistogram.WithLabelValues(queue).Observe(now - time) + ageHistogram.WithLabelValues(queue).Observe(now - utime) } } @@ -663,12 +663,12 @@ func (e *PostfixExporter) Collect(ch chan<- prometheus.Metric) { func main() { var ( - app = kingpin.New("postfix_exporter", "Prometheus metrics exporter for postfix") - listenAddress = app.Flag("web.listen-address", "Address to listen on for web interface and telemetry.").Default(":9154").String() - metricsPath = app.Flag("web.telemetry-path", "Path under which to expose metrics.").Default("/metrics").String() - postfixShowqPath = app.Flag("postfix.showq_path", "Path at which Postfix places its showq socket.").Default("/var/spool/postfix/public/showq").String() - postfixLogfilePath = app.Flag("postfix.logfile_path", "Path where Postfix writes log entries. This file will be truncated by this exporter.").Default("/var/log/postfix_exporter_input.log").String() - systemdEnable bool + app = kingpin.New("postfix_exporter", "Prometheus metrics exporter for postfix") + listenAddress = app.Flag("web.listen-address", "Address to listen on for web interface and telemetry.").Default(":9154").String() + metricsPath = app.Flag("web.telemetry-path", "Path under which to expose metrics.").Default("/metrics").String() + postfixShowqPath = app.Flag("postfix.showq_path", "Path at which Postfix places its showq socket.").Default("/var/spool/postfix/public/showq").String() + postfixLogfilePath = app.Flag("postfix.logfile_path", "Path where Postfix writes log entries. This file will be truncated by this exporter.").Default("/var/log/postfix_exporter_input.log").String() + systemdEnable bool systemdUnit, systemdSlice, systemdJournalPath string ) systemdFlags(&systemdEnable, &systemdUnit, &systemdSlice, &systemdJournalPath, app)