afbjorklund/lima-gui

Show current resources being used by an instance

afbjorklund opened this issue · 1 comments

Suggestion is to just use ssh, and run some commands on VM...

  • top -b -n 1
  • vmstat 1 2
  • free -h
  • df -h /

Preferrably it should be done by QEMU/lima, if it is simple to do ?

Note that these "inside" values might not line up with the outside.

e.g. 4GiB memory set for VM, ends up being 3.8Gi total memory.

e.g. 100GiB disk set for VM, ends up being 97Gi disk size.


Could also show the disk usage of the lima instance directory,
or the cpu/memory usage of the qemu process (qemu.pid) ?

Previously I have been using "gopsutil" for this.

It has all the required resources, such as:

  • cpu
  • mem
  • disk
		t := time.Now()
		c, _ := cpu.Percent(0, false)
		v, _ := mem.VirtualMemory()
		d, _ := disk.Usage(mountpoint)

		fmt.Printf("Time: %v\n", t)
		fmt.Printf("Cpu: %.2f\n", c[0])
		fmt.Printf("Mem: %.2f\n", v.UsedPercent)
		fmt.Printf("Disk: %.2f\n", d.UsedPercent)

Note that /dev/vda1 has diffferent mountpoints!

Then it needs some nice sparkline Qt graphs.