containerd/machine.go
Michael Crosby c1eb9ac90b Change /containers to /state with machine info
Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
2015-12-03 11:49:56 -08:00

23 lines
403 B
Go

package containerd
import "github.com/cloudfoundry/gosigar"
type Machine struct {
Cpus int
Memory int64
}
func CollectMachineInformation() (Machine, error) {
m := Machine{}
cpu := sigar.CpuList{}
if err := cpu.Get(); err != nil {
return m, err
}
m.Cpus = len(cpu.List)
mem := sigar.Mem{}
if err := mem.Get(); err != nil {
return m, err
}
m.Memory = int64(mem.Total)
return m, nil
}