This maybe of course ignorance on my part, but I just want to be sure. I don’t know how to get a total (% or GB) of memory currently in use, and I don’t know how to get a total (again % or GB) of disk currently in use.
Is xl info | grep memory the only way to get memory usage?
And is there a way to get disk usage?
You can use, xl info | awk '/total_memory/ {print $3}' and xl info | awk '/total_memory/ {print $3}' to see those values.
Below is the code I use for a widget in Dom0 that gives me a bar percentage of the RAM used.
#!/bin/bash
# /usr/local/bin/RAM_widget.sh
# Get memory stats
total=$(xl info | awk '/total_memory/ {print $3}')
free=$(xl info | awk '/free_memory/ {print $3}')
used=$((total - free))
percent=$((100 * used / total))
percent=$((percent + 1))
# Create bar
bar_length=6 # Number of blocks in the bar
filled=$((percent * bar_length / 100))
empty=$((bar_length - filled))
# Unicode block characters for smoother appearance
filled_char="█"
empty_char="░"
# Build the bar
bar="${filled_char}" # Start with one block
for ((i=1; i<filled; i++)); do bar+="${filled_char}"; done
for ((i=0; i<empty; i++)); do bar+="${empty_char}"; done
# Final output
echo "$bar"
echo " ($percent%)"
With disks it depends on what do you mean by “disk” and what do you want to know. Obvious choice is qui-disk-space tray applet. Other options here can be unsafe. With your question in mind you probably want the applet or some combination of lvm tools and low-level partitioning tools.
Drive tools:
df -h <path> for filesystems (run inside the domain)
There is also lsblk -f, but can get quite unwieldy with the amount of volumes you have in qubes. Not really made for displaying filesystem allocation.
qvm-pool and qvm-volume for qubes pools and domain volumes
lvm tools for logical volumes by default, zfs or btrfs otherwise lvs, vgs, pvs, etc., see SEE ALSO section of lvm manual for all tools
stuff like fdisk and parted for drive partitioning
p.s. you also can use qvm-ls to check memory use (memory field), but I think it only shows correct memory for dom0, and memory at startup for all other qubes.
Well, I have tried a couple ways to configure the launcher, but it just won’t show nothing. If I set Terminal=True, the terminal appears briefly but shows nothing either. Any tip or hint will be greatly appreciated.
I’ve created a secondary Panel in dom0 that I keep all my widgets in.
There is an option to add a Generic Monitoritem and point it to your .sh file, give it a name and select the polling rate.
If you have trouble seeing it, maybe increase the Panel width.