Monitor message queues

netrabbitmqscomvbscript

I'm looking for a simple way to monitor RabbitMQ queues from SCOM. In particular, I want to be notified when a particular queue (one we use for "dead letters") is not empty.

RabbitMQ has a RESTful web API (the RabbitMQ Management HTTP API) that will return the desired data; it only supports JSON. I've already wrapped the call to that in a .NET library. I've written a PowerShell script to interface between that and SCOM, but our network administrator can't get it to work. He'd prefer a VBScript solution.

I can expose the .NET library to COM and call that from VBScript. This seems absurdly complex. Is there a simpler way?

Best Answer

Any reason your network administrator doesn't just call your powershell script from a VBScript? I know it doesn't help the absurd complexity, but it might be the easiest solution. Tell him to write a custom monitor containing this simple piece of vbs:

Set objShell = CreateObject("WScript.Shell")
strPoSHCmd = "powershell.exe -noprofile -command C:\path\to\script.ps1"
objShell.Run strPoSHCmd

Edit the C:\path\to\script.ps1 to suit your needs. You could also have the vbscript returning the values from PowerShell (supposing your PS script returns a value), to SCOM, by creating a MOM.ScriptAPI propertyBag, like this:

Set oAPI = CreateObject("MOM.ScriptAPI")
Set oBag = oAPI.CreatePropertyBag()

Set objShell = CreateObject("WScript.Shell")
strPoSHCmd = "powershell.exe -noprofile -command C:\path\to\script.ps1"
PSReturn = objShell.Run strPoSHCmd

Call oBag.AddValue("Output",PSReturn)
Call oAPI.Return(oBag)
Related Topic