How to List All Active Clients (on a linux master server)
Here is a single command the dumps all active clients from a Linux Master Sever.
bppllist -L -allpolicies | egrep "^Policy Name:|^Active:" | paste - - | awk '$NF~yes { print $3 }' | xargs -i bpplclients {} -noheader 2> /dev/null | awk '{ print $3 }'
It does the following
- List details of all policies
- Extract only policy name and active status
- Put all that info on one line
- If the last field of that line is yes, print the third field which is the policy name
- This long list of active policies is passed (one at a time) to bpplclients, errors are hidden and only the client name is printed (assuming clients have no spaces in the name)
-- OR --
Run this script for a little prettier output of the same thing:
Sample ::
##### DenverWebservers #####
bubbles
nerf
billybong
##### DenverDatbases #####
spaceman
nerf
kooliba
for POLICY in ` bppllist -L -allpolicies | egrep "^Policy Name:|^Active:" | paste - - | awk '$NF~yes { print $3 }'`; do
echo "#### $POLICY ###"
bpplclients $POLICY -noheader 2> /dev/null | awk '{ printf "%30s\n", $3 }'
echo " "
done
----
It's probably more useful if you sort the output:
bppllist -L -allpolicies | egrep "^Policy Name:|^Active:" | paste - - | awk '$NF~yes { print $3 }' | xargs -i bpplclients {} -noheader 2> /dev/null | awk '{ print $3 }' | sort -u