Code Monkey home page Code Monkey logo

darkstatscore's Introduction

DarkStatsCore

A bandwidth monitoring tool in ASP.NET Core.

Docker Automated buil Docker Build Statu GitHub release GitHub tag AppVeyor

darkstatscore

The intent of this project was to take the data produced by 'darkstat' and display it in a more informative, friendly, format. DarkStatsCore collects data often and stores it by hour, so you can break down bandwidth usage by day or month. There is also a 'live dashboard' feature that will give you an immediate insight in to current network traffic.

I arrived at this point due to Comcast's stupid data caps and the inability to find a good enough tool to run on my EdgeRouter X to provide this data.

To use DarkStatsCore, I recommend you restart your 'darkstat' instance every night (to have it write its database file), and feed it a new database file every month. Otherwise, the numbers get enormous and will only lead to headaches. I will share my scripts for this at the bottom of this README.

To start using this, run something like:

docker run -it -d --restart always -v "/your/machine/darkstatscore/db":/app/db -p 6677:6677 tylerrichey/darkstatscore

By default, the container will use the America/New_York timezone. If you live in another timezone, use the -e option and override the TZ environment variable.

docker run -it -d --restart always -v "/your/machine/darkstatscore/db":/app/db -p 6677:6677 -e TZ=America/Los_Angeles tylerrichey/darkstatscore

There are standalone executables available on the release page (from 1.0.3) for Windows, Debian and OS X. You can also get the latest dev build directly from the AppVeyor project.

Run from source with:

git clone https://github.com/tylerrichey/darkstatscore.git
cd darkstatscore
dotnet restore
cd DarkStatsCore
npm install (if you don't have npm > v4 then you'll need to run this command next: node copypackages.js)
dotnet run <optional argument to specify a different port, i.e., http://*:8080>

Here is how I run 'darkstat'; my /etc/darkstat/init.cfg:

START_DARKSTAT=yes
INTERFACE="-i switch0"
DIR="/var/lib/darkstat"
LOCAL="-l 10.0.0.0/255.255.255.0"
DAYLOG="--daylog darkstat.log"
FILTER="not (src net 10.0.0 and dst net 10.0.0)"
OPTIONS="--local-only"

This is my daily restart script:

#!/bin/bash

sudo service darkstat restart

This is my monthly restart script:

#!/bin/bash

sudo service darkstat stop
mv /var/lib/darkstat/darkstat.db /var/lib/darkstat/darkstat.$(date +"%m_%d_%Y").db
sudo service darkstat start

If you use an EdgeRouter, this is my task-scheduler configuration:

task-scheduler {
	task dailydarkstat {
		crontab-spec "0 0 * * *"
		executable {
			path /config/user-data/scripts/darkstatsrestart.sh
		}
	}
	task monthlydarkstat {
		crontab-spec "0 0 1 * *"
		executable {
			path /config/user-data/scripts/darkstatsmonthly.sh
		}
	}
}

darkstatscore's People

Contributors

tylerrichey avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.