<?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: Bar color based on value on chart in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Bar-color-based-on-value-on-chart/m-p/321300#M159990</link>
    <description>&lt;P&gt;why we need to use stats twice?&lt;/P&gt;

&lt;P&gt;this search query give only one bar. however i have more than one hosts.&lt;/P&gt;

&lt;P&gt;i want to show the diskspace status. if the disk 80% prozent full than i want to change the color of bar.&lt;/P&gt;</description>
    <pubDate>Fri, 21 Jul 2017 07:00:29 GMT</pubDate>
    <dc:creator>karakutu</dc:creator>
    <dc:date>2017-07-21T07:00:29Z</dc:date>
    <item>
      <title>Bar color based on value on chart</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Bar-color-based-on-value-on-chart/m-p/321298#M159988</link>
      <description>&lt;P&gt;Hi everbody&lt;/P&gt;

&lt;P&gt;i want to create color bar chart which color change based value.&lt;BR /&gt;
i see different example for stats but there is no example for chart&lt;/P&gt;

&lt;P&gt;can i create chart with value based color?&lt;/P&gt;

&lt;BLOCKQUOTE&gt;
&lt;P&gt;index=main  sourcetype="Perfmon:Free&lt;BR /&gt;
Disk Space" counter="% Free Space"&lt;BR /&gt;
|chart avg(Value) by host | eval&lt;BR /&gt;
redCount = if(Value&amp;gt;80,Value,0)&lt;BR /&gt;
         | eval yellowCount = if(Value &amp;gt; 70 AND Value&amp;gt;15,Value,0)&lt;BR /&gt;
         | eval greenCount = if(Value&amp;gt;=15, Value, 0) | fields -&lt;BR /&gt;
Value&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;</description>
      <pubDate>Thu, 20 Jul 2017 14:50:26 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Bar-color-based-on-value-on-chart/m-p/321298#M159988</guid>
      <dc:creator>karakutu</dc:creator>
      <dc:date>2017-07-20T14:50:26Z</dc:date>
    </item>
    <item>
      <title>Re: Bar color based on value on chart</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Bar-color-based-on-value-on-chart/m-p/321299#M159989</link>
      <description>&lt;P&gt;So.. This will be incomplete but maybe some combination of this search using rangemap and stats. &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=main sourcetype="Perfmon:Free Disk Space" counter="% Free Space" 
|stats avg(Value) as Freespace by host 
|rangemap field=Freespace Green=80-100, Yellow=11-79, Red=0-10
|stats count(eval(range="Red")) as Red count(eval(range="Yellow")) as Yellow count(eval(range="Green")) as Green
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;And the dashboard options shown here.&lt;/P&gt;

&lt;P&gt;&lt;A href="http://docs.splunk.com/Documentation/Splunk/6.1/Viz/BuildandeditdashboardswithSimplifiedXML#Specify_custom_colors_for_fields_in_charts"&gt;http://docs.splunk.com/Documentation/Splunk/6.1/Viz/BuildandeditdashboardswithSimplifiedXML#Specify_custom_colors_for_fields_in_charts&lt;/A&gt;&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;&amp;lt;option name="charting.fieldColors"&amp;gt;
  {"Red": 0xFF0000, "Yellow": 0xFF9900, "Green":0x009900, "NULL":0xC4C4C0}
&amp;lt;/option&amp;gt;
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 20 Jul 2017 17:01:42 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Bar-color-based-on-value-on-chart/m-p/321299#M159989</guid>
      <dc:creator>JDukeSplunk</dc:creator>
      <dc:date>2017-07-20T17:01:42Z</dc:date>
    </item>
    <item>
      <title>Re: Bar color based on value on chart</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Bar-color-based-on-value-on-chart/m-p/321300#M159990</link>
      <description>&lt;P&gt;why we need to use stats twice?&lt;/P&gt;

&lt;P&gt;this search query give only one bar. however i have more than one hosts.&lt;/P&gt;

&lt;P&gt;i want to show the diskspace status. if the disk 80% prozent full than i want to change the color of bar.&lt;/P&gt;</description>
      <pubDate>Fri, 21 Jul 2017 07:00:29 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Bar-color-based-on-value-on-chart/m-p/321300#M159990</guid>
      <dc:creator>karakutu</dc:creator>
      <dc:date>2017-07-21T07:00:29Z</dc:date>
    </item>
    <item>
      <title>Re: Bar color based on value on chart</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Bar-color-based-on-value-on-chart/m-p/321301#M159991</link>
      <description>&lt;P&gt;I thought you wanted a summary count for all your hosts. &lt;/P&gt;

&lt;P&gt;Anyway, try this, and combine with this article for colors. &lt;A href="http://docs.splunk.com/Documentation/Splunk/6.1/Viz/BuildandeditdashboardswithSimplifiedXML#Specify_custom_colors_for_fields_in_charts"&gt;http://docs.splunk.com/Documentation/Splunk/6.1/Viz/BuildandeditdashboardswithSimplifiedXML#Specify_custom_colors_for_fields_in_charts&lt;/A&gt;&lt;BR /&gt;
Remove the "instance" if you want all disks. &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=main sourcetype="Perfmon:Free Disk Space" counter="% Free Space" instance=C:
| chart avg(Value) as PercentFree by host |sort - PercentFree
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 21 Jul 2017 13:42:19 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Bar-color-based-on-value-on-chart/m-p/321301#M159991</guid>
      <dc:creator>JDukeSplunk</dc:creator>
      <dc:date>2017-07-21T13:42:19Z</dc:date>
    </item>
    <item>
      <title>Re: Bar color based on value on chart</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Bar-color-based-on-value-on-chart/m-p/321302#M159992</link>
      <description>&lt;P&gt;i did it&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; &amp;lt;chart&amp;gt;
    &amp;lt;searchString&amp;gt;index=main sourcetype="Perfmon:Free Disk Space" counter="% Free Space"  | chart avg(Value) as FreeSpacePercent by host |sort - FreeSpacePercent 
    | eval redCritical = if(FreeSpacePercent &amp;gt;= 85,FreeSpacePercent ,0) 
    | eval yellowWarning = if(FreeSpacePercent &amp;gt; 55 AND FreeSpacePercent &amp;lt;=84,FreeSpacePercent ,0) 
    | eval greenOK = if(FreeSpacePercent &amp;lt; 54,FreeSpacePercent ,0) 
    | table Datastore,redCritical,yellowWarning,greenOK&amp;lt;/searchString&amp;gt;
     &amp;lt;option name="charting.legend.labels"&amp;gt;[redCritical,yellowWarning,greenOK]&amp;lt;/option&amp;gt;
     &amp;lt;option name="charting.seriesColors"&amp;gt;[0xFF0000,0xFFFF00,0x00FF00]&amp;lt;/option&amp;gt;
       &amp;lt;option name="charting.primaryAxisTitle.text"&amp;gt;FreeSpacePercent&amp;lt;/option&amp;gt;
       &amp;lt;option name="charting.chart.stacked"&amp;gt;FreeSpacePercent&amp;lt;/option&amp;gt;
       &amp;lt;option name="charting.chart"&amp;gt;column&amp;lt;/option&amp;gt;
&amp;lt;/chart&amp;gt;
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 21 Jul 2017 14:48:41 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Bar-color-based-on-value-on-chart/m-p/321302#M159992</guid>
      <dc:creator>karakutu</dc:creator>
      <dc:date>2017-07-21T14:48:41Z</dc:date>
    </item>
    <item>
      <title>Re: Bar color based on value on chart</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Bar-color-based-on-value-on-chart/m-p/321303#M159993</link>
      <description>&lt;P&gt;Nice! &lt;/P&gt;

&lt;P&gt;I tinkered with it a little to combine host and drive letter. I also reversed green/red so that lower percent free space will show up as critical. I also rounded off the decimal and instead of using an average, I am using "last" value. Since "last" is a more accurate representation of the servers current disk usage.&lt;/P&gt;

&lt;P&gt;sourcetype="Perfmon:Free Disk Space" counter="% Free Space" NOT instance=_total&lt;BR /&gt;
|eval host=host." ".instance &lt;BR /&gt;
| chart eval(round(last(Value)/1,0)) as FreeSpacePercent by host&lt;BR /&gt;
|sort - FreeSpacePercent &lt;BR /&gt;
     | eval greenOK = if(FreeSpacePercent &amp;gt;= 85,FreeSpacePercent ,0) &lt;BR /&gt;
     | eval yellowWarning = if(FreeSpacePercent &amp;gt; 55 AND FreeSpacePercent &amp;lt;=84,FreeSpacePercent ,0) &lt;BR /&gt;
     | eval redCritical = if(FreeSpacePercent &amp;lt; 54,FreeSpacePercent ,0) &lt;BR /&gt;
     | table host,redCritical,yellowWarning,greenOK &lt;/P&gt;</description>
      <pubDate>Fri, 21 Jul 2017 15:43:47 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Bar-color-based-on-value-on-chart/m-p/321303#M159993</guid>
      <dc:creator>JDukeSplunk</dc:creator>
      <dc:date>2017-07-21T15:43:47Z</dc:date>
    </item>
  </channel>
</rss>

