I’m new with SQLWatch, and I already managed to install it on 3 different servers (Prod/test/dev) and also got the central repository working, looks really amazing the information I’m getting in the PowerBi report.
But now i’m trying to setup the notifications to MS Team, and I followed the guidelines in the Blog, every seems to be installed correctly. but i’m not receiving any messages in Team Channel.
The test message is working, and also in the [sqlwatch_logger_check_action] table are records that a message with the correct action_id should be send. what am I doing wrong or have I forgotten?
So this is the response from the Teams server. This tells me that the notifications work as such, you have just perhaps misconfigured something on the Teams side, or the notification action is passing wrong parameters.
the queue table holds the actual executable, you can copy it and run in PowerShell to debug.
If I run what is in the column “action_exec” it is just giving me a message in Teams!
so that is also working, it looks like the sction_id is not executed, while the check_action is configured correctly as far as I can see…
I tired the things above, and what i found:
Wwen run in PowerShell or test sql agent job the [dbo].[sqlwatch_meta_action_queue]action_exec is does not work. Receiving an error: Unexpected token ‘Invoke-RestMethod’ in expression or statement.
When I run in same environment the [dbo].[sqlwatch_config_action]action_exec. evrything works and receiving test messages from and test sql agent and PowerShell
For example, the difference is, yours starts with {"text": but the one in my post with "@context": When I run your piece of code I get Invoke-RestMethod : Bad payload received by generic incoming webhook. which is Teams server telling me it does not understand what the payload means
When I use the below template, everything works ok:
Great it works now! I did install your card but did not change the {text, etc etc} to {body}.
last question, do I need to do this for each instance of my servers?
Yeah you do but the easiest way is to use Central Management Server (CMS) or PowerShell “invoke-sqlcmd” to run the same query on a bunch of servers at the same time.