1 | 1 | simandl | #!/bin/bash |
2 | | | |
3 | | | logfile=/var/log/Heaven/zebra.mon |
4 | | | #chmod +r $logfile |
5 | | | |
6 | | | zebraline=`ps ax | grep sbin/zebra | grep -v grep` |
7 | | | if [ ! -z "$zebraline" ] ; then |
8 | | | zebrapid=`echo $zebraline | awk '{print $1;}'` |
9 | | | else |
10 | | | zebrapid="not running" |
11 | | | fi |
12 | | | ospfline=`ps ax | grep sbin/ospfd | grep -v grep` |
13 | | | if [ ! -z "$ospfline" ] ; then |
14 | | | ospfpid=`echo $ospfline | awk '{print $1;}'` |
15 | | | else |
16 | | | ospfpid="not running" |
17 | | | fi |
18 | | | routes=`route -n | grep wlan[01] | wc -l` |
19 | | | routes=`expr $routes + 0` |
20 | | | |
21 | | | now=`date +"%Y-%m-%d %H:%M:%S"` |
22 | | | unixtime=`date +"%s"` |
23 | | | echo "$now $unixtime zebra: $zebrapid ospf: $ospfpid routes: $routes" >>$logfile |
24 | | | |
25 | | | if [ -f /var/statistiky/zebra.rrd ] ; then |
26 | | | /opt/rrdtool/bin/rrdtool update /var/statistiky/zebra.rrd $unixtime:$routes |
27 | | | fi |