RSSAmplifier

Harry Suryapambagya · Jul 22, 2024

Summarize Guest VMs Status

0
Sign in to vote or save

Harry Suryapambagya · Harry Suryapambagya

  1. Home
  2. Blog
  3. Summarize Guest VMs Status

A one-liner with awk that counts running, paused, idle, and shut-off KVM guests from virsh list --all output. Quick health check on a busy hypervisor.

1 min read

Just a oneliner to count/summarize status of Guest VMs.

[root@kvm-buf1 ~ ]# virsh list --all | awk '/running/{running++} /idle/{idle++} /paused/{paused++} /in shutdown/{in_shutdown++} /shut off/{shut_off++} /crashed/{crashed++} /pmsuspended/{pmsuspended++} END {print "Running VMs: " running "\nIdle VMs: " idle "\nPaused VMs: " paused "\nIn Shutdown VMs: " in_shutdown "\nShut off VMs: " shut_off "\nCrashed: " crashed "\nPower Suspended: " pmsuspended}'

Running VMs: 16

Idle VMs: 0

Paused VMs: 1

In Shutdown VMs: 0

Shut off VMs: 33

Crashed: 0

Power Suspended: 0

OlderPagespeed Web DevNewer Observability stack murah: Grafana + Loki + Tempo di VPS $5

Read the original on harry.id

Comments

Nothing yet. Say the first thing.

    Sign in to join the conversation.