Use the ospf_adjacency_flapping Script
For SLAX version 1.0 and higher, you can use the ospf_adjacency_flapping script to write a syslog message on receiving RPD_OSPF_NBRDOWN event. This script raises an syslog message with high priority value in response to the event received.
Source Code and GitHub Links
The source code below is also available from GitHub at the following locations:
Example Configuration
01 |
The following configuration are needed. |
05 |
file ospf_adjacency_flapping.slax; |
09 |
policy ospf_adjacency_flapping { |
10 |
events rpd_ospf_nbrdown; |
12 |
event - script ospf_adjacency_flapping.slax; |
16 |
Copy the script ospf_adjacency_flapping.slax to / var / db / script / op directory. |
18 |
This script will work with 9.0 or above because it uses jcs:syslog() function which is introduced in 9.0 |
20 |
In additional, due to PR 76849 we cannot log the details, we can only log a simple message as a caveat. |
SLAX Script Contents
02 |
* Very simple script which gets triggerd on receiving |
03 |
* RPD_OSPF_NBRDOWN event. RPD_OSPF_NBRDOWN is received when OSPF neighbor |
04 |
* adjacency was terminated. This script raises an syslog message |
05 |
* with high priority value. |
07 |
* Due to a known issue (PR 76849) this script will not get event details. |
08 |
* So, we can only log a simple log message saying OSPF adjacency happened |
09 |
* but not the details. |
19 |
import "../import/junos.xsl" ; |
23 |
expr jcs:syslog( "daemon.crit" , "OSPF neighbor adjacency was terminated" ); |
XML Script Contents
03 |
< title >ospf_adjacency_flapping.slax</ title > |
04 |
< author >rsankar</ author > |
06 |
Write a syslog message on receving RPD_OSPF_NBRDOWN event |
09 |
< type >protocols</ type > |
12 |
This script raises an syslog message with high priority value in response to the event received |
16 |
< keyword >mvpn</ keyword > |
18 |
< title >Configuration</ title > |
19 |
< description >Configuration required for this event script</ description > |
20 |
< config >example-1.conf</ config > |
24 |
src = "../../../../../web/leaf.js" |
25 |
type = "text/javascript" /> |