Skip to content

Commit 3eb0f57

Browse files
authored
Update vsphere-influxdb.go
1 parent 39330e4 commit 3eb0f57

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

vsphere-influxdb.go

+6-2
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ type EntityQuery struct {
9999
Metrics []int32
100100
}
101101

102-
var getversion, debug, test bool
102+
var getversion, debug, test, RemoveHostDomainName bool
103103
var stdlog, errlog *log.Logger
104104
var version = "master"
105105

@@ -443,7 +443,11 @@ func (vcenter *VCenter) Query(config Configuration, InfluxDBClient influxclient.
443443

444444
// Extra tags per host
445445
hostSummary[host.Self] = make(map[string]string)
446-
hostSummary[host.Self]["name"] = strings.Replace(host.Summary.Config.Name, config.Domain, "", -1)
446+
hostSummary[host.Self]["name"] = hostSummary[host.Self]["name"] = host.Summary.Config.Name
447+
// Remove Domain Name from Host
448+
if RemoveHostDomainName {
449+
hostSummary[host.Self]["name"] = strings.Replace(host.Summary.Config.Name, config.Domain, "", -1)
450+
}
447451
hostSummary[host.Self]["cluster"] = hostToCluster[host.Self]
448452

449453
// Extra metrics per host

0 commit comments

Comments
 (0)