API VM Restart

Younex

Well-Known Member
Jan 30, 2018
92
22
48
43
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.
 

About

The Proxmox community has been around for many years and offers help and support for Proxmox VE, Proxmox Backup Server, and Proxmox Mail Gateway.
We think our community is one of the best thanks to people like you!

Get your subscription!

The Proxmox team works very hard to make sure you are running the best software and getting stable updates and security enhancements, as well as quick enterprise support. Tens of thousands of happy customers have a Proxmox subscription. Get yours easily in our online shop.

Buy now!