Skip to content

Commit 639ef28

Browse files
authored
Merge pull request #72 from MicKBfr/MicKBfr-patch-1
Remove domain from esx name
2 parents 57703fa + 3ddb5a3 commit 639ef28

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

vsphere-influxdb.go

+6-1
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ type Configuration struct {
5151
Metrics []Metric
5252
Interval int
5353
Domain string
54+
RemoveHostDomainName bool
5455
InfluxDB InfluxDB
5556
}
5657

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

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

449454
// Extra metrics per host

0 commit comments

Comments
 (0)