Is there any way to get devices by the node_name?

hi, I want to get io util data from pmm via http://pmm-server-ip:80/prometheus,
pmm uses the following query to get data:

sum by (node_name) (rate(node_disk_io_time_seconds_total{device=~"(sda|sdb|sdc|sr0)",node_name=~"192-168-137-11"}[20s]) or irate(node_disk_io_time_seconds_total{device=~"(sda|sdb|sdc|sr0)",node_name=~"192-168-137-11"}[5m]) or
(max_over_time(rdsosmetrics_diskIO_util{device=~"(sda|sdb|sdc|sr0)",node_name=~"192-168-137-11"}[20s]) or max_over_time(rdsosmetrics_diskIO_util{device=~"(sda|sdb|sdc|sr0)",node_name=~"192-168-137-11"}[5m]))/100)

so here is my question,
is there any way to get those devices by the node_name from pmm or prometheus api?
thanks in advance.

Not quite sure I understand what you’re after but I think you can do what you need by using the PMM api. Check out the API docs at https:///swagger and you’ll see all the options for getting nodes information and you can filter by type etc. You can then use that data to feed into queries via https:///victoriametrics API. If you know the node_names you are after you can skip the first part. I’m assuming this is to automate all of this so if I’m wrong or missing your goal please let us know and we’ll see if we can get you pointed in the right direction.

1 Like

You may use the next formula for getting a list of devices
count by (device,node_name) (node_disk_io_time_seconds_total or rdsosmetrics_diskIO_util)

Also list of devices is stored in the variable “device” for Disk Details dashboard.

1 Like

I want to get device list like (sda|sdb|sdc|sr0), I know the node_name of the server,
but I don’t know how to get the device list from pmm.
I checked the swagger and /prometheus/metrics, but didn’t find useful api to get those devices

1 Like

@adivinho ,


as you can see in the screenshot,
there are dm-x devices as we use LVM to manage the disk,
this is duplicated with sdb and that’s what I want to avoid.
I’m not sure if there are some other duplicated devices not named like dm-x,
so I’d prefer to get device list by pmm API.

1 Like

Such devices can be removed by an additional filter in the formula → device!~"dm-.+"

1 Like

yeah, but I’m not sure if there are any other devices that need to be removed,
that’s why I want to get device list from API

1 Like