containerd/machine.go
Michael Crosby d9e8fe62cb Add concurrency and id flag for daemon
Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
2015-12-07 15:19:56 -08:00

26 lines
439 B
Go

package containerd
import "github.com/cloudfoundry/gosigar"
type Machine struct {
ID string
Cpus int
Memory int64
}
func CollectMachineInformation(id string) (Machine, error) {
m := Machine{
ID: id,
}
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
}