Saturday, May 6, 2017

Trending ShareFile Downloads with PowerShell and PRTG


I’d like to trend the amount of time it takes to download a file from my on premise storage zones vs the amount of time it takes to download a file from ShareFile’s public cloud.  So here’s the plan, I’m going to create some shared folders on each of the storage zones I want to trend…

I’ll create a shared folder on ShareFile’s “US East” zone…
image

I’ll create a shared folder on my customer managed storage zone…
image

Notice in the screenshots above I’m disabling any retention policies.

I’ll upload the same file to each shared folder I created…

ShareFile US East

image

Storage Zone 1
image

Next, I’m going to grab the freeware version of PRTG and install it.  The installation is pretty straight forward… https://www.paessler.com

Then I’m going to download and install the ShareFile PowerShell Snapin from Github…https://github.com/citrix/ShareFile-PowerShell/releases

You need the x86 version.  At the time of this post, version 1.82 has an x86 and x64 version.  I usually install both but x86 is required for integration with PRTG.

Open PowerShell x86 and set the execution policy to unrestricted (make sure you “run as administrator”).  The execution policy modification is needed for PRTG.  I did not test with other execution policies.
image

I’m going to use a ShareFile “service account” and generate a .sfps file using the New-SfClient command as documented in the ShareFile PowerShell SDK wiki found here… https://github.com/citrix/ShareFile-PowerShell/wiki/Getting-Started; It’s a simple process so I’m not going to include it in this post.  I’m also using a bit of the code from one of the sample scripts.

Now, I’ll write a PowerShell script which times the downloads of the files from each zone.  I’m going to execute the script using PRTG which will record and chart the script output. 

I’m going to need a place to temporarily store files the script downloads so I’ll create a temp directory structure.  I created a couple directories D:\temp\ShareFile_US_East and D:\temp\Storage_Zone_1.

I’m also giving the folders a name similar to the name of the zone.  This is important because I’ll be using this in the script for the PRTG channel label.
image
Here’s the PowerShell Script

I’ll put the script on the PRTG server in the following directory (this may vary on your system): C:\Program Files (x86)\PRTG Network Monitor\Custom Sensors\EXEXML

Open the PRTG Enterprise Console…
image

Create a group…
image

Create a device in the group…
image

Add an EXE/Script Advanced sensor to the device
image

Set the sensor settings – define EXE/Script, timeout, scanning interval
image

And that’s it.  You should start seeing data in the PRTG console.

Here’s an example of some download times for a standard customer managed storage zone versus a ShareFile cloud managed storage zone.  This actually shows a trend with higher than expected download times for the standard storage zone.  Adjustments were made and you can see the download times decrease.

image

No comments:

Post a Comment