allow unix:// in --address as prefix
@@ -364,6 +364,7 @@ func createTargets() (map[string]*collector.TargetConfig, error) {
}
for _, addr := range addresses {
tc := new(collector.TargetConfig)
+ if !strings.HasPrefix(addr, "unix://") {
_, _, err := net.SplitHostPort(addr)
if err != nil {
if strings.Contains(err.Error(), "missing port in address") {
@@ -373,6 +374,7 @@ func createTargets() (map[string]*collector.TargetConfig, error) {
return nil, fmt.Errorf("error parsing address '%s': %v", addr, err)
}
}
+ }
tc.Address = addr
setTargetConfigDefaults(tc)
targets[tc.Name] = tc
@@ -396,6 +398,7 @@ func createTargets() (map[string]*collector.TargetConfig, error) {
return nil, fmt.Errorf("no targets found")
}
for addr, t := range targetsMap {
+ if !strings.HasPrefix(addr, "unix://") {
_, _, err := net.SplitHostPort(addr)
if err != nil {
if strings.Contains(err.Error(), "missing port in address") {
@@ -405,6 +408,7 @@ func createTargets() (map[string]*collector.TargetConfig, error) {
return nil, fmt.Errorf("error parsing address '%s': %v", addr, err)
}
}
+ }
tc := new(collector.TargetConfig)
switch t := t.(type) {
case map[string]interface{}:
