Giter VIP home page Giter VIP logo

python-hdl-networklogger's Introduction

HDL network logger

This is a Python script to log network traffic from the smart house system HDL-BUS Pro.

Running the script

To run the script just type python networklogger.py.

By default it will listen for UDP packages on all available network interfaces on port 6000 and log the traffic to disk.

Configuring the script

If you want to or need to configure the script you just create a new file called hdlconfig.py. There's an example config file called hdlconfig-example.py you should use as basis for your config. Please note that at this point the e-mail stuff is not in use.

Logging

The data from the HDL system is logged into a file (that will be created) called network.log. If the script is running continuously the files will be rotated at midnight. By default files will be kept for a week. Make sure you have enough disk space for this.

Complete setup on a Raspberry PI running Raspbian GNU/Linux

1. Directory setup and getting the script

First SSH into your Raspberry PI.

Then download the code:
cd ~
git clone https://github.com/roys/python-hdl-networklogger.git

It can be smart to check that the script is working and getting data:
cd python-hdl-networklogger
python networklogger.py

Use ctrl + c to exit the script. Checkout if any data have been logged to a file called network.log in the same directory.

2a. Running the script in the background

If you want to make the script run on startup then skip to 2b. If you want to just run the script in the background (even afer you log out) you can enter the following command:
nohup python networklogger.py &

The number that is printed out is the process number. You can use this number to stop the script.

If you don't have the process number you can find it using ps aux | grep networklogger.

To kill/stop the script just enter the following command: kill [process number]

2b. Running the script on startup

The script can be run as a cron job that starts on reboot of the Raspberry PI.

To edit the cronjob:
crontab - e

Add the following line at the end:
@reboot /bin/sh ~/python-hdl-networklogger/launcher.sh

Use ctrl + x to exit, press Y to save the cron setup and enter to confirm the filename.

Restart the device using sudo shutdown -r now and check out if there's stuff going on in network.log. launcher.log will also contain output and any error messages running the script.

3. Reading the logs

You can easily tap in to what's going by running tail:
tail -f network.log

This will let you follow the file and the contents that's written to it. To end the session just press ctrl + c.

Updating the script

If you chose to do a git clone in the first step you can just run git pull inside the directory at ~/python-hdl-networklogger. If you run the script at boot time it is easiest to just reboot your Raspberry PI using sudo shutdown -r now to ensure the latest version of the script is running.

python-hdl-networklogger's People

Contributors

roys avatar

Stargazers

 avatar  avatar

Watchers

 avatar

Forkers

henbentzen

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.