cancel
Showing results for 
Search instead for 
Did you mean: 

Clients has to be updated in the policies

maddynick4u
Level 4
 We have 60,000 clients and We need to update the clients OS version in the policies i.e hardware as well as OS , For instance in one of the policy we have linux client whose OS version is redhat ,redhat2.4 we have to update with redhat2.6, 
example2: For soalris 8 we have to update with solaris9  under the policy and under the clients tab

Can any one help me with that, I know I can do manually through GUI but is there a way to do for all the clients through some script or any thing else 


Thanks
Nick
10 REPLIES 10

rjrumfelt
Level 6
The command you want is bpplclients.  Depending on how many policies you have, you will need to generate a list of hostnames for each policy, because this command takes the policy name as one of the parameters it needs.

For each list, you can create a text file and locate it somewhere on the server,   Then create a small script using a "for" loop to execute your command.


The command you want in your script is <install_path>/openv/netbackup/bin/admincmd/bpplclients <policy_name> -modify $i -hardware Linux -os RedHat2.6

the script can look like this:

-----------------------------------------------------------------------

for i in `cat <client_list_for_each_policy>`
do
echo $i
<install_path>/openv/netbackup/bin/admincmd/bpplclients <policy_name> -modify $i -hardware Linux -os RedHat2.6

done

-------------------------------------------------------------------------

You'll need to run this for each policy you have, and each time you run it, you'll need to change the client list, which I labeled as "<client_list_for_each_policy>" and you'll need to change the policy name in the command.

Does this make sense?

Also, if you choose to use the small script above, make sure you pay attention to the symbols around the file name in the "for i in `cat <client_list_for_each_policy>`" line.  These are NOT single quotes - they are the key in the top left of your keyboard, probably under or near the "esc" key.

maddynick4u
Level 4

In my policies we have diffrent Opearting systems like windows2000 , windows 2003, windows 2008 ,solaris8,solaris9,solaris10 redhat 2.4 ,redhat 2.6 etc so what do i need to do for other operating systems , did u got vision what I am trying to achieve.

Thanks
Nick

rjrumfelt
Level 6
You would just substute the policy name, as I mentioned earlier, and then change the hardware and os flags each time you run the script.  If you have hundreds of policies, it might get monotonous, but it beats running something 60,000 times.  I was under the impression you just had 60k linux hosts you were wanting to modify.  At the least, you may have to run that command for each policy, and I was assuming that you had your policies broken down by OS.  If not, then you will need to break up your client lists within each policy according to OS type.  For example, PolicyA has 10 Windows 2000 clients and 10 Windows 2k3, you would need to make a list for the 10 W2k clients, and run the script for that list using PolicyA in hte script for the policy name, and then make a list for the 10 2k3 clients using PolicyA in the script for the policy name.

There may be others out there that do a lot more scripting than I do, but this will get you started. 

Also, you can use that for loop above as the basis for pretty much any repetitive task you need to do concerning netbackup commands.


As with anything, If I were you I would test my suggestion on a small subset of clients before attempting to roll it out en masse.

rjrumfelt
Level 6
I was trying to avoid using regex and awk :)

maddynick4u
Level 4
Thanks  stu52 and  rjrumfelt but i think there is small error in this Still not able to run can any one help me with this , I would really appreciate it

I really thanks  stu52 , rjrumfelt and other

rjrumfelt
Level 6
Remember, anything run from the admincmd directory must be run as root, so if you are not logged in and executing the script as root, then you need to add sudo to the beginning of the command:

sudo <install_path>/openv/netbackup/bin/admincmd/bpplclients $POLICY -modify $CLIENT -os $OS

Using stu's script from above.  This is of course assuming you have at least sudo access to the admincmd directory.

stu52
Level 5
Good start on the script, but another way to handle it would be to build a text file where each entry contains the policyname, hostname and the OS.  Then run a script like the following:

while read POLICY CLIENT OS
do
    echo $POLICY $CLIENT
    <install_path>/openv/netbackup/bin/admincmd/bpplclients $POLICY -modify $CLIENT -os $OS
done < policy_client_os_list



to get a list of policy, client, os that you can then modify, run the following and re-direct the output to your policy_client_os_list file:

bppllist -allpolicies | awk '{ if ($1=="CLASS") {p=$2} \
if ($1=="CLIENT"){c=$2;o=$4;printf("%s %s %s\n",p,c,o)} }'

stu52
Level 5
Of course you can also "sudo su" before running the script as well. 

The other thing would be to do manually what the old nonroot admin script did which is to change the group ownership of the executables in the <install_path>/openv/netbackup/bin/admincmd directory to some group that you are a member of.  Of course you'd have to do that as root as well which brings us round to the original point of running the script as root or run the command within the script as root using sudo.

maddynick4u
Level 4
Well let me explain you some thing I may be not be 100% right  when you use bpplclients it gets the data from the policy itself and for your information in my policy it self the data is not right i.e the OS version is not right , what come on the top of my head is ,  can we use bpgetconfig for this,

Because it goes at the client side and it gets the information from there and we can rely on that

If we can use bpgetconfig so can you modify the script and let me know

The logic of your script is perfect.

Thanks
Nick

stu52
Level 5
Nick,

yes, I suppose you COULD use the output from the bpgetconfig command to change the information for that client. 

At the moment I don't have an environment with enough clients in it to do a good test of whether this would work properly or not, but here's the modification to my script:

bppllist -allpolicies | awk '{ if ($1=="CLASS") {p=$2} \
if ($1=="CLIENT"){c=$2;o=$4;printf("%s %s %s\n",p,c,o)} }' > /tmp/mylist

while read POLICY CLIENT OS
do
    echo $POLICY $CLIENT
    NEWOS="`bpgetconfig -s $CLIENT -L | grep Platform | awk '{print $6}'`"
    <install_path>/openv/netbackup/bin/admincmd/bpplclients $POLICY -modify $CLIENT -os $NEWOS
done < /tmp/myllist


I would advise against this method however due to the fact that you cannot ensure that all clients will be up and running when you run the bpgetconfig command.  If a client is down or unreachable, the script will hang at that point and will not return any data and you will not get a value for the NEWOS variable that you would like to use in the bpplclients command. 

My preference would be the three-step method of first creating the list using the short awk script to collect all of the policy-client-os data into a file.  Next edit that file with the OS changes that you want to make (this also allows you to remove any clients that you don't wish to update).  Finally, you run the script to make the changes.