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!!
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!!