<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: DQL for Anomaly Detector to compare multiple metrics and trigger alert in DQL</title>
    <link>https://community.dynatrace.com/t5/DQL/DQL-for-Anomaly-Detector-to-compare-multiple-metrics-and-trigger/m-p/278258#M2139</link>
    <description>&lt;P&gt;Thank you for the tip&amp;nbsp;&lt;a href="https://community.dynatrace.com/t5/user/viewprofilepage/user-id/19769"&gt;@marco_irmer&lt;/a&gt;&amp;nbsp;, that helped&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 28 May 2025 22:01:27 GMT</pubDate>
    <dc:creator>p_devulapalli</dc:creator>
    <dc:date>2025-05-28T22:01:27Z</dc:date>
    <item>
      <title>DQL for Anomaly Detector to compare multiple metrics and trigger alert</title>
      <link>https://community.dynatrace.com/t5/DQL/DQL-for-Anomaly-Detector-to-compare-multiple-metrics-and-trigger/m-p/278149#M2135</link>
      <description>&lt;P&gt;I am trying to trigger an alert using anomaly detector by looking at multiple metrics . As an example when&amp;nbsp;dt.host.disk.avail is less than 100GB and&amp;nbsp;dt.host.disk.free is less than 10%&amp;nbsp; . Both the condition should match to trigger a alert . I know &lt;SPAN&gt;anomaly detectors only support single metric, so&amp;nbsp; idea was to include a condition and set the threshold based on the condition value . Below is an example DQL&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;timeseries { availableDiskSpace = avg(dt.host.disk.avail),
diskUsed = avg(dt.host.disk.used),
diskFreePercent = avg(dt.host.disk.free)
},
by: { dt.entity.host, dt.entity.disk }, interval: 1m,

filter: { matchesValue(entityAttr(dt.entity.host, "entity.name"), { "HOST16"}) AND matchesValue(entityAttr(dt.entity.disk, "entity.name"), "X:\\") }

| fieldsAdd condition = if(arrayAvg(diskFreePercent) &amp;lt; 10 AND arrayAvg(availableDiskSpace) &amp;lt; 29770882367488, 1, else: 0)
| fieldsRemove availableDiskSpace, diskUsed, diskFreePercent&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;But the output is not really in a timeseries format so&amp;nbsp;&lt;SPAN&gt;anomaly detector does not accept .&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;I am looking for some ideas on how to best modify the DQL to suite my use case please&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 28 May 2025 02:38:41 GMT</pubDate>
      <guid>https://community.dynatrace.com/t5/DQL/DQL-for-Anomaly-Detector-to-compare-multiple-metrics-and-trigger/m-p/278149#M2135</guid>
      <dc:creator>p_devulapalli</dc:creator>
      <dc:date>2025-05-28T02:38:41Z</dc:date>
    </item>
    <item>
      <title>Re: DQL for Anomaly Detector to compare multiple metrics and trigger alert</title>
      <link>https://community.dynatrace.com/t5/DQL/DQL-for-Anomaly-Detector-to-compare-multiple-metrics-and-trigger/m-p/278216#M2138</link>
      <description>&lt;P&gt;You can use an &lt;A href="https://docs.dynatrace.com/docs/discover-dynatrace/references/dynatrace-query-language/operators#iterative-expressions" target="_self"&gt;iterative expression&lt;/A&gt;, which uses square bracket notation ('[]'), to form a new timeseries array using conditional logic. The expression will iterate through each datapoint in the 'diskFreePercent' and 'availableDiskSpace' arrays and apply the logic to calculate whether the value of 'condition' should be 0 or 1 at each position. You can then use the 'condition' field in your anomaly detector.&lt;/P&gt;&lt;P&gt;The DQL would look something like this:&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;timeseries { availableDiskSpace = avg(dt.host.disk.avail),
diskUsed = avg(dt.host.disk.used),
diskFreePercent = avg(dt.host.disk.free)
},
by: { dt.entity.host, dt.entity.disk }, interval: 1m,

filter: { matchesValue(entityAttr(dt.entity.host, "entity.name"), { "HOST16"}) AND matchesValue(entityAttr(dt.entity.disk, "entity.name"), "X:\\") }

| fieldsAdd condition[] = if(diskFreePercent[] &amp;lt; 10 AND availableDiskSpace[] &amp;lt; 29770882367488, 1, else: 0)
| fieldsRemove availableDiskSpace, diskUsed, diskFreePercent&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;I hope this helps &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 28 May 2025 12:40:46 GMT</pubDate>
      <guid>https://community.dynatrace.com/t5/DQL/DQL-for-Anomaly-Detector-to-compare-multiple-metrics-and-trigger/m-p/278216#M2138</guid>
      <dc:creator>marco_irmer</dc:creator>
      <dc:date>2025-05-28T12:40:46Z</dc:date>
    </item>
    <item>
      <title>Re: DQL for Anomaly Detector to compare multiple metrics and trigger alert</title>
      <link>https://community.dynatrace.com/t5/DQL/DQL-for-Anomaly-Detector-to-compare-multiple-metrics-and-trigger/m-p/278258#M2139</link>
      <description>&lt;P&gt;Thank you for the tip&amp;nbsp;&lt;a href="https://community.dynatrace.com/t5/user/viewprofilepage/user-id/19769"&gt;@marco_irmer&lt;/a&gt;&amp;nbsp;, that helped&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 28 May 2025 22:01:27 GMT</pubDate>
      <guid>https://community.dynatrace.com/t5/DQL/DQL-for-Anomaly-Detector-to-compare-multiple-metrics-and-trigger/m-p/278258#M2139</guid>
      <dc:creator>p_devulapalli</dc:creator>
      <dc:date>2025-05-28T22:01:27Z</dc:date>
    </item>
    <item>
      <title>Re: DQL for Anomaly Detector to compare multiple metrics and trigger alert</title>
      <link>https://community.dynatrace.com/t5/DQL/DQL-for-Anomaly-Detector-to-compare-multiple-metrics-and-trigger/m-p/282229#M2371</link>
      <description>&lt;P&gt;is timeseries all on one line, would be kind to tidyup the format?&lt;/P&gt;</description>
      <pubDate>Thu, 24 Jul 2025 11:57:22 GMT</pubDate>
      <guid>https://community.dynatrace.com/t5/DQL/DQL-for-Anomaly-Detector-to-compare-multiple-metrics-and-trigger/m-p/282229#M2371</guid>
      <dc:creator>MarwanC</dc:creator>
      <dc:date>2025-07-24T11:57:22Z</dc:date>
    </item>
  </channel>
</rss>

