Greetings friends, I have spoken about Veeam Backup for Microsoft 365 multiple times here, I think it is the best Data Protection Solution in the Market for those specific workloads on native Microsoft 365, here is a list of articles about it:
- Veeam Announces Veeam Backup for Microsoft Office 365 v6 – Self-Service Portal and Native Integration with Azure Archive and AWS S3 Glacier
- VeeamON 2021: Accelerating Our Data Protection Strategy – Best Practices for v11, and What’s New for Office 365, Azure, AWS, and GCP
- Veeam: Veeam Backup for Microsoft Office 365 v5 – Security Notifications for Restore operations
- Veeam: How to create additional administrators to access the Veeam Backup for Microsoft Office 365 Console
- Looking for the Perfect Dashboard: InfluxDB, Telegraf, and Grafana – Part XIII – Veeam Backup for Microsoft Office 365 v4
A great solution, that for now, it can not be complemented with Veeam Availability Suite for better monitoring. If you have been using Veeam Backup and Replication for quite some time, and you have deployed Veeam Backup for Microsoft 365, you might be missing the HTML Daily Report that can help to understand quickly how everything went.
Veeam Backup for Microsoft 365 comes with this great report natively after every Job runs:
The native HTML Report is great but does not give an option to run it per job, and Daily for example, plus send to the email address of your choice (thinking of Service Providers here).
I understand those are quite important, as, with the SaaS offerings, we tend to protect those workloads with an improved RPO, like doing Backups more often, even every x minutes, etc. Rest assured, after a few hours yesterday, I have taken the truly impressive Veeam Backup for Microsoft 365 RESTful API, and built the Report for you. If you follow all the steps on this post, you will have something similar to this on your email every day:
Topology with all the logical components
This entry is quite new, as I have never done any HTML Report from Bash, it was quite good, and great learning curve, tons of echos on the code, a diagram look like this:
As we can see, the shell script will download the metrics from Veeam Backup for Microsoft 365 using the RESTful API, which will then be put together into a nice HTML Report, and send after to the Backup Admin, or Backup Admins.
Small system requirements before we continue
We will need two small system requirements before we continue, first will be JQ, which is a package that helps us parsing the JSON, let’s go and install it, yum install if CentOS:
apt-get install jq
The second one is related to the ability to send emails. I am using an advanced package called s-nail, so let’s go ahead and install it:
apt-get install s-nail
As we do not want them to go to SPAM, we will use an external mail server to send these emails, to do this, we will edit the local configuration file of the package:
vi ~/.mailrc
And add the following to the file, which was probably empty, change the server, user and pass with your own:
set smtp-use-starttls set ssl-verify=ignore set smtp=smtp://YOURSMTPSERVER:587 set smtp-auth=login set smtp-auth-user="[email protected]" set smtp-auth-password="YOURPASSWORD" set from="[email protected]"
That’s it! Let’s move on to the next thing.
Download, and configure the veeam_microsoft365_email_report.sh script.
We have almost everything ready, we have one last step, the script that will make all this work, we will download the latest version from the Github repository:
This shell script can be downloaded and run from any Linux, it will need to have access to the Veeam Backup for Microsoft 365 RESTful API, which is HTTPS, and Port 4443. We will have to edit the configuration parameters, here you can play if you want more than the last 24 hours, email, plus IP of your Veeam Backup for Microsoft 365, user/pass, etc.:
veeamUsername="YOURVEEAMBACKUPUSER" veeamPassword="YOURVEEAMBACKUPPASS" veeamRestServer="YOURVEEAMBACKUPFORMICROSOFT365IP" veeamRestPort="4443" #Default Port ## System Variables sessionsJob="48" #Based on the VBO schedule, 48 means running the job every 30 minutes for the last 24 hours reportDate=$(date "+%A, %B %d, %Y %r") reportDatePath=$(date "+%A%B%d%Y") reportDateTo=$(date "+%Y-%m-%d") reportDateFrom=$(date -d "$reportDateTo" '+%s') reportPath="/home/oper/vbo_daily_reports" email_add="CHANGETHISWITHYOUREMAIL"
Once the changes are done, make the script executable with chmod:
chmod +x veeam_microsoft365_email_report.sh
We run it, it should not be any output at all, so no errors, once finished checking the reports path and see if you have an HTML Report there:
ls vbo_daily_reports/ -la -rw-r--r-- 1 root root 140817 Aug 3 13:32 Microsoft365-Job-Report-BJ-EXCHANGE-ALL-TuesdayAugust032021.html -rw-r--r-- 1 root root 70407 Aug 3 13:33 Microsoft365-Job-Report-BJ-ONEDRIVE-ALL-TuesdayAugust032021.html -rw-r--r-- 1 root root 70373 Aug 3 13:33 Microsoft365-Job-Report-BJ-SHAREPOINT-TuesdayAugust032021.html -rw-r--r-- 1 root root 140362 Aug 3 13:32 Microsoft365-Job-Report-BJ-TEAMS-TuesdayAugust032021.html -rw-r--r-- 1 root root 70527 Aug 3 13:32 Microsoft365-Job-Report-GERMANY-SHAREPOINT-SITES-TuesdayAugust032021.html -rw-r--r-- 1 root root 70239 Aug 3 13:32 Microsoft365-Job-Report-M365x789721-EXCHANGE-TuesdayAugust032021.html -rw-r--r-- 1 root root 70497 Aug 3 13:33 Microsoft365-Job-Report-M365x789721-ONEDRIVE-TuesdayAugust032021.html -rw-r--r-- 1 root root 70718 Aug 3 13:31 Microsoft365-Job-Report-M365x789721-SHAREPOINT-TuesdayAugust032021.html -rw-r--r-- 1 root root 240443 Aug 3 13:32 Microsoft365-Job-Report-M365x789721-TEAMS-TuesdayAugust032021.html -rw-r--r-- 1 root root 70506 Aug 3 13:32 Microsoft365-Job-Report-POLAND-SHAREPOINT-SITES-TuesdayAugust032021.html -rw-r--r-- 1 root root 70438 Aug 3 13:33 Microsoft365-Job-Report-UK-SHAREPOINT-SITES-TuesdayAugust032021.html -rw-r--r-- 1 root root 140289 Aug 3 13:33 Microsoft365-Job-Report-UK-TEAMS-TuesdayAugust032021.html
If so, please now add this script to your crontab, like for example, every day will be my recommendation:
30 23 * * * /home/oper/veeam_microsoft365_email_report.sh >> /var/log/vboreport.log 2>&1 >/dev/null 2>&1
There, all good and ready!
HTML Daily Report Veeam Backup for Microsoft 365
In the case that all the email configuration is alright, SmartHost, etc. You should receive a very nice email like this, with all the sessions that had happened during the last 24 hours:
As said, absolutely amazing to see all of this in a single place, if you take a quick look, you can quickly see the stats per Job, time that it took, objects processed, etc.
That’s it all, I am planning to add much more details into these HTML Reports, as I can see there seems to be a lot of demand for them. For real-time monitoring, and some great dashboarding, do not forget that we have already the Grafana Dashboard for Veeam Backup for Microsoft 365:
Michael says
i get this when I run the script
jq: error (at :3): Cannot index string with string “id”
jorgeuk says
Hello Michael,
Can you please confirm the VB365 version you are running, please? What happens if you copy-paste some of the commands and use echo to see if you are getting a bearer for example etc.