Skip to content

Documentation

Prerequisites

This project is intended for Linux systems (it has been tested for Debian).

Here are the dependancies:

  • sysstat, a bundle of sytem performance tools,
  • apache2 or another web server that can run scripts,
  • Python 3.x

Naming

From now on, it will be refered to as Directory.

Before going further, please create a directory for the web interface like /var/www/html/monitoring. its path will be needend through this process.

System data collection

Data collection is done by script.sh. Make it executeable and give it to a user who can write to the Directory and memorize the scripts path.

Open the file and customize the Directory to your liking.

script.sh
4
file="/var/www/html/monitoring/measures"

Next, open your crontab (etc/crontab) and add the script to be executed every minute.

Crontab example
22
* * * * * user /user/script.sh

Check

After a minute, the measures file should appear in the Directory.

Python script

Copy index.py and style.css into the Directory and make index.py executeable.

Customization

Three variables have been moved to the top of the file to be easily customizable:

Database path
6
7
8
9
### Customisation ###

# File containing the measures
database = "measures"
Target of the 'home' button
10
11
# URL of the "home" button
url = "http://localhost"
Displayed version
12
13
# Displayed program version
version = "Version 1.1"

Apache configuration

You need to make several changes to Apaches configuration:

  • Allow script execution
  • Add a Python handler
  • Load the CGI module
  • Make index.py the index page

Open Apaches configuration file and create a <Directory> part for the Directory:

/etc/apache2/apache2.conf
170
171
172
173
174
175
176
177
<Directory /var/www/>
        Options Indexes FollowSymLinks ExecCGI
        AddHandler cgi-script .cgi .py
        LoadModule cgi_module /usr/lib/apache2/modules/mod_cgi.so
        AllowOverride None
        Require all granted
        DirectoryIndex index.py
</Directory>

Reload the server:

systemstl reload apache2

Check

The web interface should be availible at http://localhost/Directory.