Added ResourcePool information:

This commit is contained in:
tsi 2017-05-11 11:38:33 +02:00
parent 9ce89212b8
commit c60748773f
1 changed files with 9 additions and 2 deletions

View File

@ -606,7 +606,7 @@ func (vcenter *VCenter) Query(config Configuration, InfluxDBClient influxclient.
for _, pool := range respool {
respoolFields := map[string]interface{}{
"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}
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 {
var min int64 = -1
for _, i := range n {
@ -691,7 +698,7 @@ func queryVCenter(vcenter VCenter, config Configuration, InfluxDBClient influxcl
func main() {
flag.BoolVar(&debug, "debug", false, "Debug mode")
var cfgFile = flag.String("config", "/etc/"+path.Base(os.Args[0])+".json", "Config file to use. Default is /etc/"+path.Base(os.Args[0])+".json")
var cfgFile = flag.String("config","/etc/" + path.Base(os.Args[0])+".json", "Config file to use. Default is /etc/"+path.Base(os.Args[0])+".json")
flag.Parse()
stdlog = log.New(os.Stdout, "", log.Ldate|log.Ltime)