split host@addr:port

This commit is contained in:
Michele Fadda 2018-12-12 13:33:26 +01:00
parent f1f38601d5
commit 5c45a79d12
3 changed files with 8 additions and 3 deletions

View file

@ -11,5 +11,6 @@ docker run \
-r 192.168.0.1:6379 \ -r 192.168.0.1:6379 \
-m 192.168.0.1:27017 \ -m 192.168.0.1:27017 \
-d lastlogin \ -d lastlogin \
-i test@10.39.253.206:8086 \
-T 80s \ -T 80s \
$@ $@

View file

@ -15,7 +15,8 @@ var (
func writeStats(start time.Time) { func writeStats(start time.Time) {
if opts.Debug { 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{ c, err := influxdb.NewHTTPClient(influxdb.HTTPConfig{

View file

@ -14,7 +14,7 @@ import (
) )
const ( const (
_Version = "v5.0.0b2" _Version = "v5.0.0b3"
_Producer = 0 _Producer = 0
_Consumer = 1 _Consumer = 1
_Remover = 2 _Remover = 2
@ -55,8 +55,11 @@ func main() {
// re, _ := regexp.Compile(`(\w+)@(\d+.\d+.\d+.\d+:\d+)`) // re, _ := regexp.Compile(`(\w+)@(\d+.\d+.\d+.\d+:\d+)`)
if re.MatchString(opts.Influxdb) { if re.MatchString(opts.Influxdb) {
match := re.FindStringSubmatch(opts.Influxdb) match := re.FindStringSubmatch(opts.Influxdb)
if opts.Debug {
fmt.Printf("Influxdb match: %+v\n", match)
}
infhost = match[1] infhost = match[1]
infdb = match[2] infdb = match[2] + ":" + match[3]
} else { } else {
opts.Influxdb = "" opts.Influxdb = ""
} }