@@ -47,12 +47,12 @@ const (
4747
4848// Configuration is used to store config data
4949type Configuration struct {
50- VCenters []* VCenter
51- Metrics []Metric
52- Interval int
53- Domain string
50+ VCenters []* VCenter
51+ Metrics []Metric
52+ Interval int
53+ Domain string
5454 RemoveHostDomainName bool
55- InfluxDB InfluxDB
55+ InfluxDB InfluxDB
5656}
5757
5858// InfluxDB is used for InfluxDB connections
@@ -390,7 +390,7 @@ func (vcenter *VCenter) Query(config Configuration, InfluxDBClient influxclient.
390390 hostToCluster := make (map [types.ManagedObjectReference ]string )
391391
392392 // Initialize the map that will hold the vDisk UUID per VM MOR to datastore reference
393- vDiskToDatastore := make (map [types.ManagedObjectReference ]map [string ]string )
393+ // vDiskToDatastore := make(map[types.ManagedObjectReference]map[string]string)
394394
395395 // Retrieve properties for clusters, if any
396396 if len (clusterRefs ) > 0 {
@@ -473,15 +473,15 @@ func (vcenter *VCenter) Query(config Configuration, InfluxDBClient influxclient.
473473 vmSummary [vm .Self ]["datastore" ] = strings .Replace (strings .Replace (re .FindString (fmt .Sprintln (vm .Summary .Config )), "[" , "" , - 1 ), "]" , "" , - 1 )
474474
475475 // List all devices to get vDisks
476- for _ , device := range vm .Config .Hardware .Device {
477- // Hacky way to check if it's a vDisk and if it's datastore is different than the main one for VM
478- if device .Backing .FileName != nil && device .Backing .Datastore .Name != vmSummary [vm .Self ]["datastore" ] {
479- if vDiskToDatastore [vm .Self ] == nil {
480- vDiskToDatastore [vm .Self ] = make (map [string ]string )
481- }
482- vDiskToDatastore [vm.Self ][device.diskObjectId ] = device .Backing .Datastore .Name
483- }
484- }
476+ // for _, device := range vm.Config.Hardware.Device {
477+ // // Hacky way to check if it's a vDisk and if it's datastore is different than the main one for VM
478+ // if device.Backing.FileName != nil && device.Backing.Datastore.Name != vmSummary[vm.Self]["datastore"] {
479+ // if vDiskToDatastore[vm.Self] == nil {
480+ // vDiskToDatastore[vm.Self] = make(map[string]string)
481+ // }
482+ // vDiskToDatastore[vm.Self][device.diskObjectId] = device.Backing.Datastore.Name
483+ // }
484+ // }
485485
486486 if vmToCluster [vm .Self ] != "" {
487487 vmSummary [vm .Self ]["cluster" ] = vmToCluster [vm .Self ]
@@ -497,8 +497,8 @@ func (vcenter *VCenter) Query(config Configuration, InfluxDBClient influxclient.
497497 vmExtraMetrics [vm .Self ] = make (map [string ]int64 )
498498 vmExtraMetrics [vm .Self ]["uptime" ] = int64 (vm .Summary .QuickStats .UptimeSeconds )
499499 }
500- fmt .Println ("vDiskDatastore:" )
501- spew .Dump (vDiskToDatastore )
500+ // fmt.Println("vDiskDatastore:")
501+ // spew.Dump(vDiskToDatastore)
502502 // get object names
503503 objects := []mo.ManagedEntity {}
504504
@@ -724,7 +724,7 @@ func (vcenter *VCenter) Query(config Configuration, InfluxDBClient influxclient.
724724 datastoreFields := map [string ]interface {}{
725725 "capacity" : datastore .Summary .Capacity ,
726726 "free_space" : datastore .Summary .FreeSpace ,
727- "usage" : 1.0 - (float64 (datastore .Summary .FreeSpace )/ float64 (datastore .Summary .Capacity )),
727+ "usage" : 1.0 - (float64 (datastore .Summary .FreeSpace ) / float64 (datastore .Summary .Capacity )),
728728 }
729729 datastoreTags := map [string ]string {"ds_name" : datastore .Summary .Name , "host" : vcName }
730730 pt4 , err := influxclient .NewPoint (config .InfluxDB .Prefix + "datastore" , datastoreTags , datastoreFields , time .Now ())
0 commit comments