How to determine, from a script, the activity status of each VM and CT ? (to shut down idle proxmox server automatically)

shodan

Well-Known Member
Sep 1, 2022
314
77
48
Hi,

I am power and heat constrained and I have a large assortment of potato computers running various proxmox servers.

I would like to automatically shut them down when they're idle.

For this purpose I need to, for each VM and CT container that I have, determine what is their activity level.

There can be linux and windows guests and possibly other, more exotic stuff in there.

Some, might have long running tasks that can't be interrupted in there.
Some are desktops where user activity is what counts.

I'm ok with running tools inside the guest to determine activity levels.

I'm curious to know, what already exists for this purpose ?

I would also use this to reduce assigned cores and memory to idle virtual machines as well, maybe even suspend or hibernate them progressively, until they are all hibernating, at which point I would suspend and then shutdown the proxmox host itself.

For wake up, I would have a server orchestrator software of some kind, that would take command of the hostname of the previous VMs and CTs and just listen for any traffic destined for those, and I would have rules for some of them to be a good reason to send Wake On Lan packets to wake up the proxmox host and request it to restarts certain virtual machines.

Does any of this already exist ?

Thanks
 
After writing the above,
it looks like what I describe is basically a package that already exists called

Desomnia
https://desomnia.readthedocs.io/en/latest/
https://github.com/mad0x20wizard/Desomnia

Proxmox Native Cluster WoL
https://medium.com/@saschadierkes/homelab-proxmox-wol-start-stop-containers-remotely-bb6a07ad5ce1
similar, but does not shut down the host as far as I can tell.