<?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: Splunk query alert to check if CPU utilization is high and send emails if bad samples 5 of 6 intervals met. in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Splunk-search-alert-to-check-if-CPU-utilization-is-high-and-send/m-p/652235#M225435</link>
    <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/231884"&gt;@PickleRick&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Do you know a trick for averaging the CPU values from the recent six events? I'm trying to produce the query below, but avg(values(CpuUsage)) isn't working.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;index=* sourcetype=cpu CPU=all host=* earliest=-35m | rename "%_Idle_Time" as Percent_Idle_Time | eval CpuUsage=coalesce(100-Percent_Idle_Time,100-PercentIdleTime) | streamstats count by host | where count&amp;lt;=6 | stats avg(values(CpuUsage)) as "Average of CpuUsage last 6 intervals(5mins range)" by host&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Regards,&lt;BR /&gt;Satheesh&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 27 Jul 2023 15:15:47 GMT</pubDate>
    <dc:creator>Satheesh_red</dc:creator>
    <dc:date>2023-07-27T15:15:47Z</dc:date>
    <item>
      <title>Splunk search alert to check if CPU utilization is high and send emails if bad samples 5 of 6 intervals met?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Splunk-search-alert-to-check-if-CPU-utilization-is-high-and-send/m-p/650972#M225067</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;Alert Query to monitor CPU usage every 5 minutes and send an email if it matches 5 of 6 bad samples (i.e., &lt;STRONG&gt;if my CPU utilization is greater than 95% for 5 out of 6 intervals&lt;/STRONG&gt; (each interval with a 5-minute gap), we need to trigger emails with High importance.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Here, we are failing to query to check the 5 of 6 bad samples. Please assist me in getting out of this situation.&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Satheesh_red_1-1689676256056.png" style="width: 400px;"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/26324iD433136E2A000066/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Satheesh_red_1-1689676256056.png" alt="Satheesh_red_1-1689676256056.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 18 Jul 2023 16:02:17 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Splunk-search-alert-to-check-if-CPU-utilization-is-high-and-send/m-p/650972#M225067</guid>
      <dc:creator>Satheesh_red</dc:creator>
      <dc:date>2023-07-18T16:02:17Z</dc:date>
    </item>
    <item>
      <title>Re: Splunk query alert to check if CPU utilization is high and send emails if bad samples 5 of 6 intervals met.</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Splunk-search-alert-to-check-if-CPU-utilization-is-high-and-send/m-p/650973#M225068</link>
      <description>&lt;P&gt;The question is - do you have data in your Splunk instance to find that? And is this data of sufficient quality?&lt;/P&gt;&lt;P&gt;Show us a sample.&lt;/P&gt;</description>
      <pubDate>Tue, 18 Jul 2023 10:40:10 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Splunk-search-alert-to-check-if-CPU-utilization-is-high-and-send/m-p/650973#M225068</guid>
      <dc:creator>PickleRick</dc:creator>
      <dc:date>2023-07-18T10:40:10Z</dc:date>
    </item>
    <item>
      <title>Re: Splunk query alert to check if CPU utilization is high and send emails if bad samples 5 of 6 intervals met.</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Splunk-search-alert-to-check-if-CPU-utilization-is-high-and-send/m-p/650974#M225069</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/231884"&gt;@PickleRick&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Yes, we have data for months, and it is sufficient and accurate, as CPU data is loading to our instance from a number of systems every 5 minutes.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 18 Jul 2023 10:43:29 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Splunk-search-alert-to-check-if-CPU-utilization-is-high-and-send/m-p/650974#M225069</guid>
      <dc:creator>Satheesh_red</dc:creator>
      <dc:date>2023-07-18T10:43:29Z</dc:date>
    </item>
    <item>
      <title>Re: Splunk query alert to check if CPU utilization is high and send emails if bad samples 5 of 6 intervals met.</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Splunk-search-alert-to-check-if-CPU-utilization-is-high-and-send/m-p/650980#M225072</link>
      <description>&lt;P&gt;OK. Without digging too deply about being more precise about requirements. Assuming that you want to alert if at least 5 out of 6 subsequent measurements are "bad", you can do this in two different ways.&lt;/P&gt;&lt;P&gt;1) Assuming that you want only latest state. You need to search over at least half an hour into the past (6*5m=30m)&lt;/P&gt;&lt;PRE&gt;&amp;lt;your initial search&amp;gt; earliest=-35m&lt;BR /&gt;| head 6&lt;BR /&gt;| stats count(eval(your_condition_for_cpu_utilization_here)) as count&lt;BR /&gt;| eval result=if(count&amp;gt;=5,"High utilization","Normal")&lt;/PRE&gt;&lt;P&gt;2) Assuming that you want to track it over a longer period&lt;/P&gt;&lt;PRE&gt;&amp;lt;your initial search&amp;gt; earliest=some_longer_time_ago&lt;BR /&gt;| streamstats window=6 count(eval(your_condition_for_cpu_utilization_here)) as count&lt;BR /&gt;| eval result=if(count&amp;gt;=5,"High utilization","Normal")&lt;/PRE&gt;&lt;P&gt;You might add more logic to split it by host or something like that.&lt;/P&gt;</description>
      <pubDate>Tue, 18 Jul 2023 11:11:49 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Splunk-search-alert-to-check-if-CPU-utilization-is-high-and-send/m-p/650980#M225072</guid>
      <dc:creator>PickleRick</dc:creator>
      <dc:date>2023-07-18T11:11:49Z</dc:date>
    </item>
    <item>
      <title>Re: Splunk query alert to check if CPU utilization is high and send emails if bad samples 5 of 6 intervals met.</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Splunk-search-alert-to-check-if-CPU-utilization-is-high-and-send/m-p/650989#M225078</link>
      <description>&lt;P&gt;thanks&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/231884"&gt;@PickleRick&lt;/a&gt;&amp;nbsp;for helping out here.&amp;nbsp;&lt;/P&gt;&lt;P&gt;According to the suggestion you provide below I constructed the following query shown below.&lt;/P&gt;&lt;P&gt;However, I need to fulfill below requirements, please let me know.&lt;/P&gt;&lt;P&gt;Q1: - How can I verify this by the host.&lt;/P&gt;&lt;P&gt;Q2: - head 6 (each time it should check for a 5-minute range event)?&lt;/P&gt;&lt;P&gt;Q3:- Can we able to display the results of those last 5 intervals cpu percentage values in a new column ? ex:- 86, 92, 89,45,99,90&lt;/P&gt;&lt;P&gt;index=* sourcetype=cpu host=* earliest=-35m | rename "%_Idle_Time" as Percent_Idle_Time | eval CpuUsage=coalesce(100-Percent_Idle_Time,100-PercentIdleTime) | head 6 | stats count(eval(CpuUsage &amp;gt; 85)) as count&lt;BR /&gt;| eval result=if(count&amp;gt;=5,"High utilization","Normal")&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 18 Jul 2023 12:31:24 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Splunk-search-alert-to-check-if-CPU-utilization-is-high-and-send/m-p/650989#M225078</guid>
      <dc:creator>Satheesh_red</dc:creator>
      <dc:date>2023-07-18T12:31:24Z</dc:date>
    </item>
    <item>
      <title>Re: Splunk query alert to check if CPU utilization is high and send emails if bad samples 5 of 6 intervals met.</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Splunk-search-alert-to-check-if-CPU-utilization-is-high-and-send/m-p/650996#M225079</link>
      <description>&lt;P&gt;That's a completely different story. And more complicated.&lt;/P&gt;&lt;P&gt;The 'head' command only shows first N results, it doesn't distinguish by any field so you have to count the actual results and limit them in other way.&lt;/P&gt;&lt;PRE&gt;| streamstats count by host&lt;BR /&gt;| where count&amp;lt;=6&lt;/PRE&gt;&lt;P&gt;That's how you get your events to be statsed (you don't do the "head" command now!)&lt;/P&gt;&lt;P&gt;Then you can do your stats by each host&lt;/P&gt;&lt;PRE&gt;| stats count(eval(CpuUsage &amp;gt; 85)) as count by host&lt;/PRE&gt;&lt;P&gt;And you can add values of your CpuUsages to that command. So instead of the last line you can do&lt;/P&gt;&lt;PRE&gt;| stats count(eval(CpuUsage &amp;gt; 85)) as count values(CpuUsage) as CpuUsage by host&lt;/PRE&gt;</description>
      <pubDate>Tue, 18 Jul 2023 13:22:58 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Splunk-search-alert-to-check-if-CPU-utilization-is-high-and-send/m-p/650996#M225079</guid>
      <dc:creator>PickleRick</dc:creator>
      <dc:date>2023-07-18T13:22:58Z</dc:date>
    </item>
    <item>
      <title>Re: Splunk query alert to check if CPU utilization is high and send emails if bad samples 5 of 6 intervals met.</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Splunk-search-alert-to-check-if-CPU-utilization-is-high-and-send/m-p/651015#M225085</link>
      <description>&lt;P&gt;Thank you so much&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/231884"&gt;@PickleRick&lt;/a&gt;&amp;nbsp; for your help. it's worked for my requirement now.&lt;/P&gt;&lt;P&gt;Appreciated your time and support.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 18 Jul 2023 14:38:45 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Splunk-search-alert-to-check-if-CPU-utilization-is-high-and-send/m-p/651015#M225085</guid>
      <dc:creator>Satheesh_red</dc:creator>
      <dc:date>2023-07-18T14:38:45Z</dc:date>
    </item>
    <item>
      <title>Re: Splunk query alert to check if CPU utilization is high and send emails if bad samples 5 of 6 intervals met.</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Splunk-search-alert-to-check-if-CPU-utilization-is-high-and-send/m-p/652235#M225435</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/231884"&gt;@PickleRick&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Do you know a trick for averaging the CPU values from the recent six events? I'm trying to produce the query below, but avg(values(CpuUsage)) isn't working.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;index=* sourcetype=cpu CPU=all host=* earliest=-35m | rename "%_Idle_Time" as Percent_Idle_Time | eval CpuUsage=coalesce(100-Percent_Idle_Time,100-PercentIdleTime) | streamstats count by host | where count&amp;lt;=6 | stats avg(values(CpuUsage)) as "Average of CpuUsage last 6 intervals(5mins range)" by host&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Regards,&lt;BR /&gt;Satheesh&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 27 Jul 2023 15:15:47 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Splunk-search-alert-to-check-if-CPU-utilization-is-high-and-send/m-p/652235#M225435</guid>
      <dc:creator>Satheesh_red</dc:creator>
      <dc:date>2023-07-27T15:15:47Z</dc:date>
    </item>
    <item>
      <title>Re: Splunk query alert to check if CPU utilization is high and send emails if bad samples 5 of 6 intervals met.</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Splunk-search-alert-to-check-if-CPU-utilization-is-high-and-send/m-p/652335#M225467</link>
      <description>&lt;P&gt;You can't do "avg(values(X))". values() will produce a multivalued field. Why not just avg(CpuUsage)?&lt;/P&gt;</description>
      <pubDate>Fri, 28 Jul 2023 09:03:34 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Splunk-search-alert-to-check-if-CPU-utilization-is-high-and-send/m-p/652335#M225467</guid>
      <dc:creator>PickleRick</dc:creator>
      <dc:date>2023-07-28T09:03:34Z</dc:date>
    </item>
    <item>
      <title>Re: Splunk query alert to check if CPU utilization is high and send emails if bad samples 5 of 6 intervals met.</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Splunk-search-alert-to-check-if-CPU-utilization-is-high-and-send/m-p/652340#M225472</link>
      <description>&lt;P&gt;thanks&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/231884"&gt;@PickleRick&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;avg(CpuUsage)&lt;/SPAN&gt; worked.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 28 Jul 2023 09:13:57 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Splunk-search-alert-to-check-if-CPU-utilization-is-high-and-send/m-p/652340#M225472</guid>
      <dc:creator>Satheesh_red</dc:creator>
      <dc:date>2023-07-28T09:13:57Z</dc:date>
    </item>
  </channel>
</rss>

