[API] Call QEMU Agent error and wrong information

paowalker1990

New Member
Oct 29, 2024
1
0
1
[PS Script]

My code:
https://github.com/.../04054a709c8c95.../proxmox-api-problem
API:
https://pve.proxmox.com/pve-docs/api-viewer/index.html#/nodes/{node}/qemu/{vmid}/agent/get-osinfo
Code:
            try {

                $vmAgentResponse = Invoke-RestMethod -URI $vmAgentUri -Headers $Headers -ContentType "application/json" -Method Get -WebSession $session
                $vmAgent = $vmAgentResponse.data.result
                Write-Host $vm
           
            } catch {

                    Write-Host "vmAgentResponse line is broken"
            }

I know i still not completed installation agent of proxmox, but some vm was installed already.
So, I would like to get OS information. However when i add the above try-catch it bring other api broken

-------- have a vmAgentResponse block ---------
proxmox-node
vm-001
2
3072
Storage Name: SAN-001, Size: 50G
Hostname: proxmox-node
stopped
vmAgentResponse line is broken
vmConfigResponse line is broken
vmStatusResponse line is broken
vmAgentResponse line is broken
vmConfigResponse line is broken
vmStatusResponse line is broken
vmAgentResponse line is broken
vmConfigResponse line is broken

-------- no have a vmAgentResponse block ---------
proxmox-node
vm-001
2
3072
Storage Name: SAN-001, Size: 50G
Hostname: proxmox-node
stopped
OS Type: Centos7
MS-Server-001
4
8192
Storage Name: IBM-001, Size: 200G
Storage Name: TAPE-S002, Size: 50G
Hostname: proxmox-node
running
.
.
.

-------- what i want ---------
proxmox-node
vm-001
2
3072
Storage Name: SAN-001, Size: 50G
Hostname: proxmox-node
stopped
OS Type: Centos7
MS-Server-001
4
8192
Storage Name: IBM-001, Size: 200G
Storage Name: TAPE-S002, Size: 50G
Hostname: proxmox-node
running
vmAgentResponse line is broken <<<< it should show this message when it catch and other vm is stil looping for information
 
Last edited:

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!