Hi everyone,I’m looking for guidance on how to create a custom metric in Dynatrace with DQL query and then use the result to send a notification/post to Microsoft Teams
If you have examples, best practices, or links to relevant documentation, I’d really appreciate it.Thanks in advance!
Mardock
Hi,
I think that you can’t directly “push” the result of a DQL query to Microsoft Teams, but There are two supported ways to achieve this in Dynatrace, depending on whether you really need a stored custom metric or just want to use DQL results to post to Teams.
If your DQL is based on logs, create a log metric using DQL matchers, then alert on that metric using Metric events, and finally send the notification to Microsoft Teams.
1. Settings → Log Monitoring → Metrics extraction → Add log metric). This uses a DQL-based matcher
2. Create alerting using Metric events Metric events — Dynatrace Docs
3. Send to Teams using webhook.
On the other hand, ifyour goal is simply “run a DQL query and post the result to Teams”, you can do it directly with Workflows. Use Workflows action: Execute DQL Query to run your query and get results for subsequent steps
and add Microsoft Teams Connector → Send message and format the message Microsoft Teams Connector — Dynatrace Docs