Collect WWN from AIX Systems

Collect WWN from AIX Systems

I have a need to collect all the WWN from my AIX systems that are running. Unfortunately I’m inheriting this environment from someone and they didn’t keep records and I’m really not interested in the other method of getting them from the HMC. I have a file that has all the systems or IP address that I need the names from called “hostfile” in the current directory – you can parse this from any file you have with just a bit more scriptfu if you need.

#!/usr/bin/sh
for x in `cat hostfile | sort`

do
  echo $x
  ssh root@$x "for i in \`lsdev -Cc adapter | grep fcs | awk '{print \$1}'\`; do \
    lscfg -vpl \$i | grep 'Network Address'; done"
done

Running this will produce output similar to this:

server01
  Network Address.............C0xxxxxxxxxxxxxx
  Network Address.............C0xxxxxxxxxxxxxx
  Network Address.............C0xxxxxxxxxxxxxx
  Network Address.............C0xxxxxxxxxxxxxx

server02
  Network Address.............C0xxxxxxxxxxxxxx
  Network Address.............C0xxxxxxxxxxxxxx
  Network Address.............C0xxxxxxxxxxxxxx
  Network Address.............C0xxxxxxxxxxxxxx

server03
  Network Address.............C0xxxxxxxxxxxxxx
  Network Address.............C0xxxxxxxxxxxxxx
  Network Address.............C0xxxxxxxxxxxxxx
  Network Address.............C0xxxxxxxxxxxxxx

(With the actual WWN of course)

Cheers!