cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

How do I format a DQL Query into Adaptive Cards properly - Workflows

From a high-level point of view, I need a workflow which grabs a DQL query of disk free as a percentage and then sends that as a Teams message. 

This is what I have as my first flow (the DQL query)

 

 

timeseries percent = avg(dt.host.disk.used.percent), by: { dt.entity.host, dt.entity.disk }, filter: { in(dt.entity.host, classicEntitySelector("type(host),tag(\"Business Unit:FINANCE_DEPT\")")) }
| fields util = arrayAvg(percent), entityName(dt.entity.host)

 

 

 

It will then output this in a raw JSON format with the function get_disk_stats_title.records

 

 

 

[{"util":37.81379436933137,"dt.entity.host.name":"exampleserver_1"},{"util":0.48663042982483673,"dt.entity.host.name":"WNCDKS01.corp.net"},{"util":49.254119519423064,"dt.entity.host.name":"WNBX103.corp.net"},{"util":37.62645628433896,"dt.entity.host.name":"exampleserver_4"},{"util":69.18935581114691,"dt.entity.host.name":"exampleserver_5"},{"util":71.16928194761574,"dt.entity.host.name":"exampleserver_6"},{"util":40.62837394704024,"dt.entity.host.name":"exampleserver_7"}]

 

 

Im trying to use the adaptive cards but not sure how to format it to generate a human-readable card? 

2 REPLIES 2

educampver
Dynatrace Advisor
Dynatrace Advisor

Hi @badgerfifteen, I'm not sure I fully understand you question, but I guess it's about how to use the AdaptiveCards SDK in Workflows, is that right? If so, you can load it from a JavaScript CDN like esm.sh:

import * as AdaptiveCards from 'https://esm.sh/adaptivecards@3.0.4';

export default async function ({ execution_id }) {
  const adaptiveCard = new AdaptiveCards.AdaptiveCard();
  // ...
}

You just have to make sure that esm.sh is allow-listed from your tenant.

PennyScully
Dynatrace Helper
Dynatrace Helper

Hi @badgerfifteen 

I hope the solution above solution worked for you, if so, please 'accept as solution', to help us close this community question.

Thanks, Penny 

Featured Posts