Bandwidthd

From SME Server
Revision as of 14:49, 1 January 2017 by Phil101 (talk | contribs) (Typo error chckconfig replaced)
Jump to navigation Jump to search


Bandwidthd for SME Server

  Skill level: Easy
The instructions on this page can be followed by a beginner.


Contrib 10:
Contrib 9:
smeserver-bandwidthd
The latest version of smeserver-bandwidthd is available in the SME repository, click on the version number(s) for more information.


Maintainer

Jean-Philippe Pialasse

Description

Bandwidthd is a UNIX daemon/Windows service for graphing the traffic generated by each machine on several configurable subnets. It is much easier to configure than MRTG, and provides significantly more useful information. MRTG only tells you how much bandwidth you are using, Bandwidthd tells you that, and who is using it.

Each IP address that has moved any significant volume of traffic has its own graph. The graphs are color coded to help you figure out at a glance if your user is surfing the web, or surfing Kazaa.

Bandwidthd is targeted to run on a routing platforms. It is very low overhead. Easily graphing small business traffic on a 133Mhz Elan 486 every 2.5 minutes. An entire ISP (2000-3000 IP addresses across 4 states) can be graphed on a Celeron 450 every 10 minutes.  

Requirements

This contrib has been developed and tested on both SME Server 7 and 8 and should work on later.


Installation 8.X, 9.X

yum install smeserver-bandwidthd --enablerepo=smecontribs

then

signal-event conf-bandwidthd
service mysql.init restart

or

signal-event post-update; signal-event reboot

and wait for your db to start collecting data (at least 3 minutes)

Configuration with db command

There is no server manager panel, you can easily configure the contrib with a db command (see examples below)

To display current settings

config show bandwidthd

Which will show something like

bandwidthd=service
   DbName=bandwidthd
   DbPassword=xxxxxxxxxxxx
   DbUser=bandwidthd
   Name=bandwidthd
   status=enabled
   webaccess=private


Available settings showing the db key property and value are listed below:

ie in the first example subnet is a property and disabled is a value, note that a default property & value is not listed in the database entry, but is in effect.


  • 'subnet' : default is "disabled", you can put there a subnet that is not your LAN or WAN or authorized SME network
  • 'device' : default is "any", you can put there an interface you want to monitor. You should consider to set one network interface. Any might cause to account twice some traffic for your LAN hosts.
  • 'skipInterval' : default is "0", An interval is 2.5 minutes, this is how many intervals to skip before doing a graphing run
  • 'grapCutofff' : default is "1024", Graph cutoff is how many k must be transferred by an ip before we bother to graph it
  • 'promiscuous' : default is "false", Put interface in promiscuous mode to score to traffic that may not be routing through the host machine.
  • 'output_cdf' : default is "false", Log data to cdf file htdocs/log.cdf (NB: 'graph'="true" will override this if at false and consider it at true).
  • 'recover_cdf' : default is "false", Read back the cdf file on startup ( might loose some data while reading the file)
  • 'graph' : default is "true", Draw Graphs - This default to true to graph the traffic bandwidthd is recording. Usually set this to false if you only want cdf output or you are using the database output option. Bandwidthd will use very little ram and cpu if this is set to false. If you want to only use mysql or pgsql (need some configuration) or sqlite (not tested), you probably want to set this at
  • 'meta_refresh' : default is "150", Set META REFRESH seconds (use 0 to disable)
  • 'sensor' : default is "$SystemName.$DomainName", Arbitrary sensor name, I recommend the sensors fully qualified domain name, but you can do whatever you want!
  • 'DbType' : default is "mysql", Database type, possible values, pgsql, mysql or none.
  • 'Dbhost' : default is "localhost"
  • 'Dbport' : default is "0", which means default mysql port (ie 3306)
  • 'DbName' : mysql and pgsql DB name
  • 'DbUser' : mysql and pgsql DB user
  • 'DbPassword' : mysql and pgsql DB password
  • 'status' : default is "enabled", will disable or enable bandwidthd
  • 'webaccess' :default is private (default - admin user only, LAN and trusted network only), local (anybody, LAN and trusted network only), public ( admin user only, anywhere), global (anybody, anywhere)
  • 'Name' : you can set the name of the login page
  • 'webinterface' : "both" "html" "php"
  • 'URL' : let you choose a personal alias to reach bandwidthd web interface , could be monitor, band ...
  • 'width' : default is "900", this php graph width
  • 'height' : default is "256", this php graph height
  • 'interval' : default is "INT_DAILY", this is default selection for php interface, could be INT_DAILY, INT_WEEKLY,INT_MONTHLY, INT_YEARLY


To change a setting use the following db command syntax

db configuration setprop bandwidthd property value

or in the special case only for the configuration db, this can be abbreviated to

config setprop bandwidthd property value

where property and value are obtained from the list of options above.

eg to change webaccess

config setprop bandwidthd webaccess public

eg to change login page name

config setprop bandwidthd Name 'My Monitoring Login Page'

After changing any setting, you need to apply it:

signal-event conf-bandwidthd

Access

you can access it through the server-manager in the administration panel, and also at the URL https://SERVER/bandwidthd or https://SERVER/"URL" ( default is php, html if php deactivated), https://SERVER/bandwidthd-static (html version only),https://SERVER/bandwidthd-sql (php version only)

Advanced Monitoring (experienced users)

Using the sensors you can monitor multiple server or interface. However you need to configure a host for the mysql db to contact if monitoring multiple host or to run multiple instances of bandwithd if you want to monitor multiple interface ( but not all) or want to avoid multiple accounting while using any on local hosts.

Let's say you want to monitor your adsl connection, while the main installation is already monitoring your local interface

cp -a /etc/bandwidthd.conf /etc/bandwidthd-adsl.conf

then edit /etc/bandwidthd-adsl.conf : change sensor to "adsl" and dev to "ppp0" or your network interface you want to monitor.Adjust what you want, and I suggest you to put off to graph and falt to cdf

cp -a /etc/rc.d/init.d/bandwidthd /etc/rc.d/init.d/bandwidthd-adsl
chkconfig --add bandwidthd-adsl
ln -s /etc/rc.d/init.d/bandwidthd-adsl /etc/rc.d/rc7.d/S85bandwidthd-adsl
vim /etc/rc.d/init.d/bandwidthd-adsl

Here you need to edit PROGNAME to go to the link "usr/sbin/bandwidthd-adsl" Add the following line under PROGNAME : OPTIONS='-c /etc/bandwidthd-adsl.conf' Also edit subsys lock file and add -adsl : /var/lock/subsys/bandwidthd-adsl (3 times)

ln -s /usr/sbin/bandwidthd /usr/sbin/bandwidthd-adsl

then just do

service bandwidthd-adsl start

and wait for your db to start collecting data (at least 3 minutes)

Uninstall

yum remove smeserver-bandwidthd bandwidthd

Bugs

Please raise bugs under the SME-Contribs section in bugzilla and select the smeserver-bandwidthd component or use this link .

"No open bugs found."