EventHub Monitoring

A few weeks ago I did a presentation at the Australia/New Zealand User Group meeting on the Gold Coast to really discuss that the M3 Grid Applications shouldn’t be as intimating as a lot of people find them, as part of the presentation, I also touched on monitoring. One of the points I had raised was monitoring Event Hub, some of you may have had the misfortune of seeing what happens when a subscriber can’t connect and we have a large number of events get queued (for example, through a mass change or through data loads) – and have had fun trying to recover when you run out of disk space.

One of the questions that came out after this was around the monitoring of Event Hub and how to check its health and the queues. At the time I wasn’t 100% sure on how it could be done from the grid. We can of-course monitor disk space and there is a /persistent directory on the file system that we can monitor but it’s a little clunky.

I’ve had a look and the good news is that there appears to be a Rest API from at least 2.1.9 which provides us with the information that we need in a json format.

Taking a look at the call itself and what gets returned and it looks very promising.

And let us explore this a little with Powershell.

PS C:\Users\Scott> $response = Invoke-RestMethod -Uri https://ifbenp.indfish.co.nz:16202/EventHubApi/info/pubsubs

PS C:\Users\Scott> $response

publishers subscribers

———- ———–

@{isConnected=true; isPaging=false; name=M3; lastSeen=Jun 3, 2017 6:06:30 AM; totalQueued=0} {@{isConnected=true; isPaging=false; hasSubscriptions=true; name=CMS910; totalQueued=0; lastSeen=Jun 3, 2017 12…

And the subscribers…

We can do a little more investigation and we can retrieve specific properties – for example, name and isConnected and totalQueued which provide us with properties we can monitor and then alert on.

We can write a little powershell script to check the subscriptions, if they are connected and if we are queuing up requests that aren’t being emptied. Some of my other powershell scripts demonstrate how to do email notifications and there are plenty of examples out there on the internet.

Equally, it should be pretty straight forward to use other languages to monitor these queues so you can use them with whichever monitoring tool you use in your organisation.

Have fun!

This entry was posted in M3 / MoveX, Monitoring. Bookmark the permalink.

3 Responses to EventHub Monitoring

  1. sanyukta2017 says:

    Ho do we add a publisher to event hub. The customer has a newly set environment and ‘M3’ publisher seems to be disconnected.

    Please let me know if you have any idea about it.
    Thank you.

    • potatoit says:

      Was the Event Hub integration turned on on the M3BE?

      If you look at the M3COREAG “How to enable Event Hub integration”

      You need to set the appropriate M3BE property to 1

      Also, you need to make sure that the autojobs have been created and are running.


      • sanyukta2017 says:

        Hey Scott,

        The solution worked perfectly. M3BE property was previously set to 0. I changed it to 1.
        Can you please tell me how do we create a new publisher?
        Many Thanks,

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s