MSP360 / Cloudberry to Hudu

Update 27/02/2021

Hudu have updated their API with some better filtering options. They have also updated their Asset creation API with breaking changes. If you install/update Hudu after 26th of Feb you need to use version 1.11 of the powershell module or above. If you are using a version prior to that you will need to use version 1.10.

The main change is you now need to provide fields to an asset as:

“field_name”: “value”

Where field name is the asset layout field name in lower case with spaces converted to _

In the prior version you needed to provide

“asset_layout_field_id”: 1

“value”: “value”

I have updated my script in Github with the changes to work with the latest version. This version is much faster.

Original Article

This weekend I was planning on playing some more Dyson sphere Project but as I was having as much fun writing my last script I decided to write another integration instead. Its a pretty similar set of skills anyway 🙂

Before I dive into rewriting other people’s pre-existing to IT Glue scripts I thought I would write something for something I have not seen integrated into a documentation system before. I chose to integrate MSP360 / Cloudberry backup reports into Hudu. I also realised that while implementing this I could give examples of:

  1. Creating a new Asset Layout
  2. Creating and Updating Assets
  3. Another Magic Dash example
  4. Creating and Updating Articles

To do this I have updated my powershell module so it is getting more fleshed out now. Main things still to add are remove- commands and password interaction.

I have also been talking to the developers who are saying there should be a release with a lot of updates to the API out this week. I decided to code this example with these fixes in mind, so it runs a little slow at the moment, but will run a lot quicker once the update is out and I can update the module to make use of the changes.

What it does

The first thing the script does is to create a new Asset Layout to use for storing information on the backup plans.

Next it pulls out jobs from MSP360 using their Powershell module. It then loops through these and adds them as Assets into Hudu. You can choose with a setting whether to keep an asset per job or an asset for each run of a job. If you run it multiple times between jobs, it will just update the existing asset. If the job has a detailed file list it will download that and embed it into the asset as well. (See note below on fields on the grid display)

It will then parse all the jobs fetched per customer and generate a Magic Dash for backups showing how many failed:

If you click open it will give you a list of the current jobs MSP360 is reporting, the Job name is a link to the asset that was created for the job:

If there are failed jobs it will look like this:

The last thing the script then does is to create an Article with a backup report across all customers in your Global KB. You can select which folder you would like it in or disable this.

Here the Plan Name links to the Asset, the Company name links to the company name in Hudu and the Computer name will like to an asset that matches the computer name from the backup job.

Things to Note

At the moment it is quite slow as I am waiting on Hudu to release some API optimisations shortly. It will be much quicker when these are out and I will update this document. I wrote it in a way to take advantage of these as it is more accurate how things will work in the future. (Multiple calls to Get-HuduAssets, instead of just grabbing them all once and searching locally)

Currently there is no way to set Asset Layout fields to be shown in the grid view. You will need to manually edit these settings in each field you would like displayed after it has been created. You need to tick the “Show in list” option in the Asset Layout settings in the admin page.

The script can only see the current state of a job, so when it runs if a job is still running it will not update its asset if a new MSP360 run has started since the sync. I have built the script so you can run it as often as you like without creating duplicates (In theory).

Mapping is done based on company name in Hudu and company name in MSP360. It will alert you if a company is not found. This can be fixed by renaming the company in MSP360 as it is very easy to do there.

How To

If you have previously installed my HuduAPI powershell module you will need to update it with:

Update-Module HuduAPI

You will then need to get API details for MSP 360 from https://mspbackups.com/AP/Settings.aspx

Set these keys at the start and also enter your Hudu API details

The HuduAssetLayoutName lets you pick what you want the Asset Layout to be called. This is what appears in the menu on the left when you look at a company.

createGlobalReport sets whether you would like the article with details across all customers to be created in your global KB.

globalReportName is the name of the article that will be created.

folderID is the folder in yout global KB you would like the report created. If you browse to the folder in your Hudu instance and open it, then check the address bar the ID is in the URL

createJobsWithHistory this determines if you want the script to create a new asset for every last run time it sees, or if you would like it to just update a single asset for each job, with the details from the latest run. This essentially just sets if you want the last run time appended to the asset name or not.

createMagicDash sets if you want to create a magic dash icon in each customer or not.

You can get the script from here: https://github.com/lwhitelock/HuduAutomation/blob/main/MSP360_To_Hudu.ps1

Let me know by logging a github issue if you run into any problems and I will do my best to help.

You may also like...