<?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: How to calculate availibility score with timeseries? in DQL</title>
    <link>https://community.dynatrace.com/t5/DQL/How-to-calculate-availibility-score-with-timeseries/m-p/250722#M1051</link>
    <description>&lt;P&gt;Thanks!&lt;/P&gt;&lt;P&gt;How can I also include "No Data" as "Failed" in the score?&lt;/P&gt;</description>
    <pubDate>Tue, 16 Jul 2024 08:27:37 GMT</pubDate>
    <dc:creator>jegron</dc:creator>
    <dc:date>2024-07-16T08:27:37Z</dc:date>
    <item>
      <title>How to calculate availibility score with timeseries?</title>
      <link>https://community.dynatrace.com/t5/DQL/How-to-calculate-availibility-score-with-timeseries/m-p/250639#M1047</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I would like to calculate availability for Database :&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="jegron_0-1721045906194.png" style="width: 668px;"&gt;&lt;img src="https://community.dynatrace.com/t5/image/serverpage/image-id/21164iC50AE22D0F569A8E/image-dimensions/668x412?v=v2" width="668" height="412" role="button" title="jegron_0-1721045906194.png" alt="jegron_0-1721045906194.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;It must be shown in the ratio when there is no data or Offline Database :&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="jegron_2-1721047995458.png" style="width: 787px;"&gt;&lt;img src="https://community.dynatrace.com/t5/image/serverpage/image-id/21166i0BA56D16378DE8A2/image-dimensions/787x437?v=v2" width="787" height="437" role="button" title="jegron_2-1721047995458.png" alt="jegron_2-1721047995458.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;How can I do it with DQL?&lt;/P&gt;&lt;P&gt;Julien&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 15 Jul 2024 13:19:53 GMT</pubDate>
      <guid>https://community.dynatrace.com/t5/DQL/How-to-calculate-availibility-score-with-timeseries/m-p/250639#M1047</guid>
      <dc:creator>jegron</dc:creator>
      <dc:date>2024-07-15T13:19:53Z</dc:date>
    </item>
    <item>
      <title>Re: How to calculate availibility score with timeseries?</title>
      <link>https://community.dynatrace.com/t5/DQL/How-to-calculate-availibility-score-with-timeseries/m-p/250666#M1048</link>
      <description>&lt;P&gt;If I understand correctly the logic of this metric:&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;there is 0 (value) in interval for a specific database and state when database is in this state&lt;/LI&gt;&lt;LI&gt;there is nothing (visible as null in timeseries)&amp;nbsp;for a specific database and state when database is in another state or is not monitored&amp;nbsp;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;using 0 makes it difficult to use metric value directly, but fortunately we have &lt;EM&gt;&lt;STRONG&gt;rollup:total&lt;/STRONG&gt;&lt;/EM&gt; (formerly known as rollup:count) which will have value of contributions or nothing when metric was not reported.&lt;BR /&gt;&lt;BR /&gt;If we define availability as a % of moments when database was online vs. moments when it was in any state, this query should do the job:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;timeseries state = sum(`sql-server.databases.state`, rollup: total), by: { database.state, database }, filter: database.state=="ONLINE"
| lookup [
  timeseries state_all = sum(`sql-server.databases.state`, rollup: total), by: { database.state, database }
], sourceField:database, lookupField:database, fields:{state_all}
| fields interval, timeframe, database, availability=100*state[]/state_all[]&lt;/LI-CODE&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="krzysztof_hoja_0-1721072218123.png" style="width: 864px;"&gt;&lt;img src="https://community.dynatrace.com/t5/image/serverpage/image-id/21173i38475DBFDA79E746/image-dimensions/864x447?v=v2" width="864" height="447" role="button" title="krzysztof_hoja_0-1721072218123.png" alt="krzysztof_hoja_0-1721072218123.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;I also assumed that for intervals with no state, we should have no data on the chart (or null in timeseries)&lt;/P&gt;&lt;P&gt;Kris&lt;/P&gt;</description>
      <pubDate>Mon, 15 Jul 2024 19:38:56 GMT</pubDate>
      <guid>https://community.dynatrace.com/t5/DQL/How-to-calculate-availibility-score-with-timeseries/m-p/250666#M1048</guid>
      <dc:creator>krzysztof_hoja</dc:creator>
      <dc:date>2024-07-15T19:38:56Z</dc:date>
    </item>
    <item>
      <title>Re: How to calculate availibility score with timeseries?</title>
      <link>https://community.dynatrace.com/t5/DQL/How-to-calculate-availibility-score-with-timeseries/m-p/250722#M1051</link>
      <description>&lt;P&gt;Thanks!&lt;/P&gt;&lt;P&gt;How can I also include "No Data" as "Failed" in the score?&lt;/P&gt;</description>
      <pubDate>Tue, 16 Jul 2024 08:27:37 GMT</pubDate>
      <guid>https://community.dynatrace.com/t5/DQL/How-to-calculate-availibility-score-with-timeseries/m-p/250722#M1051</guid>
      <dc:creator>jegron</dc:creator>
      <dc:date>2024-07-16T08:27:37Z</dc:date>
    </item>
    <item>
      <title>Re: How to calculate availibility score with timeseries?</title>
      <link>https://community.dynatrace.com/t5/DQL/How-to-calculate-availibility-score-with-timeseries/m-p/250790#M1054</link>
      <description>&lt;P&gt;Yes. &lt;EM&gt;&lt;STRONG&gt;default:&lt;/STRONG&gt;&lt;/EM&gt; parameter is helpful here.&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;timeseries state = sum(`sql-server.databases.state`, rollup: total, default:0), by: { database.state, database }, filter: database.state=="ONLINE"
| lookup [
  timeseries state_all = sum(`sql-server.databases.state`, rollup: total, default:1), by: { database.state, database }
], sourceField:database, lookupField:database, fields:{state_all}
| fields interval, timeframe, database, availability=100*state[]/state_all[]&lt;/LI-CODE&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="krzysztof_hoja_0-1721143258371.png" style="width: 850px;"&gt;&lt;img src="https://community.dynatrace.com/t5/image/serverpage/image-id/21187i34A9ECD829850A6F/image-dimensions/850x440?v=v2" width="850" height="440" role="button" title="krzysztof_hoja_0-1721143258371.png" alt="krzysztof_hoja_0-1721143258371.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 16 Jul 2024 15:21:25 GMT</pubDate>
      <guid>https://community.dynatrace.com/t5/DQL/How-to-calculate-availibility-score-with-timeseries/m-p/250790#M1054</guid>
      <dc:creator>krzysztof_hoja</dc:creator>
      <dc:date>2024-07-16T15:21:25Z</dc:date>
    </item>
    <item>
      <title>Re: How to calculate availibility score with timeseries?</title>
      <link>https://community.dynatrace.com/t5/DQL/How-to-calculate-availibility-score-with-timeseries/m-p/250935#M1066</link>
      <description>&lt;P&gt;Thanks !&amp;nbsp;&lt;span class="lia-unicode-emoji" title=":clapping_hands:"&gt;👏&lt;/span&gt;&lt;span class="lia-unicode-emoji" title=":ok_hand:"&gt;👌&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 18 Jul 2024 06:57:32 GMT</pubDate>
      <guid>https://community.dynatrace.com/t5/DQL/How-to-calculate-availibility-score-with-timeseries/m-p/250935#M1066</guid>
      <dc:creator>jegron</dc:creator>
      <dc:date>2024-07-18T06:57:32Z</dc:date>
    </item>
  </channel>
</rss>

