Veeam Agent For Linux beta – Notification script

So you’ve gone ahead and started to test out the new Veeam Agent for Linux beta in your environment – finally, a Veeam solution to those physical Linux servers that seem to always hang around in the datacenter!  Wait, if you haven’t check my post on it here and sign up for the official beta here.   Anways we can schedule our jobs – that’s great, but there is only one problem – we currently don’t have any way of reporting on the success of failure of the jobs.

Now this is only a beta and we don’t know what a full version of this will look like – so I don’t want to go ahead and say that this is something the application is lacking as it could be baked in with a future build – but for now let me show you my workaround – how I scripted the ability to report on success of my jobs.

First up, don’t schedule your backup jobs within the VAL gui – Leave the ‘Run the job automatically’ unchecked while you are setting up your job as we have below.  Instead, we will write a script that will first kick off the job for us, then store the session id variable so we can later send an email on its success.   We will create our own cron entry to handle this rather than using Veeam’s scheduler.

veeam-nosched

So how do we go about creating this script?  Well, before getting to far into it I suggest you head over to Dmitry Kniazev’s blog and read his post on the Veeam Agent for Linux (Serious Mode) as it does a good job at explaining some of the cli commands such as veeamconfig that come with VAL.

As always let me post the full script first, then break it down line by line for you….  Before getting to far in though there are a few quirks!  First off,  you can see I dump some information and create some files – all of this is done in the /home/ubuntu/ directory – feel free to change this to whatever you like – I didn’t take the time to variabalize all of this – sorry!  Secondly, the script uses sendmail – so be sure you have setup properly as well!!!!  Anyways, the script

Sometimes throwing bash up into a blog post really messes things up so if you are having issues copying/pasting you can simply pull down the complete file  here!

Veeam Agent for Linux job ($JOBNAME) completed with a status of $STAT
Start Time: $STARTDATE – $STARTTIME End Time: $ENDDATE – $ENDTIME $BACKUP

” >> /home/ubuntu/email.htm
echo ”

 

Huh?!?!?!

Yeah, so as for how it all works let’s have a look!!!

Lines 3-6 simply declare some variables – change these to your prefered emails and most importantly, the name of your backup job!

Line 8 starts our backup job, redirecting text to a file

Line 11/12 gets the sessionID of the job we just started…

Lines 17 through 27 simply loop and wait until our backup job has actually completed running.

Line 30/31 dump some more information out about our backup, while lines 34 through 39 parse that information and hold it in some variables.

Line 41 through 77 build the email and send it!

And that’s it!!!!!

As far as scheduling grows channel your inner cronniness!  For instance to have the job run say every Monday through Friday at 1 AM we can add a entry to our crontab as follows

Anyways – I didn’t spend a lot of time cleaning up this script – just wanted to throw something together to get some basic notifications going through within Veeam Agent for Linux!  Feel free to report back with any awesome modifications or enhancements you would like to add! 🙂  Thanks for reading!

 

 

1 thought on “Veeam Agent For Linux beta – Notification script”

  1. Thank you for a great post! You may want to run export NCURSES_NO_UTF8_ACS=1 for prettier screenshots 😉

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top