From 5c45a79d12cfc0f5eed440f49033d669bace1658 Mon Sep 17 00:00:00 2001 From: Michele Fadda Date: Wed, 12 Dec 2018 13:33:26 +0100 Subject: [PATCH] split host@addr:port --- docker-compose/test.sh | 1 + influxdb.go | 3 ++- main.go | 7 +++++-- 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/docker-compose/test.sh b/docker-compose/test.sh index 87d6691..233ebbf 100755 --- a/docker-compose/test.sh +++ b/docker-compose/test.sh @@ -11,5 +11,6 @@ docker run \ -r 192.168.0.1:6379 \ -m 192.168.0.1:27017 \ -d lastlogin \ + -i test@10.39.253.206:8086 \ -T 80s \ $@ diff --git a/influxdb.go b/influxdb.go index e0cdae4..3b96f37 100644 --- a/influxdb.go +++ b/influxdb.go @@ -15,7 +15,8 @@ var ( func writeStats(start time.Time) { if opts.Debug { - fmt.Printf("writing to influxdb server: %s", opts.Influxdb) + fmt.Printf("writing to influxdb server: %s\n", opts.Influxdb) + fmt.Printf("host: %s -- addr: %s\n", infhost, infdb) } c, err := influxdb.NewHTTPClient(influxdb.HTTPConfig{ diff --git a/main.go b/main.go index fa66fb1..1ff7150 100644 --- a/main.go +++ b/main.go @@ -14,7 +14,7 @@ import ( ) const ( - _Version = "v5.0.0b2" + _Version = "v5.0.0b3" _Producer = 0 _Consumer = 1 _Remover = 2 @@ -55,8 +55,11 @@ func main() { // re, _ := regexp.Compile(`(\w+)@(\d+.\d+.\d+.\d+:\d+)`) if re.MatchString(opts.Influxdb) { match := re.FindStringSubmatch(opts.Influxdb) + if opts.Debug { + fmt.Printf("Influxdb match: %+v\n", match) + } infhost = match[1] - infdb = match[2] + infdb = match[2] + ":" + match[3] } else { opts.Influxdb = "" }