How to Execute shell command properly

CheeseRat007

New Member
Apr 25, 2024
15
0
1
Hi Guys, I am new to proxmox. I am currently using the Corsinvest C# API to interface with proxmox.

Execute API: https://pve.proxmox.com/pve-docs/api-viewer/#/nodes/{node}/execute


I am trying to execute the cmd "ip link show vmbr1", but it says bad format. What changes should I do to the parameters to get it working.

Thanks in advance.

Code:
var cmd = "ip link show vmbr1";

var cmdObj = new[]
{
    new
    {
    args = cmd,
    method = "GET",
    path = ""
    },
};
var cmdSerialized = JsonConvert.SerializeObject(cmdObj);
var cmdExecuteResult = await node1Obj.Execute.Execute(cmdSerialized);
 
the commands this endpoint is referring to are calls to PVE API endpoints, not generic shell commands..
 
the commands this endpoint is referring to are calls to PVE API endpoints, not generic shell commands..
How would I call the shell cmd using PVE API.

Also is there a way to obtain the Mac address associated with the bridge using the API. The network configuration API does not return the Mac address. So far only this worked in shell cmd.
"ip link show vmbr1"
 
I am not sure we expose the MAC anywhere on the API except in the report endpoint. there is no "execute arbitrary command on node" endpoint either..
 
I am not sure we expose the MAC anywhere on the API except in the report endpoint. there is no "execute arbitrary command on node" endpoint either..
Could you show me how to execute simple command like "ip a" to get pve info by api ?
 
there is no API endpoint to directly execute commands on the hypervisor host..