cancel
Showing results for 
Search instead for 
Did you mean: 

clients in active policies only

noazara
VIP
   VIP   

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

1 ACCEPTED SOLUTION

Accepted Solutions

Marianne
Moderator
Moderator
Partner    VIP    Accredited Certified

@noazara

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

View solution in original post

3 REPLIES 3

Marianne
Moderator
Moderator
Partner    VIP    Accredited Certified

@noazara

I see that you have found this post: 

https://vox.veritas.com/t5/NetBackup/How-to-List-All-Active-Clients-on-a-linux-master-server/m-p/642...

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.

noazara
VIP
   VIP   

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]#

Marianne
Moderator
Moderator
Partner    VIP    Accredited Certified

@noazara

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