QEMU Agent returns file not found when trying to execute a command on CHR

cliftonz

New Member
Feb 7, 2020
8
0
1
26
We want to set up a automated virtual environment with Proxmox and CHR. We are wanting to communicate directly with CHR through the agent so that we don't have open web and ssh portals in our network that users could see. I currently have a CHR router set up in a proxmox host and confirmed that the agent works. The issue is that when I go to send a command using this link 'https://{proxhost}:8006/api2/json/nodes/{node}/qemu/{CHRVMID}/agent/exec?command="/ip address print"' or 'https://{proxhost}:8006/api2/json/nodes/{node}/qemu/{CHRVMID}/agent/exec?command=":ip address print"' it returns file not found.

The issue I am finding is that CHR is a router and does not allow you into the underlining file system and can not do for example 'bin/bash <commands>' and I am unsure how to get around this.

I have seen other posts about similar topic and none of them have seem to lead me to the resolution I need. We would like to avoid sshing into the servers and would like to stick with the API. How do you recommend I continue?

How would you normally/recommend go about sending a command to CHR with the QEMU agent?

Does the exec command need input-arguments and capture-output need implemented in /api2/json/nodes/{node}/qemu/{vmid}/agent/exec?
 
After some testing I was able to get this to work.

The input-data base64 decodes to ":ip address print;"
1582677382815.png

When I use the api to query the process I was get QEMU Guest agent not running, but this was because I still had the connection open.

1582677440354.png

So after I close the connection, I get my expected output from the API.
1582678901097.png
 

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!