1
0
mirror of https://github.com/Oxalide/vsphere-influxdb-go.git synced 2023-10-10 13:36:51 +02:00

Added ResourcePool information:

This commit is contained in:
tsi 2017-05-11 11:38:33 +02:00
parent 9ce89212b8
commit c60748773f

View File

@ -606,7 +606,7 @@ func (vcenter *VCenter) Query(config Configuration, InfluxDBClient influxclient.
for _, pool := range respool { for _, pool := range respool {
respoolFields := map[string]interface{}{ respoolFields := map[string]interface{}{
"cpu_limit": pool.Config.CpuAllocation.GetResourceAllocationInfo().Limit, "cpu_limit": pool.Config.CpuAllocation.GetResourceAllocationInfo().Limit,
"memory_limit": pool.Config.MemoryAllocation.GetResourceAllocationInfo().Limit, "memory_limit": MBToKB(pool.Config.MemoryAllocation.GetResourceAllocationInfo().Limit),
} }
respoolTags := map[string]string{"pool_name": pool.Name} respoolTags := map[string]string{"pool_name": pool.Name}
pt3, err := influxclient.NewPoint("resourcepool", respoolTags, respoolFields, time.Now()) pt3, err := influxclient.NewPoint("resourcepool", respoolTags, respoolFields, time.Now())
@ -627,6 +627,13 @@ func (vcenter *VCenter) Query(config Configuration, InfluxDBClient influxclient.
} }
func MBToKB(n int64) int64 {
if n != -1 {
n = 1000 * n
}
return n
}
func min(n ...int64) int64 { func min(n ...int64) int64 {
var min int64 = -1 var min int64 = -1
for _, i := range n { for _, i := range n {