-
What Grafana version and what operating system are you using?
grafana-11.2.2-1.x86_64 on Centos 8 -
What are you trying to achieve?
I’m trying to calculate the percentage of each ldevID for a specific MPU, instead of to have the IOPS values -
How are you trying to achieve it?
This is my query
total_iops = from(bucket: v.bucket) // calculate the sum of iops
|> range(start: v.timeRangeStart, stop: v.timeRangeStop)
|> filter(fn: (r) => r._measurement == “LDEV” and r._field == “LDEV_IOPS” and r.serial == “${Serial}” and r.MPU == “MPU-010”)
|> keep(columns: [“_measurement”, “_time”, “_field”, “_value”])
|> aggregateWindow(every: 1m, fn: sum, createEmpty: true)
|> timedMovingAverage(every: $Interval, period: $Interval)
|> rename(columns: {_value: “Total_IOPS”})
|> drop(columns: [“_start”, “_end”, “_field”, “_stop”])ldev_iops = from(bucket: v.bucket) // get all ldev iops
|> range(start: v.timeRangeStart, stop: v.timeRangeStop)
|> filter(fn: (r) => r._measurement == “LDEV” and r._field == “LDEV_IOPS” and r.serial == “${Serial}” and r.MPU == “MPU-010”)
|> aggregateWindow(every: 1m, fn: mean, createEmpty: true)
|> keep(columns: [“_measurement”, “_time”, “_field”, “_value”, “ldevID”])
|> rename(columns: {_value: “ldev_iops”})union(tables: [ldev_iops, total_iops]) //perform the percentage of two tables
|> map(fn: (r) => ({ r with percentage: ( float(v: r.ldev_iops) / float(v: r.total_iops)) * 100 }))
- What happened?
i got this error message:
invalid: error @18:94-18:97: expected float but found int
-
What did you expect to happen?
-
Can you copy/paste the configuration(s) that you are having problems with?
a sample of the influxdb
LDEV,HostGroup=SRV1,MPU=MPU-010,ldevID=00:03:0D,poolid=40,serial=1234 LDEV_IOPS=89 1733518860000000000
LDEV,HostGroup=SRV1,MPU=MPU-120,ldevID=00:03:00,poolid=40,serial=1234 LDEV_IOPS=89 1733518860000000000
LDEV,HostGroup=SRV2,MPU=MPU-010,ldevID=00:03:ED,poolid=40,serial=1234 LDEV_IOPS=161 1733515260000000000
LDEV,HostGroup=SRV2,MPU=MPU-010,ldevID=00:03:ED,poolid=40,serial=1234 LDEV_IOPS=124 1733515320000000000
LDEV,HostGroup=SRV1,MPU=MPU-010,ldevID=00:03:EF,poolid=40,serial=1234 LDEV_IOPS=137 1733517840000000000
LDEV,HostGroup=SRV1,MPU=MPU-010,ldevID=00:03:EF,poolid=40,serial=1234 LDEV_IOPS=133 1733517900000000000
LDEV,HostGroup=SRV1,MPU=MPU-010,ldevID=00:03:EF,poolid=40,serial=1234 LDEV_IOPS=113 1733517960000000000
LDEV,HostGroup=SRV1,MPU=MPU-010,ldevID=00:03:F1,poolid=40,serial=1234 LDEV_IOPS=161 1733515260000000000
LDEV,HostGroup=SRV1,MPU=MPU-010,ldevID=00:03:F1,poolid=40,serial=1234 LDEV_IOPS=123 1733515320000000000
LDEV,HostGroup=SRV1,MPU=MPU-010,ldevID=00:03:F1,poolid=40,serial=1234 LDEV_IOPS=176 1733515380000000000
LDEV,HostGroup=SRV1,MPU=MPU-010,ldevID=00:03:F5,poolid=40,serial=1234 LDEV_IOPS=190 1733517780000000000
LDEV,HostGroup=SRV1,MPU=MPU-010,ldevID=00:03:F5,poolid=40,serial=1234 LDEV_IOPS=137 1733517840000000000
LDEV,HostGroup=SRV1,MPU=MPU-010,ldevID=00:03:F5,poolid=40,serial=1234 LDEV_IOPS=132 1733517900000000000
LDEV,HostGroup=SRV1,MPU=MPU-010,ldevID=00:03:F5,poolid=40,serial=1234 LDEV_IOPS=112 1733517960000000000
LDEV,HostGroup=SRV1,MPU=MPU-010,ldevID=00:03:F7,poolid=40,serial=1234 LDEV_IOPS=161 1733515260000000000
LDEV,HostGroup=SRV1,MPU=MPU-010,ldevID=00:03:F7,poolid=40,serial=1234 LDEV_IOPS=122 1733515320000000000
LDEV,HostGroup=SRV1,MPU=MPU-010,ldevID=00:03:F7,poolid=40,serial=1234 LDEV_IOPS=175 1733515380000000000
the original graphic:
-
Did you receive any errors in the Grafana UI or in related logs? If so, please tell us exactly what they were.
invalid: error @18:94-18:97: expected float but found int -
Did you follow any online instructions? If so, what is the URL?
yes
Many thanks for help, i tried every things i know