i have below multipath output.
mig_1 (3624a9370908ba6a5e68a464600014087) dm-11 PURE,FlashArray
size=5.0T features='0' hwhandler='0' wp=rw
`-+- policy='queue-length 0' prio=1 status=active
|- 0:0:2:3 sdeo 129:0 active ready running
|- 0:0:3:3 sdep 129:16 active ready running
|- 1:0:2:3 sdeq 129:32 active ready running
`- 1:0:3:3 sder 129:48 active ready running
mig_2 (3624a9370908eb6a5f69a4646000140bb) dm-10 PURE,FlashArray
size=7.0T features='0' hwhandler='0' wp=rw
`-+- policy='queue-length 0' prio=1 status=active
|- 0:0:2:2 sdkg 66:320 active ready running
|- 0:0:3:2 sdkh 66:336 active ready running
|- 1:0:2:2 sdki 66:352 active ready running
`- 1:0:3:2 sdkj 66:368 active ready running
Would like to check how many active paths exist for each LUN. If the LUN is not having /active ready running/ it should decrease the count. Tried the below way, but it is not providing the required result. It is providing the total count for all the LUN's, also size is coming in different line.
cat multi | awk '/dm-1/ {print $1"\t"$2} ; /^size/ {print $1} ; /active ready running/ {a++} END {print a}'
mig_1 (3624a9370908ba6a5e68a464600014087)
size=5.0T
mig_2 (3624a9370908eb6a5f69a4646000140bb)
size=7.0T
8
Expected output like below:
Disk #1: mig_1 (3624a9370908ba6a5e68a464600014087) size=5.0T active_paths:4
Disk #2: mig_2 (3624a9370908eb6a5f69a4646000140bb) size=7.0T active_paths:4
Kindly advise how to achieve the above output.