Monitor Azure Service Bus using PowerShell Universal Dashboard
I recently came across a Tool from Poshtools called PowerShell Universal Dashboard. This tool allows you to periodically monitor anything from CPU usage to monitoring Azure namespaces which can then be rendered on various graphs.
The tool is built on PowerShell Core using kestrel and Chart.js which enables you to deploy your dashboards wherever you want from Windows to Linux.
I am going to show how simple it is to start using the Universal Dashboard for monitoring and in this example will focus on monitoring the queues on the Azure service bus namespace.
Installing the module
Open up PowerShell in admin mode and run:
Install-Module UniversalDashboard
To get a complete list of commands from this module.
get-command -module UniversalDashboard
I have already setup my azure service bus namespace with some topics and queues. I have also filled up the topic subscriptions and queues with some dummy data.
Before we continue creating our dashboard, lets first login to Azure via PowerShell.
Login-AzureRmAccount
If you have more than one subscription, make sure you are using the correct one by setting the azure context.
Set-AzureRmContext -SubscriptionName <subscription_name>
The Script
Below is the script I used to build my dashboard which will display the following information:
- The active message count for the queue
- The rate at which messages are being processed from the queue
Let’s start the dashboard:
Start-UDDashboard -Port 1000 -Dashboard $AzureDashboard
Go to http://localhost:1000/ in your browser to see your dashboard
To view the current state of all of your dashboards
Get-UDDashboardName Port Running
---- ---- -------
Dashboard8 1000 True
To stop the dashboard:
Get-UDDashboard | Stop-UDDashboard
Head over to this documentation to learn more about the various charts and formatting you could use for your dashboard.
Please Note:
When you first install Universal Dashboard it comes with a free trial license for PoshTools. If you feel this is a worthwhile investment for your team a license which costs roughly £74 per server and includes free updates for a year!