Git Product home page Git Product logo

mkobel / lxc-monitor Goto Github PK

View Code? Open in Web Editor NEW

This project forked from lennartc/lxc-monitor

0.0 1.0 0.0 218 KB

LXC Monitoring collects cpu and memory statistics for several Linux Containers, and creates pretty charts with it. Although it is intended for LXC containers, it can be used to monitor any type of cgroup. Optionally it can be configured to send a daily/weekly/... mail with those charts.

Home Page: http://lacerta.be

License: Other

lxc-monitor's Introduction

LXC Monitoring

LXC Monitoring collects cpu and memory statistics for several Linux Containers, and creates pretty charts with it. Although it is intended for LXC containers, it can be used to monitor any type of cgroup.

Optionally it can be configured to send a daily/weekly/... mail with those charts.

REQUIREMENTS

  • SQLite v3

  • Gnuplot (nox is ok)

  • Python

  • Python Gnuplot (http://gnuplot-py.sourceforge.net/)

    E.g.: apt-get install sqlite3 gnuplot-nox python python-gnuplot

    Note: The python-gnuplot package will install gnuplot-x11 on Ubuntu. If you don't want that, download gnuplot-py's source, change the default_term value in gp_unix.py to "png", compile and install.

INSTALLATION

There are 2 files needed, a data poller and a chart generator.

Copy the files to the host server, open it in a text editor and change the default configuration parameters (or use command line options). It's pretty self-explanatory.

Initialize the database file:

python /path/to/data_poller.py --init

Add the data poller script to the crontab:

*/5 * * * * python /path/to/data_poller.py

This will collect data every 5 minutes and store it in the sqlite database you configured.

If you want the charts to be generated automatically, add it to the crontab:

0 3 * * 1 python /path/to/generate_charts.py

This will generate the charts every monday morning at 3 am. If you want to receive a nice mail with all the charts, add the -m option:

0 3 * * 1 python /path/to/generate_charts.py -m

USAGE

The default parameters can be overridden through command line options:

usage: generate_charts.py [-h] [-d DAYS] [-n] [-db DATABASE] [-f FOLDER]
                          [-b BASEURL] [-c CONTAINERS [CONTAINERS ...]] [-m]
                          [-r RECIPIENTS [RECIPIENTS ...]]

optional arguments:
  -h, --help            show this help message and exit
  -d DAYS, --days DAYS  Parse records from last DAYS days.
  -n, --noclean         Don't clean up database
  -db DATABASE, --database DATABASE
                        SQLite database file
  -f FOLDER, --folder FOLDER
                        Save charts in FOLDER
  -b BASEURL, --baseurl BASEURL
                        Base URL
  -c CONTAINERS [CONTAINERS ...], --containers CONTAINERS [CONTAINERS ...]
                        LXC Containers to create charts for
  -m, --mail            Send mail with the charts
  -r RECIPIENTS [RECIPIENTS ...], --recipients RECIPIENTS [RECIPIENTS ...]
                        Mail recipients


usage: data_poller.py [-h] [-db DATABASE] [-c CONTAINERS [CONTAINERS ...]]
                      [--init]

optional arguments:
  -h, --help            show this help message and exit
  -db DATABASE, --database DATABASE
                        SQLite database file
  -c CONTAINERS [CONTAINERS ...], --containers CONTAINERS [CONTAINERS ...]
                        LXC Containers to create charts for
  --init                Initialize the database

LICENSE

"THE BEER-WARE LICENSE" (Revision 42): [lennartATlacerta.be] wrote this file. As long as you retain this notice you can do whatever you want with this stuff. If we meet some day, and you think this stuff is worth it, you can buy me a beer in return. Lennart Coopmans

lxc-monitor's People

Contributors

lennartc 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.