How to obtain the IP address of a virtual machine with a specified vmid?

chon

New Member
Jul 29, 2024
6
0
1
Code:
// PHP Code
$ip = $proxmox->nodes()->node("node02")->qemu()->vmId(132)->agent()->networkGetInterfaces()->getPve()->getHostname()->get();

This interface returns NULL.

I am not getting the ip address of the specified vmid. help me Please,ThankYou.
 
Last edited:
Last edited:
Hey,

I am not sure what PHP library you are using, but I think what you are looking for is this API endpoint [1]. Also make sure the guest agent[2] is running in the VM.

[1] https://pve.proxmox.com/pve-docs/ap...ode}/qemu/{vmid}/agent/network-get-interfaces
[2] https://pve.proxmox.com/wiki/Qemu-guest-agent
Oh,Thanks.

The reason is that I have not install Qemu-guest-agent.
And other problems Proxmox Agent doesn't start (qemu-guest-agent) .
I 've got IPAddress now.
Thanks again.
 

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!