# Query structure with Grafana/ InfluxDB for "diskio" statistics for IOPs: read, write, sum= read + write

**URL:** <https://community.influxdata.com/t/query-structure-with-grafana-influxdb-for-diskio-statistics-for-iops-read-write-sum-read-write/3492>\
**Category:** Dashboards\
**Tags:** influxdb, grafana\
**Created:** [December 22, 2017, 9:59am UTC](https://community.influxdata.com/t/query-structure-with-grafana-influxdb-for-diskio-statistics-for-iops-read-write-sum-read-write/3492 "2017-12-22T09:59:32Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![fchiorascu](https://sea1.discourse-cdn.com/flex023/user_avatar/community.influxdata.com/fchiorascu/32/995_2.png) [@fchiorascu](https://community.influxdata.com/u/fchiorascu)\
**Post date:** [December 22, 2017, 9:59am UTC](https://community.influxdata.com/t/query-structure-with-grafana-influxdb-for-diskio-statistics-for-iops-read-write-sum-read-write/3492/1 "2017-12-22T09:59:32Z")

</div>

Hi,

[Server side]  
telegraf-1.5.0-1.x86\_64  
grafana-4.6.3-1.x86\_64  
influxdb-1.4.2-1.x86\_64

[Query structure in order to show the SUM for read\_bytes/ write\_bytes]  
Regarding IOPs I need somehow to have the total number of read/ wite IOPs for all: sda + sdb + sdc + dm-x not separate as now: sda, sdb, sdc, dm-x.

 ![image](https://us1.discourse-cdn.com/flex023/uploads/influxdata/original/1X/cb45499068b1412707215fd6f99d896dbb0fc6d3.png)

Any suggestions?

Kind Regards,

---

<div class="post-metadata">

**Author:** ![noahcrowley](https://sea1.discourse-cdn.com/flex023/user_avatar/community.influxdata.com/noahcrowley/32/818_2.png) [@noahcrowley](https://community.influxdata.com/u/noahcrowley)\
**Post date:** [December 22, 2017, 2:06pm UTC](https://community.influxdata.com/t/query-structure-with-grafana-influxdb-for-diskio-statistics-for-iops-read-write-sum-read-write/3492/2 "2017-12-22T14:06:37Z")

</div>

You’re using a `group by` clause along with the tag `name` in your query, so InfluxDB is grouping results based on `name`, in your case `sda`, `sdb`, etc. You should modify your group by clause so that it only groups by `time` and `host`.

You can find more information about the [“Group By” clause in the InfluxDB documentation](https://docs.influxdata.com/influxdb/v1.4/query_language/data_exploration/#the-group-by-clause).

Also, you are currently querying for the number of bytes read and written; this is different from [IOPS](https://en.wikipedia.org/wiki/IOPS), which is the number of input / output operations per second. If you are interested in the number of operations, rather than the amount of bytes, you should query against the `reads` and `writes` fields instead of `read_bytes` and `write_bytes`.

---

<div class="post-metadata">

**Author:** ![fchiorascu](https://sea1.discourse-cdn.com/flex023/user_avatar/community.influxdata.com/fchiorascu/32/995_2.png) [@fchiorascu](https://community.influxdata.com/u/fchiorascu)\
**Post date:** [December 28, 2017, 6:17am UTC](https://community.influxdata.com/t/query-structure-with-grafana-influxdb-for-diskio-statistics-for-iops-read-write-sum-read-write/3492/3 "2017-12-28T06:17:57Z")

</div>

Hi,

Thank you for clarifications.  
Regarding reads/ writes you are right, I’ve missed this point.  
I’ll double check and come back with a feedback today.

Kind Regards,

---

<div class="post-metadata">

**Author:** ![fchiorascu](https://sea1.discourse-cdn.com/flex023/user_avatar/community.influxdata.com/fchiorascu/32/995_2.png) [@fchiorascu](https://community.influxdata.com/u/fchiorascu)\
**Post date:** [January 4, 2018, 3:04pm UTC](https://community.influxdata.com/t/query-structure-with-grafana-influxdb-for-diskio-statistics-for-iops-read-write-sum-read-write/3492/4 "2018-01-04T15:04:22Z")

</div>

Yes working fine for me.  
Thank you for your valuable support.

 ![image](https://us1.discourse-cdn.com/flex023/uploads/influxdata/original/1X/f5d27f59851d6316de3a9eb04746456506555167.png)

I have now in GUI metrics for: total IOPs read, total IOPs write and also for each name= sdb, sdc, dm, etc the IOPs.

> > I’m searching for a way to have sum= total IOPs read + total IOPs write = total IOPs per server.  
> > I’ve used as Selector the “last” and not the Aggregations “mean”, what do you think about this?

Do you have any recommendation if “last” vs “mean” and also for the sum?

---

<div class="post-metadata">

**Author:** ![Tal\_Shlomi](https://avatars.discourse-cdn.com/v4/letter/t/85f322/32.png) [@Tal\_Shlomi](https://community.influxdata.com/u/Tal_Shlomi)\
**Post date:** [March 17, 2019, 9:26am UTC](https://community.influxdata.com/t/query-structure-with-grafana-influxdb-for-diskio-statistics-for-iops-read-write-sum-read-write/3492/5 "2019-03-17T09:26:09Z")

</div>

> Blockquote  
> I’m searching for a way to have sum= total IOPs read + total IOPs write = total IOPs per server.  
> I’ve used as Selector the “last” and not the Aggregations “mean”, what do you think about this?  
> Blockquote

did someone find an answer for that ?
