Junos Automation (Scripting)
Reply
Visitor
Torsten
Posts: 2
Registered: ‎02-10-2011
0

Re: Explain enable-primary-nexthop script

Hi dugolotti,

 

thanks for your reply. I've compared your scripts with mine and saw that my declaration of $static was wrong. Now I've changed it to

var $static = $current/routing-instances/instance[name == "HTTP-Redirect"]/routing-options/static;

 

 

and it's working fine. :smileyhappy:

 

Thanks again,

Torsten

Visitor
RJ78
Posts: 4
Registered: ‎02-23-2011
0

Re: Explain enable-primary-nexthop script

Hi, I'm trying to use the enable-primary-nexthop.slax and enable-alternate-nexthop.slax.

My problem is When the ping is failed goes down the enable-alternate script is become active is work, but when the ping is successful the interface keep disable.

Please help me :smileysad:

Visitor
dave@revolutionprep.com
Posts: 7
Registered: ‎05-16-2011
0

Re: Explain enable-primary-nexthop script

[ Edited ]
Thank you so much for this script--it worked perfectly!  Is there a way to test MULTIPLE IPs, so that the alternate route is only used if BOTH IPs fail? 

ccall wrote:

In that case, change your 0/0 static route config to this:

 

     route 0.0.0.0/0 {
            qualified-next-hop 192.168.0.113;
            qualified-next-hop 10.10.20.3 {
                preference 200;
            }
        }

 

And your event-options config to this:

 

event-options {
    policy test-failed {
        events PING_TEST_FAILED;
        within 240 events [ PING_TEST_COMPLETED KERNEL SYSTEM ];
        attributes-match {
            ping_test_failed.test-owner matches icmp-ping-probe;
            ping_test_failed.test-name matches ping-probe-test;
            ping_test_completed.test-owner matches icmp-ping-probe;
            ping_test_completed.test-name matches ping-probe-test;
            SYSTEM.message matches "Starting of initial processes complete";
            KERNEL.message matches "event-processing \(PID.*\)started";
        }
        then {
            event-script watch-default-route.slax {
                arguments {
                    next-hop 192.168.0.113;
                }
            }
        }
    }
    policy test-completed {
        events PING_TEST_COMPLETED;
        within 240 events [ PING_TEST_FAILED KERNEL SYSTEM ];
        attributes-match {
            ping_test_completed.test-owner matches icmp-ping-probe;
            ping_test_completed.test-name matches ping-probe-test;
            ping_test_failed.test-owner matches icmp-ping-probe;
            ping_test_failed.test-name matches ping-probe-test;
            SYSTEM.message matches "Starting of initial processes complete";
            KERNEL.message matches "event-processing \(PID .*\) started";
        }
        then {
            event-script watch-default-route.slax {
                arguments {
                    next-hop 192.168.0.113;
                }
            }
        }
    }
    event-script {
        file watch-default-route.slax;
    }
}

 

And then copy the attached event script to your /var/db/scripts/event directory.


 

 

Visitor
mbeckman
Posts: 7
Registered: ‎03-28-2011
0

Re: Explain enable-primary-nexthop script

I have implemented CCALL's script and parameters and left the RPM config as stated in the original config. The problem is that I am not using the default route - I am using this script for WAN backup VPN connectivity. When a T1 at a remote site fails the qualified next hop kicks in - but at the HQ office it still trys to send out the original path - so I tried this watch script and replaced all the 0.0.0.0/0 and the 0/0 routes to 172.17.35.1/24 and it does not seem to be working. Any ideas - I cant seem to figure out if the RPM probes are working correctly or not either. Is there a way to see if the script actually kicks off?

 

Recognized Expert
Mattia
Posts: 198
Registered: ‎03-17-2010
0

Re: Explain enable-primary-nexthop script

Hello, you can see wether an event script has started enabling traceoptions under the event-options event-script configuration hierachy, as explained here.

Then you can type show log escript.log to see the logged data.

 

If you notice that the script is not being kicked, you should make sure that the event-policy is triggering it. So you will have to configure traceoptions under event-policy hierarchy as well.

 

By inspecting this files you should be able to understand what is happening. Let me know what you find!

Mattia

.................................................................................
JNCIP-ENT, JNCIP-SEC, JNCIS-SP
(If this post helped you, please mark it as an "Accepted Solution"; kudos are also appreciated!)


Visitor
mbeckman
Posts: 7
Registered: ‎03-28-2011
0

Re: Explain enable-primary-nexthop script

Ok I got the script working finally! Thanks a TON

 

1 last problem -

 

When the route to a WAN site fails over to the higher weighted Qualified next hop - obviously the pings succeed. So after the alloted timer or event value - the script adds back the primary route because it thinks the route is good now. (Since I am watching the same IP address for both parts of the script)

 

Any ideas on how to fix that?

 

 

Recognized Expert
Mattia
Posts: 198
Registered: ‎03-17-2010
0

Re: Explain enable-primary-nexthop script

HI, i think you have 2 options (both of them involve editing the rpm probe):

 

1- Use the IP address of the next-hop towards the ISP that you are monitoring as the target of the rpm probe, instead of using a remote site.

2- Under the rpm probe configuration, specify the nex-hop interface on the primary route as the destination-interface.

 

.................................................................................
JNCIP-ENT, JNCIP-SEC, JNCIS-SP
(If this post helped you, please mark it as an "Accepted Solution"; kudos are also appreciated!)


Visitor
mbeckman
Posts: 7
Registered: ‎03-28-2011
0

Re: Explain enable-primary-nexthop script

I have this working for one of the remote sites (i changed the scripts and probes to monitor a remote office) the problem is that with this script the process does not seem repeatable because of the KERNEL messages etc...

 

Is there a way to change the RPM/Script to make it possible to use this on multiple sites?

 

This script with my modifications works better for me - for whatever reason the original enable-alternate/primary-nexthop.slax scripts never make any changes to my static routing tables - although I do see the scripts kick off in esctipts.log

 

Any help is appreciated.

Visitor
Stef_Beking
Posts: 2
Registered: ‎02-10-2012
0

Re: Explain enable-primary-nexthop script

Has anyone got the script working with firmware version 11.2? I just updated to version 11.2R4.3 and it seems the script isn't working anymore.

 

I was using the script with 2 ISPs (without different routing instances)

 

For now I'll go back to using 10.4. But if anyone has a solutions, please let me know!

Contributor
hoand
Posts: 181
Registered: ‎04-05-2011
0

Re: Explain enable-primary-nexthop script

Sorry, but somebody can explain for me about event PING_TEST_FAILED, the default event on Junos ? What does it do ? And when/how can we use it ?

 

From event context, I see alot of default event, but I don't know how to use it.

Copyright© 1999-2013 Juniper Networks, Inc. All rights reserved.