How to export all VM IDs, name and notes?

Dude:
qm list - list of VMs,
pct list - list of LXC Containers,
vzlist - list of OpenVZ Containers. (Proxmox <3.X)
 
  • Like
Reactions: magicfab
Yes, I found out about qm in the command line tools list, however it only provides partial output of all VMs information. An example:

# qm list
VMID NAME STATUS MEM(MB) BOOTDISK(GB) PID
100 nts-NA stopped 16200 100.00 0
102 calendrier.aaaa.lan-NA stopped 512 0.00 0
104 wikicentos.aaaa.lan running 2560 0.00 397356
106 backuppc.aaaa.lan running 4096 0.00 2601
107 ddlserver.aaaa.lan running 4096 0.00 2659
109 syslog.aaaa.lan stopped 2048 32.00 0


Invoking qm config shoul do it, I'll script something to go through existing VM IDs and extract the "description" field:

# qm config 100
balloon: 1024
bootdisk: virtio0
cores: 4
description: Some description goes here
ide2: isoimages:iso/securityonion-12.04-20121224.iso,media=cdrom,size=1247118K
memory: 16200
name: nts-NA
net0: virtio=BE:01:DF:52:18:68,bridge=vmbr0
net1: virtio=C6:A8:CB:65:19:86,bridge=vmbr3
ostype: l26
sockets: 1
virtio0: lvm-san:vm-100-disk-1,size=100G

It would still be useful to be able to extract all VM details as a CSV (or other) output for processing, I'll probably make a feature request.
 
all of the config is in plain text files in /etc/pve .. you can simply copy/backup/parse/... those. just be careful about modifying them manually unless you are sure that you know what you are doing (the API and tools use locking to prevent concurrent modifications, prevent syntax errors, ..)
 
Hey, another Fabian :)

I know I can "simply" copy & paste and parse everything in unix-y systems, I just need to make the best use of my time and was hoping for this to be something I had just not found.

What would be the best way to suggest this feature/improvement? I think it could benefit others.
 
Feel free to write a script and include it in a relevant wiki article or post it here. I don't think we will provide such a script ourselves, because everybody would need a different selection of config keys / output format / other variation...
 
  • Like
Reactions: magicfab
Noob question. The man documents do not indicate how to run these commands from a "cluster perspective". Is there an easy way to get a list of all VM's across all nodes in the cluster? 'qm list' only lists the vm's local to the host. OR ... running a qm config ### from a "cluster prompt" so that you do not have to be on the node to gather the details. The GUI is presenting this data as a single pane, but to get 'single pane' from CLI or maybe an API would be helpful, especially with larger clusters.
 
The context of the qm pct and vz commands is limited to the host on which the command was issued.

The pvesh commands will give you a wealth of that "cluster perspective."

https://pve.proxmox.com/pve-docs/pvesh.1.html

How did you google that, and not find the correct answer, but you did find a 5 year old thread about something different?
 
Hello,

pvesh is too complicated for me.

I have three Nodes, named pved/pvee/pvef. On any of them I can simply run commands like this:
Code:
~# for D in d e f;  do ssh pve$D uname -a; done
Linux pved 5.4.65-1-pve #1 SMP PVE 5.4.65-1 (Mon, 21 Sep 2020 15:40:22 +0200) x86_64 GNU/Linux
Linux pvee 5.4.65-1-pve #1 SMP PVE 5.4.65-1 (Mon, 21 Sep 2020 15:40:22 +0200) x86_64 GNU/Linux
Linux pvef 5.4.65-1-pve #1 SMP PVE 5.4.65-1 (Mon, 21 Sep 2020 15:40:22 +0200) x86_64 GNU/Linux

For a list of all running VMs in the cluster I can do:
Code:
~# for D in d e f;  do ssh pve$D qm list| grep running ; done

Just my 1 €¢
 

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!