LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (https://www.linuxquestions.org/questions/programming-9/)
-   -   Correlate output from multiple commands (https://www.linuxquestions.org/questions/programming-9/correlate-output-from-multiple-commands-569845/)

wendtbd 07-16-2007 12:18 PM

Correlate output from multiple commands
 
I am looking for a way to correlate data from three commands to make file system management a little easier. Below are the commands and some output from each...

vgdisplay -v (Looking for the Volume Group name and the dm device information)

--- Volume group ---
VG Name vg05
System ID
Format lvm2
Metadata Areas 1
Metadata Sequence No 36
VG Access read/write
VG Status resizable
MAX LV 0
Cur LV 1
Open LV 0
Max PV 0
Cur PV 1
Act PV 1
VG Size 39.97 GB
PE Size 32.00 MB
Total PE 1279
Alloc PE / Size 1279 / 39.97 GB
Free PE / Size 0 / 0
VG UUID JoU3EO-lILs-czl3-LlOj-db8h-w6Xs-iYqsCx

--- Logical volume ---
LV Name /dev/vg05/nfshome
VG Name vg05
LV UUID 1QbfHK-f6AD-9frI-C7AW-68Rv-CtaD-aTtevX
LV Write Access read/write
LV Status NOT available
LV Size 39.97 GB
Current LE 1279
Segments 1
Allocation inherit
Read ahead sectors 0

--- Physical volumes ---
PV Name /dev/dm-31
PV UUID DIMnL4-PTzH-gfiP-veTM-lyna-BPAJ-9wJLTi
PV Status allocatable
Total PE / Free PE 1279 / 0

ls -l /dev/mpath (Correlate the dm device found above to the mpath #)
lrwxrwxrwx 1 root root 8 Jul 16 10:44 mpath11 -> ../dm-31

Multipath -ll (List the sdxx devices associated with the mpath device)
mpath11 (3600508b4001058b60000700003ac0000)
[size=40 GB][features="1 queue_if_no_path"][hwhandler="0"]
\_ round-robin 0 [prio=100][active]
\_ 2:0:0:201 sdcx 70:80 [active][ready]
\_ 3:0:0:201 sdeu 129:96 [active][ready]
\_ round-robin 0 [prio=20][enabled]
\_ 1:0:0:201 sdba 67:64 [active][ready]
\_ 0:0:0:201 sdd 8:48 [active][ready]

I am sure this is all possible with grep, sed and awk but I am not a programmer and don't know these tools well enough. If anyone has any suggestions I would appreciate it.

Thanks
Barrett Wendt

ta0kira 07-16-2007 11:55 PM

It all depends on what you mean by "correlate". Do you mean tabulate correlated information by device name? Do you mean research a single device and extract everything related to it?
ta0kira

wendtbd 07-17-2007 07:18 AM

Maybe correlate isn't the correct word here.

Ideally the script would output the data for all the dm devices available on the server but if it is easier to just get the information for one device that would be fine.

ta0kira 07-17-2007 06:04 PM

From the command output in your first post, what would be the ideal processed output?
ta0kira

wendtbd 07-18-2007 07:16 AM

Actually I found another command that gives me more of what I am looking for but not everything...

lvs -o +devices

LV VG Attr LSize Origin Snap% Move Log Copy% Devices
LogVol00 VolGroup00 -wi-ao 20.53G /dev/cciss/c0d0p4(0)
LogVol01 VolGroup00 -wi-ao 39.81G /dev/cciss/c0d0p4(657)
u01 vg01 -wi-ao 725.53G /dev/dm-26(0)
u01 vg01 -wi-ao 725.53G /dev/dm-59(0)
u01 vg01 -wi-ao 725.53G /dev/dm-60(0)
u01 vg01 -wi-ao 725.53G /dev/dm-5(0)
u01 vg01 -wi-ao 725.53G /dev/dm-6(0)
u01 vg01 -wi-ao 725.53G /dev/dm-13(0)
u01 vg01 -wi-ao 725.53G /dev/dm-38(0)
u01 vg01 -wi-ao 725.53G /dev/dm-45(15)
u01 vg01 -wi-ao 725.53G /dev/dm-40(16)
u02 vg01 -wi-ao 1.00G /dev/dm-26(11328)
u02 vg01 -wi-ao 1.00G /dev/dm-40(0)
u03 vg01 -wi-ao 960.00M /dev/dm-26(11344)
u03 vg01 -wi-ao 960.00M /dev/dm-45(0)
u01 vg02 -wi-ao 9.31G /dev/dm-9(0)
export vg03 -wi--- 39.97G /dev/dm-28(0)
u99 vg04 -wi-ao 59.97G /dev/dm-29(0)
nfshome vg05 -wi--- 39.97G /dev/dm-30(0)
arch vg06 -wi--- 3.00G /dev/dm-16(384)
u01 vg06 -wi--- 5.00G /dev/dm-16(0)
u02 vg06 -wi--- 7.00G /dev/dm-18(0)
u03 vg06 -wi--- 7.00G /dev/dm-16(160)
u04 vg06 -wi--- 9.00G /dev/dm-18(224)
arch vg07 -wi--- 3.00G /dev/dm-32(256)
u01 vg07 -wi--- 3.00G /dev/dm-32(0)
u02 vg07 -wi--- 5.00G /dev/dm-33(0)
u03 vg07 -wi--- 5.00G /dev/dm-32(96)
u04 vg07 -wi--- 4.00G /dev/dm-33(160)
arch vg08 -wi--- 9.00G /dev/dm-54(0)
u01 vg08 -wi--- 5.00G /dev/dm-48(0)
u01 vg08 -wi--- 5.00G /dev/dm-48(1152)
u02 vg08 -wi--- 4.00G /dev/dm-48(96)
u03 vg08 -wi--- 3.00G /dev/dm-48(224)
u04 vg08 -wi--- 13.00G /dev/dm-48(320)
u05 vg08 -wi--- 13.00G /dev/dm-48(736)

If I could add the mpath information and the sdxx information to this listing it would be ideal. To answer your question though, this is the output format I am looking for. Of course this only shows what dm devices are in use but thats ok for now.


All times are GMT -5. The time now is 03:44 PM.