title: influxdb query for 5 top cpu usage
body: <p>I run a shared web hosting using CloudLinux.
  From it, I can get a bunch of performence metric</p>
  
  <p>So, my influxDB is :</p>
  
  <p>measurement : lve</p>
  
  <p>fields : CPU,EP,IO,IOPS,MEM,MEMPHY,NETI,NETO,NPROC,fEP,fMEM,fMEMPHY,fNPROC,lCPU,lCPUW,lEP,lIO,lIOPS,lMEM,lMEMPHY,lNETI,lNETO,lNPROC,nCPU</p>
  
  <p>tags : xpool, host, user (where : xpool is xen-pool uid, host is hostname of cloudLinux, user is username of shared hosting)</p>
  
  <p>data is gathered each 5 seconds</p>
  
  <p>How is the query sentence to :</p>
  
  <ol>
  <li><p>Select records from specific xpool+host , and </p></li>
  <li><p>get 5 unique username that produce TOP CPU usage in 5 minute periode from it ?. 
  There is hundreds usaername but I want got top-5 only.</p></li>
  </ol>
  
  <p>Note: Samething like example 4 of TOP() from <a href="https://docs.influxdata.com/influxdb/v1.5/query_language/functions/#top" rel="nofollow noreferrer">https://docs.influxdata.com/influxdb/v1.5/query_language/functions/#top</a>, unless that expected results is:</p>
  
  <pre><code>name: h2o_feet
  time                  top    location
  ----                  ---    --------
  2015-08-18T00:00:00Z  8.12   coyote_creek
  2015-08-18T00:54:00Z  2.054  santa_monica
  </code></pre>
  
  <p>Rather than :</p>
  
  <pre><code>name: h2o_feet
  time                  top    location
  ----                  ---    --------
  2015-08-18T00:48:00Z  7.11   coyote_creek
  2015-08-18T00:54:00Z  6.982  coyote_creek
  2015-08-18T00:54:00Z  2.054  santa_monica
  2015-08-18T00:24:00Z  7.635  coyote_creek
  2015-08-18T00:30:00Z  7.5    coyote_creek
  2015-08-18T00:36:00Z  7.372  coyote_creek
  2015-08-18T00:00:00Z  8.12   coyote_creek
  2015-08-18T00:06:00Z  8.005  coyote_creek
  2015-08-18T00:12:00Z  7.887  coyote_creek
  </code></pre>
  
  <p>Since '8.12' is the highest value of 'coyote_creek' and '2.054' is the highest value of 'santa_monica'</p>
  
  <p>Sincerely</p>
  
  <p>-bino-</p>