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;

My operational command that I want to monitor is “show route receive-protocol bgp” as I am interested in the change in the number of routes advertised from BGP speaker

Create this file under the operating system shell by vi editor and save it into a file e.g then run it like;

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.

3 thoughts on “scripting commands in junos

  1. Joe

    I use the job management pane of Junos Space, but this is nice for when Space is not available.

  2. rtoodtoo Post author

    Yes Junos Space is also an option especially when it comes to policy management by Security Design.

    1. Joe

      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?


You have a feedback?

This site uses Akismet to reduce spam. Learn how your comment data is processed.