A couple of months ago I posted about Kollect and introducing this as a tool to provide an inventory of your Kubernetes clusters and cloud based resources in Microsoft Azure and AWS.
During the festive period I decided to tackle one of the remaining areas I wanted to include as an option to inventory, this was to collect a Veeam Backup & Replication inventory using the tool via the Veeam API but hiding some of the complexities that this brings.
Veeam Backup & Replication REST API Reference
I will start off by sharing the Veeam RESTAPI reference here.
Swagger
Not really relevant for you to know to use the tool but will give you a good idea on how I was able to understand the APIs available for us to show the data in Kollect. I think I first wrote about Swagger in around 2016 so it is a tried and tested way to expose, test and describe your APIs. Here I used it to understand the API endpoints available and how to use them in the tool
“Swagger allows you to describe the structure of your APIs so that machines can read them.”
I encourage everyone to take a look at all the Veeam API endpoints across the portfolio, you will find there is a growing amount and some really interesting things you can achieve with them.
Kollect with Veeam
Much like the other platforms we Kollect (see what i did there) data for we have the ability to run this via the terminal / CLI only or via a browser for more visualisation. Different to the other platforms though is how we authenticate with the Veeam API, with Kubernetes we are using the Kubeconfig, for AWS we are using the CLI/SDK and same for Microsoft Azure. With Veeam we need a few more details, we need the IP address of the Veeam Backup & Replication server and we need to provide a username and password.
We can do this via the CLI in a few ways, firstly we can use environment variables.
case "veeam":
// Load environment variables for Veeam
if *baseURL == "" {
*baseURL = os.Getenv("VBR_SERVER_URL")
}
if *baseURL == "" {
serverAddress := promptUser("Enter VBR Server IP or DNS name: ")
*baseURL = fmt.Sprintf("https://%s:9419", serverAddress)
}
if *username == "" {
*username = getEnv("VBR_USERNAME", "Enter VBR Username: ")
}
if *password == "" {
*password = getSensitiveInput("Enter VBR Password: ")
}
You can set these variables like so
Linux ```export VBR_SERVER_URL="https://<VBR_Server>:9419/api/v1"export VBR_USERNAME="your_username"export VBR_PASSWORD="your_password"```Windows Command Line ```set VBR_SERVER_URL=https://<VBR_Server>:9419set VBR_USERNAME=your_usernameset VBR_PASSWORD=your_password```Windows PowerShell ```$env:VBR_SERVER_URL="https://<VBR_Server>:9419"$env:VBR_USERNAME="your_username"$env:VBR_PASSWORD="your_password"```
The second option is to factor everything into the command line with something like
./kollect --inventory veeam --veeam-url https://192.168.169.185:9419 --veeam-username administrator --veeam-password 123456 --browser
This would then if available auto start a browser at your localhost address and give you the visual
The third way to get the same experience is with part of the above command
./kollect --inventory veeam --browser
This approach will then prompt you to provide the IP, Username and Password (whilst hiding the password from the password from the terminal and history)
You will also see from the above that we did not specify the --browser flag and we got an output in the terminal in JSON format. You will get this output in the terminal either way using the browser flag or not. There is also an output flag to export this JSON to file.
The final easter egg and progress was to try and make things more visually appealing so although not in the main branch of the code there is a branch called “veeam-charts” if you want to have a play.
If you scroll down to the bottom of the Veeam Inventory browser page you will see an output of your Backup Jobs, Scale Out Backup Repositories and Credentials.
I also added a little video demo so you can see things happening and how it worked on my machine
If you made it this far… I have an ask… I would love to see how many home lab vbr servers we can gather information on or even non sensitive VBR servers, I want to know what else we need to see here and if the API supports it we can add it.
Also, please give feedback it is just a learning project so it would be helping me on that journey.