Setting Up Grafana With Azure Service Bus

December 18, 2022

Like many places, at Magpie, we use a message broker to manage the communication between different parts of the system. The visualisation of this in Azure Service Bus is actually quite good, but we use Grafana for other monitoring, so thought it might be an idea to use it to monitor ASB, too.

Azure

In order to use Grafana with ASB, or any Azure service, you’ll need a Grafana instance (this post doesn’t cover setting that up). Once you have one, you need to register it in Azure Active Directory:

Grafana Active Directory

Once that’s done, inside the registered app, you’ll need to configure a secret:

Set-up Secret

Remember that, contrary to what common sense may tell you, the thing you want from this secret is the Value and not, as you may think, the Secret ID. Also, bear in mind that you can only view and copy this value until you leave this screen; after that, if you don’t have it, it’s lost.

The next step is that you need to grant access to the app registration from the subscription that you want it to access. That is, the subscription that the ASB instance resides in:

Grant Access from the Subscription

It only needs read access. You should be able to select the App Registration as a principal to grant the access to:

Add Grafana User

That should be all that’s needed from the Azure side, there’s a couple of things on the Grafana side.

Grafana

The first step is to add a data source:

Add Data Source

Once you’ve given the secret that you’ve created, select Load Subscriptions and your subscription should be available.

Plug-ins

Azure Service Bus doesn’t have a monitor out of the box, and so you’ll need a plug-in:

This should give you a plug-in ID that you can import directly into Grafana.

This should give you a screen that allows you to select the subscription, resource group, and resource. You may wish to play around with the variables, so that they are fixed, or at least restricted.



Profile picture

A blog about one man's journey through code… and some pictures of the Peak District
Twitter

© Paul Michaels 2024