How to Execute shell command properly

CheeseRat007

New Member
Apr 25, 2024
7
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 ?
 
I was able to get MAC/IP settings via the Report API, and filtering it for the appropriate vmbrX. Not sure if that helps in your case.
Oh, I just want to know how to call the api " /api2/json/nodes/{node}/execute" but not network info
 
there is no API endpoint to directly execute commands on the hypervisor host..
 

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!