From 8ea7df854fc10cba9c3a19937e3c06b329bd83be Mon Sep 17 00:00:00 2001 From: Oskari Timperi Date: Thu, 21 Nov 2019 18:28:39 +0200 Subject: Add documentation --- src/update_database.nim | 31 +++++++++++++++++++++++++++++++ src/update_graphs.nim | 17 +++++++++++++++++ 2 files changed, 48 insertions(+) (limited to 'src') diff --git a/src/update_database.nim b/src/update_database.nim index 1a27517..0ac4962 100644 --- a/src/update_database.nim +++ b/src/update_database.nim @@ -1,3 +1,34 @@ +## RRD database update CGI program. Takes JSON measurements from ruuvitag-upload +## (https://github.com/oswjk/ruuvitag-upload) as input and stores them in the correct RRD database. +## +## The JSON format is as follows: +## +## { +## "alias": { +## "timestamp": , +## "temperature": , +## "humidity": , +## "pressure": , +## "battery_potential": +## }, +## "another_alias": { +## ... +## } +## } +## +## The program should be run with an accompanying CGI script as the main driver. The web server will +## execute the script which looks like this: +## +## #!/path/to/update_database +## databaseDir = /path/to/where/databases/are +## +## This will execute update_database with one argument: the path to this script file. +## update_database will read this script and parse it as a configuration file. The databaseDir +## option should point to where the .rrd databases are stored. +## +## The update_database program will use the ``alias`` from measurements as the database name (with +## ``.rrd`` extension). + import json import os import osproc diff --git a/src/update_graphs.nim b/src/update_graphs.nim index 3f902a4..b1747dd 100644 --- a/src/update_graphs.nim +++ b/src/update_graphs.nim @@ -1,3 +1,20 @@ +## RRD database graphing tool. Reads all databases from a directory and generates graphs from each +## of them. +## +## The generated graphs include +## +## - Temperature for today and yesterday +## - Temperature for current month and previous month +## - Relative humidity for today and yesterday +## - Relative humidity for current month and previous month +## - Pressure for today and yesterday +## - Pressure for current month and previous month +## +## The database directory is constructed from the path to this executable, by using the relative +## path ``../database``. +## +## The graphs are output to directory specified on the command line. + import os import osproc import strformat -- cgit v1.2.3