diff --git a/README b/README index b92c3d2..e51f9ce 100644 --- a/README +++ b/README @@ -5,7 +5,9 @@ by Manuel Kasper, Monzoon Networks AG Changes ------- -v1.2 Allow inbound/outbound in graphs to be swapped (via option +v1.2 Support for sFlow (through sflow-asstatd.pl); fix for link names + with upper-case characters + Allow inbound/outbound in graphs to be swapped (via option in www/func.inc) v1.1 Fix for a potential race condition surrounding $childrunning diff --git a/contrib/centos/as-stats b/contrib/centos/as-stats new file mode 100755 index 0000000..ca4a62a --- /dev/null +++ b/contrib/centos/as-stats @@ -0,0 +1,80 @@ +#! /bin/bash +# +# as-stats - Start/Stop the as-stats NetFlow collector. +# +# chkconfig: 2345 90 10 +# description: as-stats is a program that collects NetFlow data +# and process it in order to show the different +# sourced / destinated IP traffic AS. + +# Source function library. +. /etc/init.d/functions + +DAEMON=netflow-asstatd.pl +RRDDIR=/data/as-stats/rrd +KNOWNLINKS=/data/as-stats/etc/netflow-knownlinks + +prog="as-stats" + +start() { + echo -n $"Starting $prog: " + + # start daemon + daemon /data/as-stats/bin/$DAEMON $RRDDIR $KNOWNLINKS >> /data/as-stats/output.log & + RETVAL=$? + echo + [ $RETVAL = 0 ] && touch /var/lock/subsys/as-stats + return $RETVAL +} + +stop() { + echo -n $"Stopping $prog: " + + # stop daemon + killproc $DAEMON + RETVAL=$? + echo + [ $RETVAL = 0 ] && rm -f /var/lock/subsys/as-stats + return $RETVAL +} + +restart() { + stop + start +} + +reload() { + echo -n $"Reloading $prog daemon configuration: " + killproc $DAEMON -HUP + RETVAL=$? + echo + return $RETVAL +} + +rhstatus() { + status $DAEMON +} + +case "$1" in + start) + start + ;; + stop) + stop + ;; + restart) + restart + ;; + reload) + reload + ;; + status) + rhstatus + ;; + *) + echo $"Usage: $0 {start|stop|status|reload|restart}" + exit 1 +esac + +exit $RETVAL + diff --git a/www/gengraph.php b/www/gengraph.php index 0f21116..0fe3ab3 100644 --- a/www/gengraph.php +++ b/www/gengraph.php @@ -8,7 +8,7 @@ require_once('func.inc'); $as = $_GET['as']; -if (!preg_match("/^[0-9a-z]+$/", $as)) +if (!preg_match("/^[0-9a-zA-Z]+$/", $as)) die("Invalid AS"); header("Content-Type: image/png"); diff --git a/www/linkgraph.php b/www/linkgraph.php index d2b7973..510198f 100644 --- a/www/linkgraph.php +++ b/www/linkgraph.php @@ -14,7 +14,7 @@ if ($_GET['numtop'] && $_GET['numtop'] <= 50) $ascolors = array("D41C0E", "E45605", "FECF12", "2FA11C", "19BB7C", "0A4484", "0A7484", "4CB4C4", "971928", "1f348c"); $link = $_GET['link']; -if (!preg_match("/^[a-z0-9]+$/", $link)) +if (!preg_match("/^[0-9a-zA-Z]+$/", $link)) die("Invalid link"); /* first step: walk the data for all ASes to determine the top 5 for the given link */