- Products
- Learn
- Local User Groups
- Partners
- More
MVP 2026: Submissions
Are Now Open!
What's New in R82.10?
Watch NowOverlap in Security Validation
Help us to understand your needs better
CheckMates Go:
Maestro Madness
I need to check quite often during maintenance windows how it looks with BGP peers before and after change steps. Especially on VSX is useful to get a quick way how to check something across all virtual systems. Following command list you all BGP peers across virtual systems. It works on non-vsx as well.
Command:
echo -e "\e[36m+++++++++++++++++++++++++++\n++ BGP peers status ++\n+++++++++++++++++++++++++++\n";for i in /proc/vrf/*; do i=${i#*vrf/}; echo -n -e "\e[93m"; vsenv $i | grep -e "Contex" | sed 's/^Context is set to Virtual Device //' | sed 's/ID/Context/'; echo -n -e "\e[0m"; echo "set virtual-system" $i > /tmp/clishcmd; echo "show bgp peers" >> /tmp/clishcmd; clish -i -f /tmp/clishcmd | grep -vi -e "contex" -e "show" -e "done" -e "flag" -e"^$"; echo; done
Original command idea how to list across contexts is not my own. I got is as advice during TAC case some years ago. You can basically use it to list anything (blue area) in case you are fine with little messy output. It is just simple setup of cmd file for clish:
for i in /proc/vrf/*; do i=${i#*vrf/}; vsenv $i; echo "set virtual-system" $i > /tmp/clishcmd; echo "show bgp peers" >> /tmp/clishcmd; clish -i -f /tmp/clishcmd; done
Hope you'll enjoy it.
Thank you! I'm glad you like it.
Maybe you could use column to show the rows more nicely formatted?
Hi Peter
I want to do the same thing but that script only works for the old kernel VSX, it would need to be updated for the new kernel (specifically the “for i in /proc/vrf/*; do i=${i#*vrf/}” part because they use namespace now instead of vrf.
Maybe something like this?
echo -e "\e[36m+++++++++++++++++++++++++++\n++ BGP peers status ++\n+++++++++++++++++++++++++++\n"; for i in $(cpstat vsx -f stat | awk -F'|' '/Virtual System/ {gsub(/ /,"",$2); print $2}'); do echo -n -e "\e[93m"; vsenv $i | grep -e "Contex" | sed 's/^Context is set to Virtual Device //' | sed 's/ID/Context/'; echo -n -e "\e[0m"; echo "set virtual-system $i" > /tmp/clishcmd; echo "show bgp peers" >> /tmp/clishcmd; clish -i -f /tmp/clishcmd 2>/dev/null | grep -vi -e "contex" -e "show" -e "done" -e "flag" -e "^$" -e "not configured" -e "CLICMD0159" -e "RTGRTG0019" -e "BGP: Local Autonomous System is not configured."; echo; done
Leaderboard
Epsum factorial non deposit quid pro quo hic escorol.
| User | Count |
|---|---|
| 19 | |
| 17 | |
| 14 | |
| 8 | |
| 7 | |
| 3 | |
| 3 | |
| 3 | |
| 3 | |
| 2 |
Tue 16 Dec 2025 @ 05:00 PM (CET)
Under the Hood: CloudGuard Network Security for Oracle Cloud - Config and Autoscaling!Thu 18 Dec 2025 @ 10:00 AM (CET)
Cloud Architect Series - Building a Hybrid Mesh Security Strategy across cloudsTue 16 Dec 2025 @ 05:00 PM (CET)
Under the Hood: CloudGuard Network Security for Oracle Cloud - Config and Autoscaling!Thu 18 Dec 2025 @ 10:00 AM (CET)
Cloud Architect Series - Building a Hybrid Mesh Security Strategy across cloudsAbout CheckMates
Learn Check Point
Advanced Learning
YOU DESERVE THE BEST SECURITY