From 766ce36982e0ba5cf7cf5cfc07bb3e97af614ce6 Mon Sep 17 00:00:00 2001 From: Oliver Date: Sat, 10 Oct 2015 11:58:51 -0400 Subject: [PATCH] add version umber information --- redis_exporter.go | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/redis_exporter.go b/redis_exporter.go index f1d57bdb..a53c39a7 100644 --- a/redis_exporter.go +++ b/redis_exporter.go @@ -21,6 +21,9 @@ var ( namespace = flag.String("namespace", "redis", "Namespace for metrics") listenAddress = flag.String("web.listen-address", ":9121", "Address to listen on for web interface and telemetry.") metricPath = flag.String("web.telemetry-path", "/metrics", "Path under which to expose metrics.") + showVersion = flag.Bool("version", false, "Show version information") + + VERSION = "0.2" ) type RedisHost struct { @@ -307,6 +310,11 @@ func (e *Exporter) collectMetrics(metrics chan<- prometheus.Metric) { func main() { flag.Parse() + if *showVersion { + fmt.Printf("Redis Metrics Exporter v%s\n", VERSION) + return + } + addrs := strings.Split(*redisAddr, ",") if len(addrs) == 0 || len(addrs[0]) == 0 { log.Fatal("Invalid parameter --redis.addr")