Networker

Re: [Networker] Batch Client Changes

2008-03-14 14:29:48
Subject: Re: [Networker] Batch Client Changes
From: Preston de Guise <enterprise.backup AT GMAIL DOT COM>
To: NETWORKER AT LISTSERV.TEMPLE DOT EDU
Date: Sat, 15 Mar 2008 05:26:56 +1100
On 15/03/2008, at 5:08 AM, tkutil wrote:

How do I make batch changes to clients. I would like to add another group membership to all of my clients.


Depends on your version of NetWorker. Using v7.2.x and below, if you run up the Windows GUI you can just drag a collection of clients over a group (from memory). I don't believe this is supported in NMC - certainly not pulling up NMC on a Mac pointing to GSTD running on a Linux host I can't get any client dragging to work... I've noticed another poster saying it does work, so presumably that's on Windows or v7.4.x.

From the command line, it's not trivial...

Normally you can batch override changes to clients quite easily. E.g., if you wanted to say, turn off scheduled backups for all clients, you could do something such as:

cat <<EOF | nsradmin -i -
. type: NSR client
update scheduled backup: Disabled
EOF

However, the "update" command overwrites the given field with the new value; this means whatever you set to update is replaced, not appended to.

Thus, what you would actually need to do is build a small script which will take the content of the existing "group" setting for a client, add to it, and then update the client with the new setting. So the procedure would be:

1. Given a list of clients and a group name
2. Invoke nsradmin and retrieve the client name/name of group, e.g.:

cat <<EOF | nsradmin -i -
show name:; group:
print type: NSR client; name: myClient
EOF

3. Capture the above output - for each client it would look similar in format to the following:

                        name: belle;
                       group: Staging Desktops, Staging Full;

4. Pull out the group entry, sanitise it, and append to it so you can do something such as:

cat <<EOF | nsradmin -i -
. type: NSR client; name: myClient
update group: Staging Desktops, Staging Full, My New Group
EOF

Note however, that if there are multiple client definitions, you'll also need to retrieve additional client information from nsradmin, and/ or customise your query, to ensure that you ONLY adjust the client entry that you want to modify. Using the resource identifier string is good for this:

cat << EOF | nsradmin -i -
show name:; group:; resource identifier:
option resource id
print type: NSR client; name: myClient
EOF

Then:

cat <<EOF | nsradmin -i -
. type: NSR client; resource identifier: 22.0.233.16.43.209.219.69.192.168.100.6(106)
update group: Group1, Group2, Group3, etc
EOF


As always with nsradmin, test first just using print commands, and grab a clean copy of your /nsr/res directory in case you have to roll back. However in this case, the GUI is a faster way of doing these sorts of changes - so long as the GUI you're using can drag and drop :-)

Cheers,

Preston.


--
Preston de Guise


"Enterprise Systems Backup and Recovery: A Corporate Insurance Policy", due out August 15 2008:

http://www.crcpress.com/shopping_cart/products/product_detail.asp?sku=AU6396&isbn=9781420076394&parent_id=&pc=

To sign off this list, send email to listserv AT listserv.temple DOT edu and type 
"signoff networker" in the body of the email. Please write to networker-request 
AT listserv.temple DOT edu if you have any problems with this list. You can access the 
archives at http://listserv.temple.edu/archives/networker.html or
via RSS at http://listserv.temple.edu/cgi-bin/wa?RSS&L=NETWORKER