jablonka.czprosek.czf

crusader

Subversion Repositories:
[/] [trunk/] [statistiky/] [opt/] [statistiky/] [monitor_zebra/] [monitor_zebra] - Rev 1

Compare with Previous - Blame - Download


#!/bin/bash

logfile=/var/log/Heaven/zebra.mon
#chmod +r $logfile

zebraline=`ps ax | grep sbin/zebra | grep -v grep`
if [ ! -z "$zebraline" ] ; then
    zebrapid=`echo $zebraline | awk '{print $1;}'`
else
    zebrapid="not running"
fi
ospfline=`ps ax | grep sbin/ospfd | grep -v grep`
if [ ! -z "$ospfline" ] ; then
    ospfpid=`echo $ospfline | awk '{print $1;}'`
else
    ospfpid="not running"
fi
routes=`route -n | grep wlan[01] | wc -l`
routes=`expr $routes + 0`

now=`date +"%Y-%m-%d %H:%M:%S"`
unixtime=`date +"%s"`
echo "$now  $unixtime  zebra: $zebrapid   ospf: $ospfpid   routes: $routes" >>$logfile

if [ -f /var/statistiky/zebra.rrd ] ; then
    /opt/rrdtool/bin/rrdtool update /var/statistiky/zebra.rrd $unixtime:$routes
fi

Powered by WebSVN 2.2.1