How to get network interface with API if the VM has guest agent disabeled

rareness

New Member
Oct 18, 2023
3
0
1
I have an python code using proxmoxer to get the network-interfaces from VM, however it fails with an exception if guest agent is turned off for the VM. Is there any other way to get an network-interfaces information with API, having guest agent turned off


Code:
interface_info = node.qemu(vm_id).agent.get('network-get-interfaces')['result']
 
I am not aware of another API endpoint which could be used.
Another approach would be to connect with python to the VM via SSH and execute a command to obtain information about the network-interfaces.
Something like this:

Code:
ssh = paramiko.SSHClient()
ssh.connect(server, username=username, password=password)
ssh_stdin, ssh_stdout, ssh_stderr = ssh.exec_command(cmd_to_execute)