<?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 Relative time search and plotting in a timechart in All Apps and Add-ons</title>
    <link>https://community.splunk.com/t5/All-Apps-and-Add-ons/Relative-time-search-and-plotting-in-a-timechart/m-p/376487#M45682</link>
    <description>&lt;P&gt;I currently have a search query to calculate the maximum, average and median CPU usage of a server over the past 2 hours using NMON data models, which is in real-time.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| tstats `CPU_ALL(max)` from datamodel=NMON_Data_CPU where (nodename = CPU.CPU_ALL) (host=myhost) (CPU.frameID="*") (CPU.OStype="*") `No_Filter(CPU)` groupby _time, host prestats=true span=1m
| stats dedup_splitvals=t max("CPU.cpu_PCT") AS CPU.cpu_PCT by _time, host
| fields *
| sort +str(host)
| stats max("CPU.cpu_PCT") AS max, avg("CPU.cpu_PCT") AS avg, median("CPU.cpu_PCT") AS median by host 
| eval max=round(max,2) | eval avg=round(avg,2)
| rename max as "Max (%)", avg as "Avg (%)", median as "Min (%)"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I would like to plot a timechart showing the values within the last 2 hours, where the values are the avg, max, median CPU usage within the past 2 hours relative to the timestamp.&lt;/P&gt;

&lt;P&gt;i.e. &lt;/P&gt;

&lt;P&gt;Assuming current time is 07:00, I would like my timechart to show the following values as a line chart:&lt;/P&gt;

&lt;P&gt;avg, max, median CPU usage at 05:00  --&amp;gt; showing avg, max, median of CPU usage from 03:00 - 05:00&lt;BR /&gt;
avg, max, median CPU usage at 05:01 --&amp;gt; showing avg, max, median of CPU usage from 03:01 - 05:01&lt;BR /&gt;
avg, max, median CPU usage at 05:02 --&amp;gt; showing avg, max, median of CPU usage from 03:02 - 05:02&lt;BR /&gt;
:&lt;BR /&gt;
:&lt;BR /&gt;
avg, max, median CPU usage at 06:59 --&amp;gt; showing avg, max, median of CPU usage from 04:59 - 06:59&lt;BR /&gt;
avg, max, median CPU usage at 07:00 --&amp;gt; showing avg, max, median of CPU usage from 05:00 - 07:00&lt;/P&gt;

&lt;P&gt;Are there ways to do that? Thanks in advance.&lt;/P&gt;</description>
    <pubDate>Fri, 08 Feb 2019 03:48:19 GMT</pubDate>
    <dc:creator>hactl2019</dc:creator>
    <dc:date>2019-02-08T03:48:19Z</dc:date>
    <item>
      <title>Relative time search and plotting in a timechart</title>
      <link>https://community.splunk.com/t5/All-Apps-and-Add-ons/Relative-time-search-and-plotting-in-a-timechart/m-p/376487#M45682</link>
      <description>&lt;P&gt;I currently have a search query to calculate the maximum, average and median CPU usage of a server over the past 2 hours using NMON data models, which is in real-time.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| tstats `CPU_ALL(max)` from datamodel=NMON_Data_CPU where (nodename = CPU.CPU_ALL) (host=myhost) (CPU.frameID="*") (CPU.OStype="*") `No_Filter(CPU)` groupby _time, host prestats=true span=1m
| stats dedup_splitvals=t max("CPU.cpu_PCT") AS CPU.cpu_PCT by _time, host
| fields *
| sort +str(host)
| stats max("CPU.cpu_PCT") AS max, avg("CPU.cpu_PCT") AS avg, median("CPU.cpu_PCT") AS median by host 
| eval max=round(max,2) | eval avg=round(avg,2)
| rename max as "Max (%)", avg as "Avg (%)", median as "Min (%)"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I would like to plot a timechart showing the values within the last 2 hours, where the values are the avg, max, median CPU usage within the past 2 hours relative to the timestamp.&lt;/P&gt;

&lt;P&gt;i.e. &lt;/P&gt;

&lt;P&gt;Assuming current time is 07:00, I would like my timechart to show the following values as a line chart:&lt;/P&gt;

&lt;P&gt;avg, max, median CPU usage at 05:00  --&amp;gt; showing avg, max, median of CPU usage from 03:00 - 05:00&lt;BR /&gt;
avg, max, median CPU usage at 05:01 --&amp;gt; showing avg, max, median of CPU usage from 03:01 - 05:01&lt;BR /&gt;
avg, max, median CPU usage at 05:02 --&amp;gt; showing avg, max, median of CPU usage from 03:02 - 05:02&lt;BR /&gt;
:&lt;BR /&gt;
:&lt;BR /&gt;
avg, max, median CPU usage at 06:59 --&amp;gt; showing avg, max, median of CPU usage from 04:59 - 06:59&lt;BR /&gt;
avg, max, median CPU usage at 07:00 --&amp;gt; showing avg, max, median of CPU usage from 05:00 - 07:00&lt;/P&gt;

&lt;P&gt;Are there ways to do that? Thanks in advance.&lt;/P&gt;</description>
      <pubDate>Fri, 08 Feb 2019 03:48:19 GMT</pubDate>
      <guid>https://community.splunk.com/t5/All-Apps-and-Add-ons/Relative-time-search-and-plotting-in-a-timechart/m-p/376487#M45682</guid>
      <dc:creator>hactl2019</dc:creator>
      <dc:date>2019-02-08T03:48:19Z</dc:date>
    </item>
    <item>
      <title>Re: Relative time search and plotting in a timechart</title>
      <link>https://community.splunk.com/t5/All-Apps-and-Add-ons/Relative-time-search-and-plotting-in-a-timechart/m-p/376488#M45683</link>
      <description>&lt;P&gt;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/163351"&gt;@hactl2019&lt;/a&gt;&lt;/P&gt;

&lt;P&gt;why you are not using timechart?&lt;/P&gt;

&lt;P&gt;like &lt;BR /&gt;
     | timechart span=1min max("CPU.cpu_PCT") AS max, avg("CPU.cpu_PCT") AS avg, median("CPU.cpu_PCT") AS median by host &lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 23:11:22 GMT</pubDate>
      <guid>https://community.splunk.com/t5/All-Apps-and-Add-ons/Relative-time-search-and-plotting-in-a-timechart/m-p/376488#M45683</guid>
      <dc:creator>vishaltaneja070</dc:creator>
      <dc:date>2020-09-29T23:11:22Z</dc:date>
    </item>
    <item>
      <title>Re: Relative time search and plotting in a timechart</title>
      <link>https://community.splunk.com/t5/All-Apps-and-Add-ons/Relative-time-search-and-plotting-in-a-timechart/m-p/376489#M45684</link>
      <description>&lt;P&gt;That will give me the max, avg and median for that minute only. I found a workaround for the problem usig eval calculating the offset. Thanks anyways.&lt;/P&gt;</description>
      <pubDate>Fri, 08 Feb 2019 06:50:06 GMT</pubDate>
      <guid>https://community.splunk.com/t5/All-Apps-and-Add-ons/Relative-time-search-and-plotting-in-a-timechart/m-p/376489#M45684</guid>
      <dc:creator>hactl2019</dc:creator>
      <dc:date>2019-02-08T06:50:06Z</dc:date>
    </item>
    <item>
      <title>Re: Relative time search and plotting in a timechart</title>
      <link>https://community.splunk.com/t5/All-Apps-and-Add-ons/Relative-time-search-and-plotting-in-a-timechart/m-p/376490#M45685</link>
      <description>&lt;P&gt;Hello, I'm having the exact same issue, but i want to have a 10-minute window. I am struggling to do it, can you share your solution?&lt;/P&gt;</description>
      <pubDate>Thu, 06 Feb 2020 10:16:03 GMT</pubDate>
      <guid>https://community.splunk.com/t5/All-Apps-and-Add-ons/Relative-time-search-and-plotting-in-a-timechart/m-p/376490#M45685</guid>
      <dc:creator>pandamasque</dc:creator>
      <dc:date>2020-02-06T10:16:03Z</dc:date>
    </item>
  </channel>
</rss>

