Need help - Active Snapshoot Notification

alejandro85

New Member
Oct 28, 2024
3
1
3
Hi team, I'm looking for a solution to send notifications via email (or any other method) when, for example, a VM has an active snapshot larger than 1GB.
Is this possible to achieve?

I'm trying to starting do something like this with help of GPT:

#!/bin/bash
EMAIL="mymail@gm.com"
HOSTNAME=$(hostname)
ALERT=""

for vm in $(qm list | awk 'NR>1 {print $1}'); do
SNAP=$(qm listsnapshot $vm | grep -v current)

if [ ! -z "$SNAP" ]; then
ALERT+="VM $vm tiene snapshot activo:\n$SNAP\n\n"
fi
done

if [ ! -z "$ALERT" ]; then
echo -e "Host: $HOSTNAME\n\n$ALERT" | mail -s "ALERT Snapshots Proxmox en $HOSTNAME" $EMAIL
fi


The script works fairly well, but is not sending any email message...


Thank you in advance!
Regards!! ;)
 
What does postfix say? journalctl -u postfix -n 30
 
Please remove your IP from the screenshot above. GMail does not accept the mail because you are not sending it from a properly configured mailserver.
There are tutorials to configure Proxmox to be able to send mails using gmail.