Forum Discussion
seamlessfirework
Apr 12, 2023Cirrus
Hey guys,
I stumbled upon this thread by the article https://my.f5.com/manage/s/article/K72255145. Together with my go to dev ops guy I refined the script a little bit. Especially he added regexp to filter the IP addresses. I added the columns for WAF policies. Because there are two ways to implement WAF policies there are two columns for this. If you don't need this just comment the strings out of the script.
Hope this helps.
echo BIG-IP,vs name,destination,pool,pool members,WAF_profiles,WAF_policies
VIRTUALS=$(tmsh -q -c "cd / ; list /ltm virtual recursive" | grep "ltm virtual" | awk -F' ' '{print "/"$3}')
for VS in $VIRTUALS;
do
HOST=$(tmsh list sys global-settings hostname | grep hostname | cut -d" " -f6)
echo -n $HOST,
echo -n $VS,
DEST=$(tmsh list ltm virtual $VS | grep destination | grep -Eo '([0-9]{1,3}\.){3}[0-9]{1,3}')
echo -n $DEST,
POOL=$(tmsh list ltm virtual $VS | grep pool | cut -d" " -f6)
echo -n $POOL,
if [ -n "$POOL" ];
then
MBRS=$(tmsh list ltm pool "$POOL" | grep address | grep -Eo '([0-9]{1,3}\.){3}[0-9]{1,3}')
echo -n $MBRS,
fi
WAF_profiles=$(tmsh list ltm virtual $VS | grep -A 1 profiles | grep ASM | cut -d" " -f9)
echo -n $WAF_profiles,
WAF_policies=$(tmsh list ltm virtual $VS | grep -A 1 policies | grep asm | cut -d" " -f9)
echo -n $WAF_policies
echo
done