Get current status without table of VM/LXC

Editor

Well-Known Member
Apr 26, 2017
108
1
58
Turkey
Hello,

Unable to retrieve data about the status of the machine, unfortunately no longer. The reason for this is that Proxmox version change.

Before:
Code:
root@prox:~# pvesh get /nodes/prox/lxc/101/status/current
running
root@prox:~#

So I could get data with PHP but with the new version it has changed.

After:
Code:
root@prox:~# pvesh get /nodes/prox/lxc/101/status/current
┌─────────┬─────────────────────┐
│ key     │ value               │
├─────────┼─────────────────────┤
│ cpus    │ 1                   │
├─────────┼─────────────────────┤
│ ha      │ {"managed":0}       │
├─────────┼─────────────────────┤
│ maxdisk │ 24.48 GiB           │
├─────────┼─────────────────────┤
│ maxmem  │ 1.00 GiB            │
├─────────┼─────────────────────┤
│ maxswap │ 512.00 MiB          │
├─────────┼─────────────────────┤
│ name    │ test-9.example.com │
├─────────┼─────────────────────┤
│ status  │ running             │
├─────────┼─────────────────────┤
│ uptime  │ 14m 24s             │
├─────────┼─────────────────────┤
│ vmid    │ 101                 │
└─────────┴─────────────────────┘
root@prox:~#

How will it be now? :)
 
For seeing just the status in the command line, this should work:

Code:
pvesh get /nodes/prox/lxc/101/status/current --noborder --noheader | grep status | cut -d ' ' -f 3
 
  • Like
Reactions: Editor