On Thu, Sep 08, 2011 at 09:52:02AM +0200, Ruben Laban wrote: > Hi list, > > I was wondering if there's a sane method to keep a realtime eye on OSPF. More > specifically, getting notifications for link/state/topology/etc changes. So > far > all I could think of is using birdc(6) every x seconds/minutes and comparing > the output with the previous run to detect changes.
There is no dedicated notification channel. The simplest thing is to get output of 'show ospf state' every x seconds. Or if you want, you could enable debug events logging and use routing the table recalculation message as a trigger for 'show ospf state' (but that seems unnecessary for me). For monitoring, i have a script that logs the state, sorts that appropriately to hide irrelevant changes, compares with the previous one and possibly sent the diff (attached, just a quick hack). I have also some scripts that took 'show ospf state' output and expected network description and converts that to the SVG image with reachable, broken and unreachable links differentiated by color, but it is not really finished. -- Elen sila lumenn' omentielvo Ondrej 'SanTiago' Zajicek (email: santi...@crfreenet.org) OpenPGP encrypted e-mails preferred (KeyID 0x11DEADC3, wwwkeys.pgp.net) "To err is human -- to blame it on a computer is even more so."
#!/bin/bash EMAIL=santiago while true ; do F1=log/`date '+%F-%H-%M-%S'` F2=${F1}s birdc4 show ospf state | grep -v 'dr ' > $F1 csplit -ftmp/x -n3 $F1 '/^$/' '{*}' > /dev/null for A in tmp/* ; do sort ${A} > ${A}s done cat tmp/*s > $F2 rm tmp/* if [ -n "`diff log/00last $F2`" ] then diff -u log/00last $F2 | mail -s 'OSPF Change' $EMAIL mv $F2 log/00last else rm $F1 $F2 fi sleep 10; done
signature.asc
Description: Digital signature