Liquidware Stratusphere UX is a great monitoring tool to monitor your environment and do an deep dive of your environment performance. It can monitor on-prem, hybrid or cloud environments and Liquidware is a partner to Microsoft upcoming WVD (Windows Virtual Desktop) platform. To see how to setup Stratusphere UX you can check a previous blog of me here. Of course, monitoring the performance is great and being notified and getting reports is essential. But what if you want automated actions? For instance, what if WVD automatically adds a new host to the pool when user performance is degrading? Well, to do this you have to of course write a script. And one of the best ways of doing that is using PowerShell. So in this blog I will show you how to get information out of Stratusphere UX and in to PowerShell.
Luckely Liquidware Stratusphere UX has made it really simple to use their API. Because it comes with a build in API Builder. To get started we first need to set the access to the API. Sign in to the Stratusphere UX Administration console (FQDN of the HUB) and click on Hub Administration Configuration. Then unfold Other Settings. At API Client IPs enter the IP address from which you want to run your script.
*Be aware that this IP address can now access the data and API without a password. You can also configure a user account to access the API and use authentication.
Now that the API is enabled you can go to the web browser and go to https://<HUB-FQDN>/apibuilder/ . The API builder helps you to easily create the correct query’s and get the correct data.
So, let’s start with something easy. I want to see the last time machines connected to the hub. On the main screen in the Inspector drop down menu I select Inventory Inspector and by basis I select Machines (Follow Date).
Now I go to the columns tab and select Machine Last Contact and Machine Name.
On the Date tab I set the Range to today.
Now you can see a few really cool things happen. First, every action you click will automatically have preview data.
And on the right side you can see your query being built in real time in JSON. And you see the API URL this is the complete URL you can use to get this data.
So, this is of course really cool but I want to have this data in PowerShell. I have written a small script for this.
This script will let you get the API data into a PowerShell object. All you need to do is fill in your HUB FQDN and copy/paste the JSON query generated by the API in to the JSON parameter. Here you see the query we just generated run against my HUB.
And as you can see, I got the same output. The output is saved in the $result parameter so now you can extend the script and query the $result parameter.
In the beginning of the blog I wrote that a query which would show the user performance on the machines would be handy because this lets you create a script that can automatically scale a cloud/ WVD environment. Let’s create the query. First, we go back to the API builder and select the Main tab, at the Inspector select Summary Inspector and at Basis select Machines.
At the columns tab select Machine Name and UX Score.
Finally go to the Date tab and we select 30 minutes because we want to see the most recent data only. Now we copy the Query data.
Paste it in the PowerShell script in the $json parameter and run the script.
As you can see, I now get the UX rating from my machines (only have one in the lab).
Of course, I can now create an IF statement that can check if the performance has drop down to for example a B and then perform an action. Because with PowerShell the possibilities are endless. I hope this blog helps you with automating actions based on queries.
I hope this was informative. For questions or comments you can always give a reaction in the comment section or contact me: