Junos OS

Expand all | Collapse all

Event-options + execute-command

Jump to Best Answer
  • 1.  Event-options + execute-command

    Posted 10-20-2013 06:10

    Hi there!

    Iam trying to make a simple event:

     

    1) RPM pings a destination IP

    2) Event ping_test_fail and trigger an interface down command

     

    I made this work with RPM, EVENT + EVENT SCRIPT called disable-interface.slax and it worked well.

     

    But after that i realised there are options for executing commands directly in event-option subcommand without using the external script. This is my current (non script) configuration:

     

     

     

    set services rpm probe icmp-ping-probe test ping-probe-test probe-type icmp-ping
    set services rpm probe icmp-ping-probe test ping-probe-test target address 40.0.0.1
    set services rpm probe icmp-ping-probe test ping-probe-test test-interval 5

     

    set event-options policy PING_FAIL events ping_test_failed
    set event-options policy PING_FAIL within 1 trigger on
    set event-options policy PING_FAIL within 1 trigger 1
    set event-options policy PING_FAIL then execute-commands commands configure     (*tried without this command)
    set event-options policy PING_FAIL then execute-commands commands "set interfaces ae0 disable"
    set event-options policy PING_FAIL then execute-commands commands commit    (*tried without this command)
    set event-options policy PING_FAIL then execute-commands user-name root

     

     

    It doesn't work. RPM service indicates that probes are down but the configuration isnt submitting (nothing happens)

    I need to execute many commands in future and I really dont wanna use script for that, if its a build-in option.

     

     

    Any ideas?

     

    Huge thanks! 🙂

     

    Roma

     

     



  • 2.  RE: Event-options + execute-command
    Best Answer

    Posted 10-20-2013 11:12

    Hello,

     

    Firstly, I wonder if You already have seen the manual/read this link ?

    https://www.juniper.net/techpubs/en_US/junos12.1/topics/topic-map/junos-script-automation-event-policy-change-configuration.html

     

    Secondly, "change-condiguration" feature requires JUNOS 12.1 or newer.

    HTH

    Thanks

    Alex



  • 3.  RE: Event-options + execute-command

    Posted 10-21-2013 01:42

    Oh ... now i see this.. on 11.4 version its only for Operational Commands (like show)..

    http://www.juniper.net/techpubs/en_US/junos/topics/usage-guidelines/automation-configuring-an-event-policy-to-execute-operational-mode-commands.html 

     

    😞

     

     

    EDITED: Upgraded to 12.2 R6 - works great! 😄



  • 4.  RE: Event-options + execute-command

    Posted 11-28-2017 17:57

     

    hi guys, got an mx with 2 interfaces configured for 2 isps.

    on my branch, i got 1 srx with 2 interfaces configured also for 2 isps.

    i configured rpm and event-options on my mx to detect any link failure on the brWAN ips.

    the event-options i configured below. i disconnected the  1.1.1.2 interface on the other side of the link and the script didnt work. need to verify if there are parameters of which im lacking.

     

    EVENT-OPTIONS

    set event-options policy isp1-down events ping_test_failed
    set event-options policy isp1-down within 10 trigger on
    set event-options policy isp1-down within 10 trigger 3
    set event-options policy isp1-down within 15 trigger until
    set event-options policy isp1-down within 15 trigger 4
    set event-options policy isp1-down attributes-match ping_test_failed.test-owner matches isp1-down-probe
    set event-options policy isp1-down attributes-match ping_test_failed.test-name matches isp1-icmp-down
    set event-options policy isp1-down then change-configuration retry count 3
    set event-options policy isp1-down then change-configuration retry interval 60
    set event-options policy isp1-down then change-configuration commands "deactivate services rpm probe isp1-down-probe"
    set event-options policy isp1-down then change-configuration commands "activate services rpm probe isp1-up-probe"
    set event-options policy isp1-down then change-configuration commands "set routing-options static route 7.7.7.0/24 next-hop 2.2.2.2"
    set event-options policy isp1-down then change-configuration commands commit
    set event-options policy isp1-down then change-configuration commit-options log "route failover"

    RPM

    set services rpm probe isp1-down-probe test isp1-icmp-down probe-type icmp-ping
    set services rpm probe isp1-down-probe test isp1-icmp-down target address 1.1.1.2 (ip address of the upstream router connected to the srx)
    set services rpm probe isp1-down-probe test isp1-icmp-down test-interval 30
    set services rpm probe isp1-down-probe test isp1-icmp-down thresholds successive-loss 4
    set services rpm probe isp1-down-probe test isp1-icmp-down destination-interface ge-1/1/10.0

      thank yo.