Greetings, Habr!
More recently, the company I work for started offering Veeam as the primary backup tool. And all would be fine, but the following was found out during the familiarization process:
- Veeam tools are sharpened under Windows, including the deployment of a centralized repository;
- under Linux there is only a Veeam agent;
Based on this, it turns out that if the organization uses only Linux, then you will not see any reports. Or we buy and install Windows, and already in it we install and configure everything that is required, and from there we get full information about the results of the Veeam agent (Linux). Or we go to each car and see how the next "working day" of the agent went there.
And then came the day when a small organization was found that uses only Linux and which really needs to be backed up and preferably for free. But daily to monitor how the agent worked there, I want to centrally, rather than massive raids on servers.
To solve this issue, I had to go to the FAQ on the Veeam website and read what we can get using the console and the available veeam agent commands. From the read, a small Bash script was born that looks at the result of the last task, and for one free space in a network folder designed to store backups.
Actually, I want to share this script. I warn you right away, I'm not good at scripting, so criticism and suggestions are welcome.
As a result of the script, a report will be prepared as follows:
Start check on 10.09.2019 at 14:13:30 ------------------------------------------------------ Check Schedule job name: HP from Host: hp ------------------------------------------------------ Every day At: 23:00 Run automatically: enabled ------------------------------------------------------ Check latest session Job name: HP from Host: hp ------------------------------------------------------ Backup session ID: {555ebf40-2fb9-47cc-baf0-7192c0ae896e} Job name: HP Job ID: {435117d7-ace8-4009-9c51-b00e8174c252} State: Success Start time: 2019-09-06 22:43:19 End time: 2019-09-07 00:02:14 ------------------------------------------------------ Stop check on 10.09.2019 at 14:13:30 ------------------------------------------------------ Check files in backup repository: media media ------------------------------------------------------ Check free space on backup repository: % C //share/backup 1,8T 96G 1,7T 6% /media/backup_repository ------------------------------------------------------
Depending on the chosen method, the report will be sent either by mail or in Telegram (my case):
It remains to add the task to crontab, for example, every day at 9 am
0 9 * * * /scripts/check_veeam_backup.sh> / dev / null # Daily check at 9am
Now the script runs every morning and by the time the work day begins, all the information about the work of agents and available space on the backup server is at hand.
Not everything is smooth in the script, especially with a username and password for mounting a network folder, access to which only a special user has access to. But if you allow this user only read, then there is a clear plus. Your backups will never be rubbed by this user, even by accident.