<?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: Aggregate rate for entire cluster from individual hosts data in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Aggregate-rate-for-entire-cluster-from-individual-hosts-data/m-p/129728#M184529</link>
    <description>&lt;P&gt;Those differences are expected - every time you run the search the underlying data changes a little because the time range has progressed a little.&lt;/P&gt;</description>
    <pubDate>Sun, 23 Nov 2014 21:09:15 GMT</pubDate>
    <dc:creator>martin_mueller</dc:creator>
    <dc:date>2014-11-23T21:09:15Z</dc:date>
    <item>
      <title>Aggregate rate for entire cluster from individual hosts data</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Aggregate-rate-for-entire-cluster-from-individual-hosts-data/m-p/129723#M184524</link>
      <description>&lt;P&gt;I have cluster of more than 100 hosts which getting data over network from multiple source. I can calculate rate of incoming data by collecting 'RX Bytes' field from 'ifconfig' output every minute. So my splunk query to create timechart for single hosts , looks like&lt;/P&gt;

&lt;PRE&gt;
index=os source=interfaces eth0 host=hostname1 | sort  -_time | streamstats current=false last(RXbytes) as lastRX  | eval RX_Thruput_bytes = ((lastRX-RXbytes)/(1024*60)) | timechart span=10m avg(RX_Thruput_bytes)
&lt;/PRE&gt;

&lt;P&gt;How can I make addition of avg(RX_Thruput_bytes) for all 100 hosts and determine rate of incoming data for entire cluster ?&lt;/P&gt;</description>
      <pubDate>Mon, 28 Sep 2020 18:14:07 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Aggregate-rate-for-entire-cluster-from-individual-hosts-data/m-p/129723#M184524</guid>
      <dc:creator>abhisawa</dc:creator>
      <dc:date>2020-09-28T18:14:07Z</dc:date>
    </item>
    <item>
      <title>Re: Aggregate rate for entire cluster from individual hosts data</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Aggregate-rate-for-entire-cluster-from-individual-hosts-data/m-p/129724#M184525</link>
      <description>&lt;P&gt;Something like this?&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;  index=os source=interfaces eth0 | sort - _time
| streamstats current=f window=1 global=f last(RXbytes) as lastRX last(_time) as lastTime
| eval thruput_kb = case(lastRX &amp;gt; RXbytes, (lastRX-RXbytes)/1024*(lastTime-_time))
| timechart span=10m avg(thruput_kb) as average_kb_per_host dc(host) as hosts
| eval average_kb_per_cluster = average_kb_per_host * hosts | fields - average_kb_per_host hosts
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Assuming every host reports every time, the dc() for every bucket will be the number of hosts in your cluster. Note, the total average is slightly dirty from a statistics point of view, if a single host has more or less number of reports in the ten-minute bucket his throughput will be weighted slightly more or less than that of other hosts. This might be more correct from a statistics point of view:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;  index=os source=interfaces eth0 | sort - _time
| streamstats current=f window=1 global=f last(RXbytes) as lastRX last(_time) as lastTime
| eval thruput_kb = case(lastRX &amp;gt; RXbytes, (lastRX-RXbytes)/1024*(lastTime-_time))
| bucket span=10m _time | stats avg(thruput_kb) as average_kb_per_host by _time host
| timechart span=10m sum(thruput_kb) as cluster_thruput_kb
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;My brain isn't quire sure on what's more correct right now, so do try both and think about what works best.&lt;/P&gt;</description>
      <pubDate>Sun, 23 Nov 2014 00:24:49 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Aggregate-rate-for-entire-cluster-from-individual-hosts-data/m-p/129724#M184525</guid>
      <dc:creator>martin_mueller</dc:creator>
      <dc:date>2014-11-23T00:24:49Z</dc:date>
    </item>
    <item>
      <title>Re: Aggregate rate for entire cluster from individual hosts data</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Aggregate-rate-for-entire-cluster-from-individual-hosts-data/m-p/129725#M184526</link>
      <description>&lt;P&gt;Martin, Thank you for taking look at this query. Your 2nd query which I was looking for with modification as follows &lt;/P&gt;

&lt;UL&gt;
&lt;LI&gt;&lt;P&gt;For some reason stats average was getting zero for few of hosts so I changed &lt;CODE&gt;stats avg(thruput_kb) as average_kb_per_host by _time host&lt;/CODE&gt; to &lt;CODE&gt;stats avg(thruput_kb) as average_kb_per_host host _time&lt;/CODE&gt;,  looks like fields order does matter. &lt;/P&gt;&lt;/LI&gt;
&lt;LI&gt;&lt;P&gt;I think  in &lt;CODE&gt;timechart span=10m sum(thruput_kb) as cluster_thruput_kb&lt;/CODE&gt;  you meant &lt;CODE&gt;sum(average_kb_per_host)&lt;/CODE&gt; .&lt;/P&gt;&lt;/LI&gt;
&lt;/UL&gt;

&lt;P&gt;So final query as following gives me believable output in chart BUT every single time I run this query gives me minor variation in timechart for 24 hour worth of data. &lt;/P&gt;

&lt;P&gt;Is that expected ?&lt;/P&gt;

&lt;P&gt;&lt;CODE&gt;index=os source=interfaces eth0  | sort 0 - _time&lt;BR /&gt;
 | streamstats current=f window=1 global=f last(RXbytes) as lastRX last(_time) as lastTime&lt;BR /&gt;
 | eval thruput_kb = case(lastRX &amp;gt; RXbytes, (lastRX-RXbytes)/(1024*(lastTime-_time)))&lt;BR /&gt;
 | bucket span=1h _time  |stats avg(thruput_kb) as average_kb_per_host by host _time&lt;BR /&gt;
 | timechart span=1h sum(average_kb_per_host) as cluster_thruput_kb&lt;/CODE&gt;&lt;/P&gt;</description>
      <pubDate>Sun, 23 Nov 2014 20:14:34 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Aggregate-rate-for-entire-cluster-from-individual-hosts-data/m-p/129725#M184526</guid>
      <dc:creator>abhisawa</dc:creator>
      <dc:date>2014-11-23T20:14:34Z</dc:date>
    </item>
    <item>
      <title>Re: Aggregate rate for entire cluster from individual hosts data</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Aggregate-rate-for-entire-cluster-from-individual-hosts-data/m-p/129726#M184527</link>
      <description>&lt;P&gt;Are you running the search over a fixed time range (e.g. "Yesterday") or a relative time range (e.g. "Last 24 hours")?&lt;/P&gt;</description>
      <pubDate>Sun, 23 Nov 2014 20:38:28 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Aggregate-rate-for-entire-cluster-from-individual-hosts-data/m-p/129726#M184527</guid>
      <dc:creator>martin_mueller</dc:creator>
      <dc:date>2014-11-23T20:38:28Z</dc:date>
    </item>
    <item>
      <title>Re: Aggregate rate for entire cluster from individual hosts data</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Aggregate-rate-for-entire-cluster-from-individual-hosts-data/m-p/129727#M184528</link>
      <description>&lt;P&gt;I am running on Last 24 hours and difference is very minor. &lt;/P&gt;</description>
      <pubDate>Sun, 23 Nov 2014 20:49:22 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Aggregate-rate-for-entire-cluster-from-individual-hosts-data/m-p/129727#M184528</guid>
      <dc:creator>abhisawa</dc:creator>
      <dc:date>2014-11-23T20:49:22Z</dc:date>
    </item>
    <item>
      <title>Re: Aggregate rate for entire cluster from individual hosts data</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Aggregate-rate-for-entire-cluster-from-individual-hosts-data/m-p/129728#M184529</link>
      <description>&lt;P&gt;Those differences are expected - every time you run the search the underlying data changes a little because the time range has progressed a little.&lt;/P&gt;</description>
      <pubDate>Sun, 23 Nov 2014 21:09:15 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Aggregate-rate-for-entire-cluster-from-individual-hosts-data/m-p/129728#M184529</guid>
      <dc:creator>martin_mueller</dc:creator>
      <dc:date>2014-11-23T21:09:15Z</dc:date>
    </item>
    <item>
      <title>Re: Aggregate rate for entire cluster from individual hosts data</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Aggregate-rate-for-entire-cluster-from-individual-hosts-data/m-p/129729#M184530</link>
      <description>&lt;P&gt;After multiple iteration and cross verifying results with actual ifconfig data , following query works correctly. Updated &lt;CODE&gt;streamstats&lt;/CODE&gt; with &lt;CODE&gt;by host&lt;/CODE&gt; to provide accurate calculation.&lt;/P&gt;

&lt;PRE&gt;
index=os source=interfaces eth0  | sort 0 - _time
| streamstats current=f window=1 global=f last(RXbytes) as lastRX last(_time) as lastTime by host 
| eval thruput_kb = case(lastRX &amp;gt; RXbytes, (lastRX-RXbytes)/(1024*(lastTime-_time)))
| bucket span=4h _time  |stats avg(thruput_kb) as average_kb_per_host by host _time
| timechart span=4h sum(average_kb_per_host) as cluster_thruput_kb
&lt;/PRE&gt;

&lt;P&gt;Thank you martin for providing initial approach.&lt;/P&gt;</description>
      <pubDate>Sun, 23 Nov 2014 23:18:52 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Aggregate-rate-for-entire-cluster-from-individual-hosts-data/m-p/129729#M184530</guid>
      <dc:creator>abhisawa</dc:creator>
      <dc:date>2014-11-23T23:18:52Z</dc:date>
    </item>
  </channel>
</rss>

