Raspberry Pi Code
collect
- Read the config file (below) to map sensor serial numbers to parameter names
- collect the data from the sensors
- for any missing sensors, log an error
- for any unlisted sensors, collect the data with the serial number
- log any internal status messages
- write the output of the data collection subroutines to a timestamped file in the data queue directory
send
- if there's no data queued up, just quit
- Read the config file with the credentials username and password.
- open a connection to the mothershp
- send data & logs (via HTTP / HTTPS POST) found in the queue directory
- delete the queued data if the post is successful
- receive a command block from the mothership (contents & function to be determined.)
config files
- one file containing mothership data posting credentials
- map of sensor serial numbers to parameter names e.g. 0008021eb5ed --> "T1"
- map will also contain a flag to indicate that the sensor is there but should be ignored
Mothership Code
receive
- CGI
- accept a posting from the RPi containing
- V1: put the posting into a queue file for later processing & storage
- V2: store the received data into the database
- reply with an acknowledgement / command block
- forward any error messages
post to MRTG
We'll use MRTG to generate graphs (at least in the beginning.)
- for each client, look at the last timestamp
- select the data from the database posted since then
- post that to MRTG.
monitor
- check the database for recent postings from all clients.
- alarm when a client is missing for e.g. more than 6 hours