[j-nsp] op script for checking when rpd fails

Curtis Call ccall at juniper.net
Thu Aug 20 09:30:26 EDT 2009


> I'd like to have an op script turn off some interfaces when rpd fails.
> Does anybody know how to notify an op script to do something based on a
> process failing and/or disappearing?

You'd want to use an event script rather than an op script.  That way the script can respond automatically to the event when rpd fails.  You can check what messages are showing up in your syslog but if it's coring then the following should probably catch it and would execute the "turn-off-interfaces.slax" script in response:

event-options {
    policy catch-rpd-core {
        events system;
        attribute-match {
            system.message matches "routing.*Core dumped!";
        }
        then {
            event-script turn-off-interfaces.slax;
        }
    }
}

Your turn-off-interfaces.slax event script could then make the necessary configuration changes.  JUNOS 9.3 or later is required since that is the minimum for configuration changes from event/op scripts.

BTW, Juniper recently released an eLearning course on scripting: JUNOS As A Scripting Language:

http://www.juniper.net/us/en/training/elearning/junos_scripting.html

I hope that is helpful.


More information about the juniper-nsp mailing list