I have a tree structure containing backups for dozens of databases and other services, laid out like:
As you can see, this is an heterogeneous structure
I need to monitor the age of the latest backups in specific directories, for example:
So I though about LLD to discover all backup files with their respective age/timestamp, and context macros to specify the max age for each target directories, like:
Code:
mnt
backup
host1
latest
2021-12-20_06h32m.monday.sql.gz <- File age must not exceed 1 day
daily
2021-12-20_06h32m.monday.sql.gz
2021-12-19_06h33m.sunday.sql.gz
2021-12-17_06h43m.saturday.sql.gz
weekly
...
host2
db_backup_20211219230000.tgz <- File age must not exceed 1 day
db_backup_20211218000000.tgz
db_backup_20211217000000.tgz
host3
db
latest
2021-12-20_04h42m.monday.sql.gz <- File age must not exceed 1 hour
daily
2021-12-20_04h42m.monday.sql.gz
2021-12-19_04h43m.sunday.sql.gz
upload
latest
2021-12-20_03h52m.monday.sql.gz <- File age must not exceed 2 hours
...
I need to monitor the age of the latest backups in specific directories, for example:
- /mnt/backup/host1/latest/ Here latest file age must not exceed 1d
- /mnt/backup/host2/ Here latest file age must not exceed 1d
- /mnt/backup/host3/db/latest/ Here latest file age must not exceed 1h
- /mnt/backup/host3/upload/latest/ Here latest file age must not exceed 2h
So I though about LLD to discover all backup files with their respective age/timestamp, and context macros to specify the max age for each target directories, like:
- {$BACKUP_MAX_AGE:/mnt/backup/host1/latest/}: 1440 (1 day in minutes)
- {$BACKUP_MAX_AGE:/mnt/backup/host2/}: 1440
- {$BACKUP_MAX_AGE:/mnt/backup/host3/db/latest/}: 120
- {$BACKUP_MAX_AGE:/mnt/backup/host3/upload/latest/}: 60
- Do you think I'm going on the correct direction ?
- Should I use a system.run[find /mnt/backup] Key to find the files in my LDD ?
- Should/can I use context macros to filter LDD results ?
Comment