Okay, I feel like I need to bow to the Linux gods on this one. Been at it for 2 hours now with no luck, and my Google Fu is spectacularly unhelpful. Here's the deal:
I have a bunch of different servers that have a bunch of LSI RAID controllers that I need to run a command on to output SMART data. The problem with LSI is that it assigns the individual drives totally random 'id' numbers; anywhere from 7 up to the high 30s. I know that I can do:
But the problem is that I then get a bunch of completely meaningless lines for drive ids that *aren't* on that system. Is there any way to filter those out completely? For instance, have it check the entire sequence, but not output all of the drive ids that are not in the system? Or, I guess even more ideally, somehow coming up with a command that only checks the drive ids that ARE in the system (i.e., that don't return an error for "megaraid,$i")? I looked up using sed to accomplish it, but damned if I can get it working.
I have a bunch of different servers that have a bunch of LSI RAID controllers that I need to run a command on to output SMART data. The problem with LSI is that it assigns the individual drives totally random 'id' numbers; anywhere from 7 up to the high 30s. I know that I can do:
Code:
for i in seq '0 40'`; do echo; echo "Port $i:"; sudo ./smartctl -a -d megaraid,$
But the problem is that I then get a bunch of completely meaningless lines for drive ids that *aren't* on that system. Is there any way to filter those out completely? For instance, have it check the entire sequence, but not output all of the drive ids that are not in the system? Or, I guess even more ideally, somehow coming up with a command that only checks the drive ids that ARE in the system (i.e., that don't return an error for "megaraid,$i")? I looked up using sed to accomplish it, but damned if I can get it working.