Re: [Networker] identifying storage nodes and their clients.
2005-07-13 09:06:27
Brian Greenberg wrote:
> Does anyone have a shell script that would generate a report of all the
> storage nodes on an nsr server and all the clients for that storagenode that
> I could easily import into excel? I'm having a heck of a time trying to
> derive the syntax for nsradmin. Any help or pointers to resources that would
> help me with nsradmin shell scripting would also be appreciated.
>
> I'm trying to generate a report that would give me something like this:
>
> NSR Server StorageNode Client(s)
> server1 sn1 client1 client2 client3 client4
> sn2 client5 client6 client7 client8
>
Here's a pretty simple no frills script to do this. It's flawed slightly
because the client-storage node relationship is many to many, and this
scripts works on the assumption that you will only have one storage node
defined for each client. It could be improved a lot, but since you
really only wanted to see how the nsradmin commands work it should be
sufficient.
#!/bin/ksh
# showclientsbynode
SERVER=${1:-$(uname -n)}
echo "
show name; storage nodes
print type: NSR client
" | nsradmin -s $SERVER -i - \
| sed 's/;//' | while read LINE; do
ATT=$(echo $LINE | cut -d: -f1 | sed 's/^ //')
VAL=$(echo $LINE | cut -d: -f2 | sed 's/^ //')
if [ "$ATT" = "name" ]; then
NAME=$VAL
elif [ "$ATT" = "storage nodes" ]; then
SNODE=$(echo $VAL | sed 's/,/ /g')
echo "$SNODE,$NAME"
fi
done | sort -u
--
Note: To sign off this list, send a "signoff networker" command via email
to listserv AT listserv.temple DOT edu or visit the list's Web site at
http://listserv.temple.edu/archives/networker.html where you can
also view and post messages to the list. Questions regarding this list
should be sent to stan AT temple DOT edu
=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=
|
|
|