SRX

last person joined: yesterday 

Ask questions and share experiences about the SRX Series, vSRX, and cSRX.
  • 1.  SRX scripting - repeat a command and save output

    Posted 07-15-2013 02:04

    Dear All,

     

    Can anybody please tell me if there is any script for srx 5800 that run a show command (e.g. show interface xe-0/0/0) every 10 seconds and append the output  of command in a file?

     

    Please advise.

     

    Regards

    Yham



  • 2.  RE: SRX scripting - repeat a command and save output
    Best Answer

    Posted 07-15-2013 10:02

    Hello,

    If You are flexible on timing and prepared to have each output in a separate file (rather than appended to one big file) then You don't need a script. Config example below:

     

    event-options {
        generate-event {
            1min time-interval 60;
        }
        policy record-every-1min {
            events 1min;
            then {
                execute-commands {
                    commands {
                        "show chassis routing-engine";
                    }
                    output-filename monitoring;
                    destination local;
                    output-format text;
                }
            }
        }
        destinations {
            local {
                archive-sites {
                    /var/tmp;
                }
            }
        }
    }

    The files (one file per each policy run) will be named /var/tmp/<hostname>-monitoring-<timestamp> 

    HTH

    Thanks

    Alex

     

     



  • 3.  RE: SRX scripting - repeat a command and save output

    Posted 07-17-2013 21:16

    Hi,

     

    Though i  gotta use a simple bash script and ran in crontab, it worked fine for me but one you shared is indeed useful stuff.

     

    Thanks