Skip to content

Commit

Permalink
Merge pull request #72 from MicKBfr/MicKBfr-patch-1
Browse files Browse the repository at this point in the history
Remove domain from esx name
  • Loading branch information
sofixa committed Sep 3, 2018
2 parents 57703fa + 3ddb5a3 commit 639ef28
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion vsphere-influxdb.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ type Configuration struct {
Metrics []Metric
Interval int
Domain string
RemoveHostDomainName bool
InfluxDB InfluxDB
}

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

// Extra tags per host
hostSummary[host.Self] = make(map[string]string)
hostSummary[host.Self]["name"] = host.Summary.Config.Name
hostSummary[host.Self]["name"] = hostSummary[host.Self]["name"] = host.Summary.Config.Name
// Remove Domain Name from Host
if config.RemoveHostDomainName {
hostSummary[host.Self]["name"] = strings.Replace(host.Summary.Config.Name, config.Domain, "", -1)
}
hostSummary[host.Self]["cluster"] = hostToCluster[host.Self]

// Extra metrics per host
Expand Down

0 comments on commit 639ef28

Please sign in to comment.