API VM Restart

Younex

Well-Known Member
Jan 30, 2018
93
22
48
45
Hi Guys,

actually i restart VM with crontab command on PVE Host.
I have a cluster of 5 nodes.
Problem is if i move VM i have to move script for restart too.

My idea is to using API to send request for restart so proxmox take care on which Host VM resides and restart it.

Does somebody have a tip for me how to do this?
Thx.

Kind Regards
Younex
 
When issuing the API command, you need to specify the node.
However, you can find that via the /cluster/resources API call.

e.g pvesh get /cluster/resources --output-format json | jq '.[]|select(.id=="lxc/100")|.node' -r gives you the location of the Container with ID 100.