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:
parent
9ce89212b8
commit
c60748773f
@ -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 {
|
||||||
@ -691,7 +698,7 @@ func queryVCenter(vcenter VCenter, config Configuration, InfluxDBClient influxcl
|
|||||||
func main() {
|
func main() {
|
||||||
|
|
||||||
flag.BoolVar(&debug, "debug", false, "Debug mode")
|
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()
|
flag.Parse()
|
||||||
|
|
||||||
stdlog = log.New(os.Stdout, "", log.Ldate|log.Ltime)
|
stdlog = log.New(os.Stdout, "", log.Ldate|log.Ltime)
|
||||||
|
Loading…
Reference in New Issue
Block a user