Git Product home page Git Product logo

grafolean-netflow-bot's Introduction

About Grafolean NetFlow bot

This package is a NetFlow bot for Grafolean, an easy to use generic monitoring system.

The architecture of this bot is a bit unusual. The reason is a Docker issue which prevents containers from determining the source IP of the NetFlow UDP packets. Because we need this information, we must put a single process outside the Docker network (collector), then pass every incoming packet via named pipe to another process inside the network (writer), which writes it to the database (PostgreSQL). The fourth process is a bot, waking up at regular intervals and sending aggregated data to Grafolean.

Note that the system holds the not-yet-aggregated data in PostgreSQL, so it might be possible to perform further analysis if any incidents occur in the network. The data is however not in its original form for storage capacity reasons (only the most important of the fields are saved).

Under the hood python-netflow-v9-softflowd is used. For local testing (NetFlow v5) nflow-generator can be used.

Requirements:

  • NetFlow exporters must be able to send data to the port where collector is listening (see NETFLOW_PORT environment variable description below)
  • Grafolean must be accessible via HTTP(S)

Current limitations:

  • only NetFlow v9 and v5 are supported

License

License is Commons Clause license (on top of Apache 2.0) - source is available, you can use it for free (commercially too), modify and share, but you can't sell it. See LICENSE.md for details.

If in doubt, please open an issue to get further clarification.

Install

IMPORTANT: these instructions are only useful if you wish to install a remote agent / bot. Please see Grafolean installation instructions if you only wish to enable a bot as part of default Grafolean installation.

Requirements: docker and docker-compose.

  1. log in to Grafolean service (either self-hosted or https://grafolean.com/) and create a new Bot. Make sure that selected protocol is NetFlow. Copy the bot token.

  2. save docker-compose.yml to a local file:

    $ mkdir ~/netflow
    $ cd ~/netflow
    $ curl https://github.com/grafolean/grafolean-netflow-bot/raw/master/docker-compose.yml > docker-compose.yml
    
  3. save .env.example to .env and edit it:

    $ curl https://raw.githubusercontent.com/grafolean/grafolean-netflow-bot/master/.env.example > .env
    
    • mandatory: BACKEND_URL (set to the URL of Grafolean backend, for example https://grafolean.com/api),
    • mandatory: BOT_TOKEN (set to the bot token from step 1),
    • mandatory: DB_DIR (directory to which the database with non-aggregated results is saved),
    • optional: NETFLOW_PORT (UDP port on which collector listens for incoming packets)
    • optional: JOBS_REFRESH_INTERVAL (interval in seconds at which the jobs definitions will be updated)
  4. run: docker-compose up -d

If you get no error, congratulations! Everything else is done from within the Grafolean UI. You can however check the status of container as usually by running docker ps and investigate logs by running docker-compose logs -f in the ~/netflow/ directory.

Upgrade

  1. $ docker-compose pull
  2. $ docker-compose down
  3. $ docker-compose up -d

Debugging

Container logs can be checked by running:

$ docker logs --since 5m -f grafolean-netflow-bot

Building locally

If you wish to build the Docker image locally (for debugging or for development purposes), you can use a custom docker-compose YAML file:

docker-compose -f docker-compose.dev.yml build

As before, .env.example can be copied to .env and all settings can be altered there.

Issues

If you encounter any problems installing or running the software, please let us know in the issues. Please make an effort when describing the issue. If we can reproduce the problem, we can also fix it much faster.

Development

Contributing

Please open an issue about the problem you are facing before submitting a pull request.

grafolean-netflow-bot's People

Contributors

grafolean avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

ectivise

grafolean-netflow-bot's Issues

Dashboard completely white!

Hi There,

Thanks for this cool project, sadly i just can't get it to work :(

I have installed it locally on my Linux PC to collect netflow data from a MikroTik router which is the router for this LAN.

The netflow exporter showed up automatically. I have enabled the netflow sensor and the logs show netflow data coming in to Grafolean.

When I add a dashboard using netflow template I get a completely white browser window. clicking refresh VERY briefly shows Grafolean web page and then reverts to completely white. I have tried various different browsers and disabled ad blockers etc etc.

Please help!

Thanks

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.