@@ -47,12 +47,12 @@ const (
47
47
48
48
// Configuration is used to store config data
49
49
type 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
54
54
RemoveHostDomainName bool
55
- InfluxDB InfluxDB
55
+ InfluxDB InfluxDB
56
56
}
57
57
58
58
// InfluxDB is used for InfluxDB connections
@@ -390,7 +390,7 @@ func (vcenter *VCenter) Query(config Configuration, InfluxDBClient influxclient.
390
390
hostToCluster := make (map [types.ManagedObjectReference ]string )
391
391
392
392
// 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)
394
394
395
395
// Retrieve properties for clusters, if any
396
396
if len (clusterRefs ) > 0 {
@@ -473,15 +473,15 @@ func (vcenter *VCenter) Query(config Configuration, InfluxDBClient influxclient.
473
473
vmSummary [vm .Self ]["datastore" ] = strings .Replace (strings .Replace (re .FindString (fmt .Sprintln (vm .Summary .Config )), "[" , "" , - 1 ), "]" , "" , - 1 )
474
474
475
475
// 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
+ // }
485
485
486
486
if vmToCluster [vm .Self ] != "" {
487
487
vmSummary [vm .Self ]["cluster" ] = vmToCluster [vm .Self ]
@@ -497,8 +497,8 @@ func (vcenter *VCenter) Query(config Configuration, InfluxDBClient influxclient.
497
497
vmExtraMetrics [vm .Self ] = make (map [string ]int64 )
498
498
vmExtraMetrics [vm .Self ]["uptime" ] = int64 (vm .Summary .QuickStats .UptimeSeconds )
499
499
}
500
- fmt .Println ("vDiskDatastore:" )
501
- spew .Dump (vDiskToDatastore )
500
+ // fmt.Println("vDiskDatastore:")
501
+ // spew.Dump(vDiskToDatastore)
502
502
// get object names
503
503
objects := []mo.ManagedEntity {}
504
504
@@ -724,7 +724,7 @@ func (vcenter *VCenter) Query(config Configuration, InfluxDBClient influxclient.
724
724
datastoreFields := map [string ]interface {}{
725
725
"capacity" : datastore .Summary .Capacity ,
726
726
"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 )),
728
728
}
729
729
datastoreTags := map [string ]string {"ds_name" : datastore .Summary .Name , "host" : vcName }
730
730
pt4 , err := influxclient .NewPoint (config .InfluxDB .Prefix + "datastore" , datastoreTags , datastoreFields , time .Now ())
0 commit comments