+ CentOS start script

* fix link names with upper-case characters
This commit is contained in:
Manuel Kasper 2008-12-18 12:35:42 +00:00
parent a497c5fc9e
commit 970329a116
4 changed files with 85 additions and 3 deletions

4
README
View File

@ -5,7 +5,9 @@ by Manuel Kasper, Monzoon Networks AG <mkasper@monzoon.net>
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

80
contrib/centos/as-stats Executable file
View File

@ -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

View File

@ -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");

View File

@ -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 */