scripting commands in junos
One of the things that I need during troubleshooting sessions is to run a specific command at regular intervals. Instead of doing this manually you can create a tiny script to run your command every second for you. Here is how you can do it;
while [ 1 ] do cli -c "show route receive-protocol bgp 192.168.3.3" sleep 1 done
My operational command that I want to monitor is “show route receive-protocol bgp 192.168.3.3” as I am interested in the change in the number of routes advertised from BGP speaker 192.168.3.3
Create this file under the operating system shell by vi editor and save it into a file e.g route_monitor.sh then run it like;
%sh route_monitor.sh
You will see that script will sleep 1 sec and then run the operational command for you. The operational show command is just a silly example. You can replace it with anything you like e.g neighbor monitoring etc.
I use the job management pane of Junos Space, but this is nice for when Space is not available.
Yes Junos Space is also an option especially when it comes to policy management by Security Design.
I work a lot with Juniper SRX’s and JUNOS Automation with SLAX code. One of my current projects is building an extension to Junos Space that is an HTML5 and Sencha Touch enabled GUI for Junos Space that is capable of providing SRX management from any mobile phone or tablet. I would enjoy bouncing some of my troubles and ideas off your extensive experience, how can we better communicate if that is an option?