iNETstats

iNETstats is a Python script for gathering bandwidth usage statistics in LMS and iNET powered networks / routers with PHP based simple interface.

iNETstats bandwidth usage graph example

Program parses stats generated by iNET's rc.status, saves it to RRD files and updates graphs. Thanks to LMS's database connection in PHP ui, we can filter graphs by computer name, client's name or computers group.

Requirements

Script requires Python's rrdtool package, in Debian based distros you'll install it by:


apt-get install python-rrdtool

Configuration

Required inetstats.py configuration:


# paths
IMGD = os.path.dirname(__file__) + "/img" # graphs dir
RRDD = os.path.dirname(__file__) + "/rrd" # RRD files dir
INETD = "/etc/inet" # path to iNET scripts

NETBASE = "172.20.0.0" # network address without netmask

PHP script requires LMS's lib/ directory because of LMSDB usage. It's minimal configuration:


$IMGD = 'img'; // graphs dir

$_LMSLIBDIR = 'lib'; // LMS's lib/ dir

// LMS db config
$_dbtype = 'mysql';
$_dbhost = 'localhost';
$_dbport = '3306';
$_dbuser = 'lms';
$_dbpass = 'LMS_DB_PASSWD';
$_dbname = 'lms';

CRONTAB entry:


*/5 * * * * /usr/bin/python /PATH/TO/inetstats.py &> /dev/null

Running of inetstats.py takes some time, that's why it's creating some simple lockfile for not overwriting rrd data. So it's secure to call it often than every 5 minutes (I've tested with 2 minutes interval). Of course it isn't required, because inetstats.py creates RRD files with 300s step.

Download

inetstats-0.1.1.tar.gz

inetstats.png

inetstats-total.png

one-node.png

stat-1d.png