How to get a disk IO time rate from prometheus

319 views Asked by At

I have a server running standard Prometheus node exporter. Metrics are properly collected. Now I need to display in Grafana rate of time spend for IO operations on all devices.

In the /metrics for my server I am getting the following (among other metrics)

# HELP node_disk_io_time_weighted_seconds_total The weighted # of seconds spent doing I/Os.
# TYPE node_disk_io_time_weighted_seconds_total counter
node_disk_io_time_weighted_seconds_total{device="dm-0"} 3800.91
node_disk_io_time_weighted_seconds_total{device="dm-1"} 37118.635
node_disk_io_time_weighted_seconds_total{device="dm-2"} 129.778
node_disk_io_time_weighted_seconds_total{device="dm-3"} 3475.8250000000003
node_disk_io_time_weighted_seconds_total{device="dm-4"} 8.892
node_disk_io_time_weighted_seconds_total{device="dm-5"} 6210.612
node_disk_io_time_weighted_seconds_total{device="dm-6"} 14.934000000000001
node_disk_io_time_weighted_seconds_total{device="dm-7"} 2228.0750000000003
node_disk_io_time_weighted_seconds_total{device="dm-8"} 1029.349
node_disk_io_time_weighted_seconds_total{device="sda"} 20042.765
node_disk_io_time_weighted_seconds_total{device="sdb"} 137.591
node_disk_io_time_weighted_seconds_total{device="sr0"} 0.007

I wrote the following query

rate(sum by(device)(node_disk_io_time_weighted_seconds_total{instance="myserver:9100"}))[1m]

and I got parsing error message: "parse error: ranges only allowed for vector selectors" If I take out [1m] from the query it suppose to reverse to default interval of 1 second, but I am getting different parsing error message: "parse error: expected type range vector in call to function "rate", got instant vector" I am pretty new to PromQL, so forgive me if I do not yet understand its functions details, but I someone point out what I am doing wrong and how to fix my query, I'll appreciate it.

0

There are 0 answers