Why changes in jobs.cfg cannot be monitored

aldomoro

New Member
Feb 1, 2023
12
1
3
Hi
I would like to monitor if anybody changed what is backed up on our Proxmox VE and get e-mail about it. I have found if somebody changes backup jobs via web interface, this change is written to /etc/pve/jobs.cfg. If I run stat command then, I see time of change in access, modify and change attributes.

1706172342161.png

I have also observed If I manually edit jobs.cfg, this change is not written to the configuration in web interface. I see it works only in one direction.

I have installed inotify-tools to my proxmox and if I run this script, I can watch if jobs.cfg was changed.

#!/bin/bash

# Check if the file exist.
if [ ! -f "$1" ]; then
echo "File '$1' does not exist."
exit 1
fi

# Watch the file with `inotifywait`.
inotifywait -e modify -m "$1" | while read -r event; do
echo "File '$1' was changed"
done

Funny is, this script works (it monitors) if I change jobs.cfg manually in command line. If backup configuration is changed by web interface, the script does not work.
Do you know why when jobs.cfg has new date of modify?

Thank you
 
Funny is, this script works (it monitors) if I change jobs.cfg manually in command line. If backup configuration is changed by web interface, the script does not work.
Do you know why when jobs.cfg has new date of modify?
pmxcfs (/etc/pve/) is a cluster wide file system. So you will not get inotify events if content is modified using the cluster stack.
 

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!