When this driver is active, the packets transiting on the bus are stored using SQL database (mysql).
This database could be located on the system drive, an USB key or an external mysql database.
Logger parameters
The mysql logger parameters are defined in the logger json (refer to core/loggers module)
Database tables
Average computation
The average aggregate is computed over time. As shown in the schema below, the last known value is valid until a new one is logged (e.g. there is no linear interpolation for computing the average).
Logger parameters
The mysql logger parameters are defined in the logger json (refer to core/loggers module)
{
id: 1,
name: 'mysql usb',
description: 'logs mysql',
driver: 'mysql.js', //link to the Javascript driver file used to log values.
activ: 1,
state: 'connected', //The state can be "disconnected", "connecting", or "connected"
json: { // logger driver parameters
storage: 'usb', // tries to find the database on the usb stick, and starts the unix mysqld process.
// the storage could also be "external" to log on a remote mysql database.
info : { //if the storage is "external", then additional information needs to be specified.
//these parameters are documented in the nodejs mysql driver : https://github.com/mysqljs/mysql
host : '54.33.22.114',
port : 3306,
user : 'root',
password : 'my password',
database : 'weble'
}
}
}
Database tables
- logs : raw logs. you can choose in the administration interface for each data point the log frequency or to log every time it changes. The logs table contains the data point address, raw packet (hexadecimal string), and the decoded value (numerical).
- logs_quarterly (logs aggregated every 15 minutes).
- logs_3hourly
- logs_daily
- logs_weekly
- logs_monthly
Average computation
The average aggregate is computed over time. As shown in the schema below, the last known value is valid until a new one is logged (e.g. there is no linear interpolation for computing the average).
_________________
value 6 | ________________________
| | value 5 |
|___________| |
value 3 |
|__________
value 2
________________|___________|_______________________|__________ time (minutes)
0 16 27 50 60
average = (6*16 + 11*3 + 23*5 + 2*10) / 60