Here is a small script to get the list of policies configured against a list of clients using netbackup commandline. Command used is bpplclients to get the clients.
Put the list of policy in a file /tmp/policy_list.
# cat /tmp/policy_list policy01 policy02 policy03
The script :
for i in `cat /tmp/policy_list` do bpplclients $i -noheader | awk 'BEGIN {printf "'$i'"}{print "," $NF}' done > /tmp/output.csv
Below is the Output file [ comma (,) separated ]
policy01,client01 ,client02 policy02,client01 policy03,client01
The output CSV file should look like below :
Policy Name | Clients |
---|---|
policy01 | client01 |
client02 | |
policy02 | client01 |
policy03 | client01 |
Different output format
In the output shown above, Policy name is printed only once for multiple clients. To get the CSV file in the format where backup policy is printed on each line for every client, Use the below script :
for i in `cat /tmp/policy_list` do bpplclients $i -noheader | awk '{printf "'$i'" "," $NF}' done > /tmp/output.csv
Below is the Output file [ comma (,) separated ]
policy01,client01 policy01,client02 policy02,client01 policy03,client01
The output CSV file should look like below :
Policy Name | Clients |
---|---|
policy01 | client01 |
policy01 | client02 |
policy02 | client01 |
policy03 | client01 |