All in One Solution for fast, easy and reliable server/service monitoring. Written in Python/JavaScript.
JavaScript Python HTML CSS
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
images
pyMetricClients
pyMetricServer
pyMetricWeb
.gitignore
LICENSE.md
README.md
pyMetric.wsgi

README.md

pyMetric

pyMetric is a LAN Server/Service Monitoring solution optimized for ease of use and reliability. It is based on 3 components:

  • The RESTful server backend written with flask in python (WSGI compliant / runs under apache2,nginx,...)
  • The client reporting scripts. Used to report data to the backend server.
  • The web frontend. Displays data as a dashboard to the user.

pyMetric/pyMetricServer

The pyMetric Server serves all requests to put data in or pull data out of the database. You can either start it with the integrated development WSGI server simply by running the pyMetric.py script inside the pyMetricServer folder, or run it behind a real webserver like apache or nginx (Recommended for production use).

There are currently 3 API Rest endpoints to get/fetch/update data:

/api/v1.0/metrics/get

// TODO

/api/v1.0/messages/get

// TODO

/api/v1.0/cron

// TODO

pyMetric/pyMetricClients

There are several client API scripts available to report data to the backend server. Use them on your clients.

log_messages.py

The log_messages.py script is a CLI for the log_messages API endpoint of the RESTful server backend. Use it in all your cronjobs / regular scripts to notify the backend. Usage:

log_messages.py <Origin> <Message> <LOG|NOTICE|WARNING|ERROR> <API endpoint>

  • The first parameter describes the origin of the message (usually the IP or hostname of the server) e.g. 10.0.0.5
  • The second parameter is the message itself that gets logged e.g. "update-database cron failed!"
  • The third parameter describes the message type e.g. ERROR
  • The last parameter ist the API endpoint e.g. monitoring.server.local:5000

report_cpu.py

The report_cpu.py script reports the cpu usage to the metric API endpoint of the RESTful server backend. Use as often as you like to know cpu usage on your hardware Usage:

report_cpu.py <Origin> <API endpoint>

  • The first parameter describes the origin of the message (usually the IP or hostname of the server) e.g. 10.0.0.5
  • The last parameter ist the API endpoint e.g. monitoring.server.local:5000

run_cron.py

The run_log.py script runs the server side cron task via the RESTful API for deleting old entries in database etc. Usage:

run_cron.py <API endpoint>

  • The first parameter ist the API endpoint e.g. monitoring.server.local:5000

pyMetric/pyMetricWeb

Prerequisites

  • PostgreSQL server

  • Python 2.7 with flask, jinja2, markupsafe, werkzeug, itsdangerous, psycopg2, psutil
    pip install flask jinja2 markupsafe werkzeug itsdangerous psycopg2 psutil

    if psycopg2 fails it's probably because of missing postgresql-dev-x.y package (install it via apt)

  • optional: web server (apache2,nginx,..) with wsgi module

Usage

  1. Make sure every prerequisites are fulfilled
  2. Rename config.py.dist into config.py
  3. Edit the config.py to match your auth credentials for the PostgreSQL database
  4. To run the server either setup your webserver to use the pyMetricServer/pyMetric.py as WSGI application or just run pyMetricServer/pyMetric.py to use the standalone server
  5. Use the client API scripts to insert data

pyMetric Info Graphic

Contributors

Credit