12-25-2018 01:49 AM
Hi Guys,
i have the below script to find the clients in activie policies only.
[root@bkp01 admincmd]# cat activeclients.sh
#!/bin/ksh
PATH=$PATH:/usr/openv/netbackup/bin/admincmd
activeclients () {
bppllist -allpolicies | awk '$1=="CLASS" {pl=$2;set=0}
$1=="INFO" && $12==0 {set=1}
$1=="CLIENT" && set==1 {print $2}' | sort
-u
}
for client in `activeclients`
do
echo "$client:c"
bppllist -byclient $client | awk '$1=="CLASS" {printf("%s ",$2)}'
echo ""
done
But this script gives the client name present in deactivate policy also.I need clients present in active policies only with daily schedule configured.Please help me in changing the script parameter for the same.
output from the script:
[root@bkpma01 admincmd]# ./activeclients.sh > 1.txt
./activeclients.sh[16]: -u: not found
[root@bkpma01 admincmd]# cat 1.txt
lv100:c
bkpolicy1
lv101:c
bkpolicy2 bkpolicy2-VM
lv102:c
bkpolicy3 bkpolicy3-VM bkpolicy3_FF
lv103:c
bkpolicy4 bkpolicy4-VM bkpolicy4_FF
Solved! Go to Solution.
12-31-2018 01:40 AM
I do not have an active NBU installation to test myself.
Please 'play' with samples found in this forum.
If you run the 1st part of above command : bppllist -L -allpolicies | egrep "^Policy Name: |^Active:"
You should see something like this: (I have used nbsu bppllist output from a customer)
Policy Name: ADHOC_UNIX
Active: no
Policy Name: ADHOC_WINTEL
Active: yes
Policy Name: XXX_CATALOG
Active: yes
Policy Name: LINUX_DEV
Active: yes
If you then add
|^Client/HW
to the 'egrep' section, you will see the client names as well.
Adding
| grep -v no
will exclude all inactive policies.
Yes, the output will look 'messy', but you can use your scripting skills to tidy up the output.
I have managed to do the following with output of bppllist -L -allpolicies > NBU_bppllist.txt :
cat NBU_bppllist.txt |egrep "^Policy Name: |^Active: |^Client/HW" |grep -v no >active.txt
cat active.txt |grep Client |awk '{print $2}'|sort -u
Also have a look at this post: https://vox.veritas.com/t5/NetBackup/Need-active-backup-clients-list/td-p/502761#M116656
12-27-2018 12:20 AM - edited 12-27-2018 12:22 AM
I see that you have found this post:
There is problem with display in this forum that changes a ':' followed by a '|' into a smiley face: :|
So, when I insert a space between the 2 (after Policy Name), it looks like this :
bppllist -L -allpolicies | egrep "^Policy Name: |^Active:" | paste - - | awk '$NF~yes { print $3 }' | xargs -i bpplclients {} -noheader 2> /dev/null | awk '{ print $3 }'
Please try again.
12-27-2018 10:33 AM
Hi marianne,
This is giving no output:
[root@bkpma01 admincmd]# ./bppllist -L -allpolicies | egrep "^Policy Name: |^Active:" | paste - - | awk '$NF~yes { print $3 }' | xargs -i bpplclients {} -noheader 2> /dev/null | awk '{ print $3 }'
[root@bkpma01 admincmd]#
12-31-2018 01:40 AM
I do not have an active NBU installation to test myself.
Please 'play' with samples found in this forum.
If you run the 1st part of above command : bppllist -L -allpolicies | egrep "^Policy Name: |^Active:"
You should see something like this: (I have used nbsu bppllist output from a customer)
Policy Name: ADHOC_UNIX
Active: no
Policy Name: ADHOC_WINTEL
Active: yes
Policy Name: XXX_CATALOG
Active: yes
Policy Name: LINUX_DEV
Active: yes
If you then add
|^Client/HW
to the 'egrep' section, you will see the client names as well.
Adding
| grep -v no
will exclude all inactive policies.
Yes, the output will look 'messy', but you can use your scripting skills to tidy up the output.
I have managed to do the following with output of bppllist -L -allpolicies > NBU_bppllist.txt :
cat NBU_bppllist.txt |egrep "^Policy Name: |^Active: |^Client/HW" |grep -v no >active.txt
cat active.txt |grep Client |awk '{print $2}'|sort -u
Also have a look at this post: https://vox.veritas.com/t5/NetBackup/Need-active-backup-clients-list/td-p/502761#M116656