<?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 Help on a bar chart with scale in Dashboards &amp; Visualizations</title>
    <link>https://community.splunk.com/t5/Dashboards-Visualizations/Help-on-a-bar-chart-with-scale/m-p/470985#M30910</link>
    <description>&lt;P&gt;hi&lt;/P&gt;

&lt;P&gt;With the search below, I display a line chart which shows an average CPU consumption&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;`CPU`
| stats avg(process_cpu_used_percent) as process_cpu_used_percent by host
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Now i need a bart chart which count the number of hosts for a process_cpu_used_percent between 0 and 20, 20 and 40, 40 and 60, 60 and 80 and 80 and 100&lt;BR /&gt;
So I need 5 bar in my bart chart whith the cpu usage in x and the number of host in y&lt;BR /&gt;
could you help me please??&lt;/P&gt;</description>
    <pubDate>Wed, 30 Sep 2020 03:27:52 GMT</pubDate>
    <dc:creator>jip31</dc:creator>
    <dc:date>2020-09-30T03:27:52Z</dc:date>
    <item>
      <title>Help on a bar chart with scale</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/Help-on-a-bar-chart-with-scale/m-p/470985#M30910</link>
      <description>&lt;P&gt;hi&lt;/P&gt;

&lt;P&gt;With the search below, I display a line chart which shows an average CPU consumption&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;`CPU`
| stats avg(process_cpu_used_percent) as process_cpu_used_percent by host
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Now i need a bart chart which count the number of hosts for a process_cpu_used_percent between 0 and 20, 20 and 40, 40 and 60, 60 and 80 and 80 and 100&lt;BR /&gt;
So I need 5 bar in my bart chart whith the cpu usage in x and the number of host in y&lt;BR /&gt;
could you help me please??&lt;/P&gt;</description>
      <pubDate>Wed, 30 Sep 2020 03:27:52 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/Help-on-a-bar-chart-with-scale/m-p/470985#M30910</guid>
      <dc:creator>jip31</dc:creator>
      <dc:date>2020-09-30T03:27:52Z</dc:date>
    </item>
    <item>
      <title>Re: Help on a bar chart with scale</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/Help-on-a-bar-chart-with-scale/m-p/470986#M30911</link>
      <description>&lt;P&gt;@jip31 please add the following to your existing search and confirm!&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;&amp;lt;yourCurrentSearchReturningCPUPercByHosts&amp;gt;
| eval cpu_range=case(process_cpu_used_percent&amp;gt;0 AND process_cpu_used_percent &amp;lt;=20,"0-20",
    process_cpu_used_percent&amp;gt;20 AND process_cpu_used_percent &amp;lt;=40,"20-40",
    process_cpu_used_percent&amp;gt;40 AND process_cpu_used_percent &amp;lt;=60,"40-60",
    process_cpu_used_percent&amp;gt;60 AND process_cpu_used_percent &amp;lt;=80,"60-80",
    process_cpu_used_percent&amp;gt;80 AND process_cpu_used_percent &amp;lt;=100,"80-100") 
| stats count(host) as hosts by cpu_range 
| append 
    [| makeresults
    | fields - _time
    | eval cpu_range="0-20,20-40,40-60,60-80,80-100"
    | makemv cpu_range delim=","
    | mvexpand cpu_range
    | eval hosts=0]
| dedup cpu_range
| sort cpu_range
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 19 Dec 2019 18:56:33 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/Help-on-a-bar-chart-with-scale/m-p/470986#M30911</guid>
      <dc:creator>niketn</dc:creator>
      <dc:date>2019-12-19T18:56:33Z</dc:date>
    </item>
    <item>
      <title>Re: Help on a bar chart with scale</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/Help-on-a-bar-chart-with-scale/m-p/470987#M30912</link>
      <description>&lt;P&gt;its perfect many thanks&lt;BR /&gt;
last question : I need to add a span value in my code&lt;BR /&gt;
I have added &lt;CODE&gt;| bin span=50m _time&lt;/CODE&gt; and &lt;CODE&gt;| stats count(host) as hosts by cpu_range  _time&lt;/CODE&gt;&lt;BR /&gt;
does it seems to be good?&lt;/P&gt;</description>
      <pubDate>Fri, 20 Dec 2019 06:21:11 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/Help-on-a-bar-chart-with-scale/m-p/470987#M30912</guid>
      <dc:creator>jip31</dc:creator>
      <dc:date>2019-12-20T06:21:11Z</dc:date>
    </item>
    <item>
      <title>Re: Help on a bar chart with scale</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/Help-on-a-bar-chart-with-scale/m-p/470988#M30913</link>
      <description>&lt;P&gt;Like this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; `CPU`
| stats avg(process_cpu_used_percent) AS process_cpu_used_percent BY host
| bin process_cpu_used_percent span=20 bins=5
| stats count BY process_cpu_used_percent
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 20 Dec 2019 10:49:31 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/Help-on-a-bar-chart-with-scale/m-p/470988#M30913</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2019-12-20T10:49:31Z</dc:date>
    </item>
    <item>
      <title>Re: Help on a bar chart with scale</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/Help-on-a-bar-chart-with-scale/m-p/470989#M30914</link>
      <description>&lt;P&gt;Hi woodcock&lt;BR /&gt;
I need a span on the _time field and not on process_cpu_used_percent field&lt;/P&gt;</description>
      <pubDate>Wed, 30 Sep 2020 03:25:28 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/Help-on-a-bar-chart-with-scale/m-p/470989#M30914</guid>
      <dc:creator>jip31</dc:creator>
      <dc:date>2020-09-30T03:25:28Z</dc:date>
    </item>
    <item>
      <title>Re: Help on a bar chart with scale</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/Help-on-a-bar-chart-with-scale/m-p/470990#M30915</link>
      <description>&lt;P&gt;Your question says nothing like that.  I don't know what you mean; I only know what you wrote.  My answer solves the problem in your OP as it was written.&lt;/P&gt;</description>
      <pubDate>Fri, 20 Dec 2019 19:50:52 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/Help-on-a-bar-chart-with-scale/m-p/470990#M30915</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2019-12-20T19:50:52Z</dc:date>
    </item>
    <item>
      <title>Re: Help on a bar chart with scale</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/Help-on-a-bar-chart-with-scale/m-p/470991#M30916</link>
      <description>&lt;P&gt;@jip31 instead of bin and stats you can directly try the timechart command...&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| timechart span=15min dc(host) as "Number" by cpu_range
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Following is a run anywhere example based on the SPL and details provided so far:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| makeresults count=1000 
| eval delta=300
| accum delta
| eval _time=_time-delta
| fields - delta
| eval host="host", counter=random()%5
| eval counter=printf("%02d",counter),host=host.counter 
| fields - counter 
| eval process_cpu_used_percent=random(), process_cpu_used_percent=substr(process_cpu_used_percent,1,2)
| eval cpu_range=case(process_cpu_used_percent&amp;gt;0 AND process_cpu_used_percent &amp;lt;=20,"0-20",
    process_cpu_used_percent&amp;gt;20 AND process_cpu_used_percent &amp;lt;=40,"20-40",
    process_cpu_used_percent&amp;gt;40 AND process_cpu_used_percent &amp;lt;=60,"40-60",
    process_cpu_used_percent&amp;gt;60 AND process_cpu_used_percent &amp;lt;=80,"60-80",
    process_cpu_used_percent&amp;gt;80 AND process_cpu_used_percent &amp;lt;=100,"80-100")
| timechart span=15min dc(host) as "Number" by cpu_range
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;PS: The query creates 1000 data points for 5 hosts every 5 min with the cpu used percentage between 0-100.&lt;/P&gt;

&lt;P&gt;Please try out and confirm. Do accept and up-vote the answer/comments if they helped.&lt;/P&gt;</description>
      <pubDate>Sat, 21 Dec 2019 02:28:28 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/Help-on-a-bar-chart-with-scale/m-p/470991#M30916</guid>
      <dc:creator>niketn</dc:creator>
      <dc:date>2019-12-21T02:28:28Z</dc:date>
    </item>
    <item>
      <title>Re: Help on a bar chart with scale</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/Help-on-a-bar-chart-with-scale/m-p/470992#M30917</link>
      <description>&lt;P&gt;Hi Niket&lt;BR /&gt;
Sorry to bother you but could you have a look to the topic below please&lt;BR /&gt;
&lt;A href="https://answers.splunk.com/answers/803891/help-on-complex-bar-chart.html"&gt;https://answers.splunk.com/answers/803891/help-on-complex-bar-chart.html&lt;/A&gt;&lt;BR /&gt;
It was you that gave me the solution but I need some little changes&lt;BR /&gt;
Could you help me please?&lt;/P&gt;</description>
      <pubDate>Thu, 20 Feb 2020 06:22:19 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/Help-on-a-bar-chart-with-scale/m-p/470992#M30917</guid>
      <dc:creator>jip31</dc:creator>
      <dc:date>2020-02-20T06:22:19Z</dc:date>
    </item>
  </channel>
</rss>

