Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions postgres_exporter.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import (
"net/url"
"os"
"regexp"
"runtime"
"strconv"
"sync"
"time"
Expand All @@ -23,6 +24,7 @@ import (
"github.com/prometheus/common/log"
)

// executable version (set at build time by make)
var Version string = "0.0.1"

var db *sql.DB = nil
Expand All @@ -44,6 +46,7 @@ var (
"dumpmaps", false,
"Do not run, simply dump the maps.",
)
showVersion = flag.Bool("version", false, "print version")
)

// Metric name parts.
Expand Down Expand Up @@ -967,6 +970,14 @@ func (e *Exporter) scrape(ch chan<- prometheus.Metric) {
func main() {
flag.Parse()

if *showVersion {
fmt.Printf(
"postgres_exporter %s (built with %s)\n",
Version, runtime.Version(),
)
return
}

if *onlyDumpMaps {
dumpMaps()
return
Expand Down