how to get ip and network details through rest api

sujeet

New Member
Apr 5, 2017
5
0
1
36
i have installed proxmox on centOS
i am creating VM through REST api's provided VM are created through (qemu)
i have installed agent on the created VM.
when i try to get the ip of the VM created through REST "/api2/json/nodes/{node}/qemu/{vmid}/agent" it does not give the IP
.
i followed the agent installation through this pve.proxmox.com/wiki/Qemu-guest-agent
the OS we are installing on VM is ubuntu 14.04
the proxmox version : 4.1-1/2f9650d4

Please guys does anyone know what the problem is i am stuck
 
hi,

proxmox version : 4.1-1/2f9650d4
first i urge you to update to a current version, since your version is very old and there were numerous bug and security fixes

when i try to get the ip of the VM created through REST "/api2/json/nodes/{node}/qemu/{vmid}/agent" it does not give the IP
please post the complete request and the complete response, else nobody will be able to help you

edit: changed "answer" to "response"
 
so i have created VM with ubuntu 14.04 OS.
The IP can be assigned through DHCP.
i followed following steps for IP address of the VM:

1 ) Enter the QEMU Guest Agent
As it turns out, installing this is pretty easy. You install the service within your target VM, set the Agent option under hardware in the PVE web GUI to ‘On’, and then you reboot the VM.

2 ) fired the following CLI command pvesh create nodes/technodrome/qemu/101/agent -command network-get-interfaces


This process must return the IP of the targeted VM but is returning blank.

Thanks for helping.
 
Hey can any one help me
i really suck because of this problem

what am i doing wrong in above code
..
 
Last edited:
this command should be working, you get a JSON file containing various info and the IP adress.
make sure that the qemu-agent is running:
* service qemu-guest-agent status
if this is working, tries a simple qemu-guest-ping command

pvesh create nodes/technodrome/qemu/101/agent -command ping

this should return an empty json