000
06.06.2008, 15:31
default
|
graphen sind enterprise, management kompatibel, und eyecatcher man kann für alles graphen bauen, in diesem fall möchten wir uns aber auf netwerkdurchsatzgraphen beschränken.
Wenn man das notwendige kleingeld hat, kauft man kram von cisco, der spricht netflow und exportiert so bequem die durchsatzdaten an eine andere maschine die das auswerten kann.
Fehlt einem das notwendige kleingeld, installiert man
apt-get install fprobe-ng
auf seinem linux router, und kann auch netflow sprechen.
da mein router sehr leistungsschwach ist, habe ich fprobe in dem konfig dialogue gesagt es soll die netflow daten an remote ip port 5555 senden. Als interface habe ich das ppp0 device genommen, das ist nicht ideal da man die externeip - lokale ip zuordnung verliert, eth0 wäre besser, aber dann muss man fprobe noch mitteilen dass es seine eigenen packete an den collector nicht accounten soll, sollte gehen, mach ich später.
Nun fehlt aber ein "netflow collector", ein kleines programm was die netflowdaten sammelt.
nfcapd aus dem nfdump packet ist dafür ideal, schnell & umsonst nfdump von hand zu bauen benötigt
apt-get install flex bison librrd2-dev
nfsen braucht php & perl und ein paar extra perl module
apt-get install librrds-perl libmailtools-perl
nun zieht man noch nfdump und nfsen
wget http://switch.dl.sourceforge.net/sourceforge/nfdump/nfdump-1.5.7.tar.gz http://heanet.dl.sourceforge.net/sourceforge/nfsen/nfsen-1.3.tar.gz
Zuerst bauen wir nfdump, da nfsen, das graphische frontend eine nfdump installation erwartet.
tar xfz nfdump-1.5.7.tar.gz cd nfdump-1.5.7 ./configure --prefix=/opt/nfdump --enable-nfprofile make install
Für nfsen legen wir einen nutzer "netflow" an und packen ihn in die gruppe "www-data"
tar xfz nfsen-1.3.tar.gz cd nfsen-1.3
in dem nfsen verzeichnis die datei etc/nfsen.conf erstellen
mit folgendem inhalt
############################## # # NfSen master config file # # $Id: nfsen-dist.conf 22 2007-11-20 12:27:38Z phaag $ # # Configuration of NfSen: # Set all the values to fit your NfSen setup and run the 'install.pl' # script from the nfsen distribution directory. # # The syntax must conform to Perl syntax. # ############################## # # NfSen default layout: # Any scripts, modules or profiles are installed by default under $BASEDIR. # However, you may change any of these settings to fit your requested layout.
# # Required for default layout $BASEDIR = "/opt/nfsen";
# # Where to install the NfSen binaries $BINDIR="${BASEDIR}/bin";
# # Where to install the NfSen Perl modules $LIBEXECDIR="${BASEDIR}/libexec";
# # Where to install the config files $CONFDIR="${BASEDIR}/etc";
# # NfSen html pages directory: # All php scripts will be installed here. # URL: Entry point for nfsen: http://<webserver>/nfsen/nfsen.php $HTMLDIR = "/var/www/nfsen/";
# # Where to install the docs $DOCDIR="${HTMLDIR}/doc";
# # Var space for NfSen $VARDIR="${BASEDIR}/var";
# # directory for all pid files # $PIDDIR="$VARDIR/run";
# # The Profiles stat directory, where all profile information # RRD DBs and png pictures of the profile are stored $PROFILESTATDIR="${BASEDIR}/profiles-stat";
# # The Profiles directory, where all netflow data is stored $PROFILEDATADIR="${BASEDIR}/profiles-data";
# # Where go all the backend plugins $BACKEND_PLUGINDIR="${BASEDIR}/plugins";
# # Where go all the frontend plugins $FRONTEND_PLUGINDIR="${HTMLDIR}/plugins";
# # nfdump tools path $PREFIX = '/opt/nfdump/bin';
# # nfsend communication socket # $COMMSOCKET = "$PIDDIR/nfsen.comm";
# BASEDIR unrelated vars: # # Run nfcapd as this user # This may be a different or the same uid than your web server. # Note: This user must be in group $WWWGROUP, otherwise nfcapd # is not able to write data files! $USER = "netflow";
# user and group of the web server process # All netflow processing will be done with this user $WWWUSER = "www-data"; $WWWGROUP = "www-data";
# Receive buffer size for nfcapd - see man page nfcapd(1) $BUFFLEN = 200000;
# # Directory sub hierarchy layout: # Possible layouts: # # 0 default no hierachy levels - flat layout - compatible with pre NfSen versions # 1 %Y/%m/%d year/month/day # 2 %Y/%m/%d/%H year/month/day/hour # 3 %Y/%W/%u year/week_of_year/day_of_week # 4 %Y/%W/%u/%H year/week_of_year/day_of_week/hour # 5 %Y/%j year/day-of-year # 6 %Y/%j/%H year/day-of-year/hour # 7 %Y-%m-%d year-month-day # 8 %Y-%m-%d/%H year-month-day/hour $SUBDIRLAYOUT = 7;
# Compress flows while collecting 0 or 1 $ZIPcollected = 0;
# Compress flows in profiles 0 or 1 $ZIPprofiles = 0;
# if the PROFILEDATADIR is filled up to this percentage, a warning message will be printed. # set to 0 to disable the test $DISKLIMIT = 98;
# Netflow sources # Define an ident string, port and colour per netflow source # # Required parameters: # ident identifies this netflow source. e.g. the router name, # Upstream provider name etc. # port nfcapd listens on this port for netflow data for this source # set port to '0' if you do not want a collector to be started # col colour in nfsen graphs for this source # # Optional parameters # type Collector type needed for this source. Can be 'netflow' or 'sflow'. Default is netflow # optarg Optional args to the collector at startup # # Syntax: # 'ident' => { 'port' => '<portnum>', 'col' => '<colour>', 'type' => '<type>' } # Ident strings must be 1 to 19 characters long only, containing characters [a-zA-Z0-9_].
%sources = ( # 'upstream1' => { 'port' => '9995', 'col' => '#0000ff', 'type' => 'netflow' }, # 'peer1' => { 'port' => '9996', 'col' => '#ff0000' }, 'router' => { 'port' => '55555','col' => '#ff0000' }, );
# # Low water mark: When expiring files, delete files until # size = $low_water % of max_size # typically 90 $low_water = 90;
# # syslog facility for periodic jobs # nfsen uses level 'debug', 'info', 'warning' and 'err' # Note: nfsen is very chatty for level 'debug' and 'info' # For normal operation, you may set the logging level in syslog.conf # to warning or error unless you want to debug NfSen $syslog_facility = 'local3';
# # SYSLOG mess # Log socket type: Most *NIX such as LINUX and *BSD are fine with 'unix' # which is the default. You need to change that to 'stream' or 'inet' for # some Solaris version 8/9, AIX and others .. # You may set it to undef to prevent calling Sys::Syslog::setlogsock at all # ( works for Solaris 10 and newer Sys::Syslog module # # If not defined at all, 'unix' is assumed unless for Solaris, which defaults to 'stream' # $LogSocket = 'unix';
# # Plugins # Plugins extend NfSen for the purpose of: # Periodic data processing, alerting-condition and alerting-action # For data processing a plugin may run for any profile or for a specific profile only. # Syntax: [ 'profile list', 'module' ] # profile list: ',' separated list of profiles ( 'profilegroup/profilename' ), # or '*' for any profile, '!' for no profile # module: Perl Module name, equal to plugin name # The profile list '!' make sense for plugins, which only provide alerting functions # # The module follows the standard Perl module conventions, with at least one # function: Init(). See demoplugin.pm for a simple template. # # A file with the same name in the FRONTEND_PLUGINDIR and .php extension is automatically # recongized as frontend plugin. # # Plugins are installed under # $BACKEND_PLUGINDIR and $FRONTEND_PLUGINDIR
@plugins = ( # profile # module # [ '*', 'demoplugin' ], );
%PluginConf = ( # For plugin demoplugin demoplugin => { # scalar param2 => 42, # hash param1 => { 'key' => 'value' }, }, # for plugin otherplugin otherplugin => [ # array 'mary had a little lamb' ], );
# # Alert module: email alerting: # Use this from address $MAIL_FROM = 'your@from.example.net';
# Use this SMTP server $SMTP_SERVER = 'localhost';
# Use this email body: # You may have multiple lines of text. # Var substitution: # @alert@ replaced by alert name # @timeslot@ replaced by timeslot alert triggered $MAIL_BODY = q{ Alert '@alert@' triggered at timeslot @timeslot@ };
1;
nfsen installieren
./install.pl etc/nfsen.conf
Nun nfsen starten
cd /opt/nfsen/bin ./nfsen start
Nun noch /var/www/nfsen in die apache config als virtual host aufnehmen. und man hat sehr ansehnliche graphen.
--
Du musst Deine Bandbreite verbreitern, damit du breiter wirst von der Bandbreite her und ein breiteres Publikum ansprechen kannst.
Dieser Beitrag wurde am 06.06.2008 um 15:32 von default bearbeitet.
|