[SOLVED] How to alert on disk space?

Hey! Happy Proxmox user here (for my home-server). It's very stable and running a couple of VMs for months now. One of my projects is to have metrics on all kinds of systems, f.e. my solar panels, but also my (virtual) servers. So what I did:
  • Running prometheus in a container
  • Added a couple of node_exporters
  • Running grafana in a container, pointing it to prometheus
So far so good.

Now my question: I want to measure the percentage of free disk space on the PVE host. In the GUI, I see the following piecies:
  1. LVM: 88% usage
  2. LVM-thin: 68% usage
Now my question is: what is the difference here?
Where should I setup an alert for? For LVM or LVM-thin usage?

LVM-thin.png

LVM.png
 
The bottom pictures shows you how much of the LVM is allocated. 127.49GB is size the partition sda3 and 88% of that is used for VGs and 15.84GB is unallocated so LVM can use it for snapshots and so on.

Inside the VGs you got your LVs for data (VM/LXC images), swap and root (your proxmox OS, ISOs, Backups and so on).
So the upper picture should show you that 70.32GB is available for VMs/LXCs and 68% of that is already used by VMs/LXCs.

You should read a bit on how LVM is working. Commands like lvs and vgs are useful if you want to know what uses how much space.
 
You may use the API or local ssh wrapper for that. You need to build your own filter to do that but it's a start and should be simple. I may even build a simple bash script some day and publish it to Github. If you decide to do it fast, don't hesitate to commit our script. Thanks!


Bash:
root@node ~ # pvesh get /nodes/node/storage --storage SSD1 --output-format yaml --human-readable 1
---
- active: 1
  avail: 741010707579
  content: images
  enabled: 1
  shared: 0
  storage: SSD1
  total: 966367641600
  type: lvmthin
  used: 225356934021
  used_fraction: 0.233199999999876

root@node ~ # pvesh get /nodes/node/storage --storage SSD1 --output-format yaml --human-readable 1 | grep -i used_fra
  used_fraction: 0.233199999999876

root@node ~ # pvesh get /nodes/node/storage --storage SSD1 --output-format yaml --human-readable 1 | grep -i avail
  avail: 741010707579
 
  • Like
Reactions: rogierl

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!