[GH-ISSUE #47] I don't know how to read lxc config #20

Closed
opened 2026-02-27 15:46:00 +03:00 by kerem · 2 comments
Owner

Originally created by @nklamann on GitHub (Feb 22, 2021).
Original GitHub issue: https://github.com/proxmoxer/proxmoxer/issues/47

Hello all,
want to extract the existing configuration of a PVE Node for documentation purposes.

I have no trouble to display some metadata of the lxc. But how do I get the config ?

In pvesh it looks like this:

pvesh get /nodes/xxx/lxc/200/config/

In python I do:

from proxmoxer import ProxmoxAPI

proxmox = ProxmoxAPI('xxx.de', user=yyy',
                 password='yyyyyy', verify_ssl=False)

for node in proxmox.nodes.get():
    for lxc in proxmox.nodes(node['node']).lxc.get():
        print (lxc)

the dictionary lxc does not contain a 'config' and I did not manage to extract this information in any way i tried.

How shall this be done ?

Thanks for reading !

Norbert

Originally created by @nklamann on GitHub (Feb 22, 2021). Original GitHub issue: https://github.com/proxmoxer/proxmoxer/issues/47 Hello all, want to extract the existing configuration of a PVE Node for documentation purposes. I have no trouble to display some metadata of the lxc. But how do I get the config ? In pvesh it looks like this: ` pvesh get /nodes/xxx/lxc/200/config/ ` In python I do: from proxmoxer import ProxmoxAPI proxmox = ProxmoxAPI('xxx.de', user=yyy', password='yyyyyy', verify_ssl=False) for node in proxmox.nodes.get(): for lxc in proxmox.nodes(node['node']).lxc.get(): print (lxc) the dictionary `lxc` does not contain a 'config' and I did not manage to extract this information in any way i tried. How shall this be done ? Thanks for reading ! Norbert
kerem 2026-02-27 15:46:00 +03:00
Author
Owner

@jhollowe commented on GitHub (Feb 28, 2021):

From looking at the API documentation, it looks like you just need to add config to your query. Also, make sure you have the VM.Audit permission for everything.

For example:

from proxmoxer import ProxmoxAPI

proxmox = ProxmoxAPI('xxx.de', user='yyy@realm',
                                       password='yyyyyy', verify_ssl=False)

for node in proxmox.nodes.get():
    for lxc in proxmox.nodes(node['node']).lxc.get():
        config = proxmox.nodes(node['node']).lxc(lxc["vmid"]).config.get()
        print (config)
        print(config["template"])
<!-- gh-comment-id:787535644 --> @jhollowe commented on GitHub (Feb 28, 2021): From looking at the [API documentation](https://pve.proxmox.com/pve-docs/api-viewer/index.html#/nodes/{node}/lxc/{vmid}/config), it looks like you just need to add config to your query. Also, make sure you have the VM.Audit permission for everything. For example: ```python from proxmoxer import ProxmoxAPI proxmox = ProxmoxAPI('xxx.de', user='yyy@realm', password='yyyyyy', verify_ssl=False) for node in proxmox.nodes.get(): for lxc in proxmox.nodes(node['node']).lxc.get(): config = proxmox.nodes(node['node']).lxc(lxc["vmid"]).config.get() print (config) print(config["template"]) ```
Author
Owner

@nklamann commented on GitHub (Mar 1, 2021):

Thanks a lot . That didi it . I was confused after reading in the README:

As a demonstration of the flexibility of usage of this library, the following lines accomplish the equivalent function:
proxmox.nodes(node['node']).openvz.get()
proxmox.nodes(node['node']).get('openvz')
proxmox.get('nodes/%s/openvz' % node['node'])
proxmox.get('nodes', node['node'], 'openvz')

proxmox.get('nodes/%s/openvz' % node['node']) threw me off the rails

Thanks again !

<!-- gh-comment-id:788112888 --> @nklamann commented on GitHub (Mar 1, 2021): Thanks a lot . That didi it . I was confused after reading in the README: > As a demonstration of the flexibility of usage of this library, the following lines accomplish the equivalent function: proxmox.nodes(node['node']).openvz.get() proxmox.nodes(node['node']).get('openvz') proxmox.get('nodes/%s/openvz' % node['node']) proxmox.get('nodes', node['node'], 'openvz') `proxmox.get('nodes/%s/openvz' % node['node'])` threw me off the rails Thanks again !
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/proxmoxer#20
No description provided.