Configuring data aggregation
Configure data to aggregate automatically
Data aggregation is enabled by editing the config/services.json file. Set "enabled" to false as shown below:
{ "serviceName": "aggregation", "serviceLibrary": "./aggregation/cttimestamp.dll", "enabled": false }
Restart the server.
The table to be aggregated must have at least one
CT_TIMESTAMP
auto-timestamp field.The auto-timestamp field must be the first segment of any index on that table.
Signed integer types:
CT_TINYINT
CT_SMALLINT
CT_INTEGER
CT_BIGINT
Unsigned integer types:
CT_UTINYINT,
CT_USMALLINT
CT_UINTEGER
CT_UBIGINT
Float types:
CT_SFLOAT
CT_EFLOAT
CT_DFLOAT
The automatic data aggregation feature is configured using a plugin configuration file, cttimestamp.json
.
Navigate to and open the
cttimestamp.json
file in theconfig
folder (server\aggregation\ctTimeStamp.dll
).Observe the format of the
cttimestamp.json
file:{ "debug": false, "sourceTableList": [ { "database": "ctreeSQL", "sourceTableName": "sensor", "aggregatedTableList": [ { "aggregatedTableName": "aggregation1", "timestampFieldName": "ts", "unitOfTime": "second", "unitOfTimeValue": 20, "aggregatedTableInSQL": true, "aggregatedTableOwner": "admin", "aggregatedFieldList": [ { "aggregatedFieldName": "TempAverage", "sourceFieldName": "temperature", "aggregateFunction": "average" } ] } ] } ] }
Edit the
config/services.json
file. Adjust the following section to changefalse
totrue
:{ "serviceName": "aggregation", "serviceLibrary": "./aggregation/cttimestamp.dll", "enabled": true }
Restart the server.
Example
{ "sourceTableList": [ { "database": "ctreeSQL", "sourceTableName": "sensor", "aggregatedTableList": [ { "aggregatedTableName": "aggregation1", "timestampField": "ts", "unitOfTime": "second", "unitOfTimeValue": 20, "aggregatedFieldList": [ { "aggregatedFieldName": "TempAverage", "sourceFieldName": "temperature", "aggregateFunction": "average" }, { "aggregatedFieldName": "PressMax", "sourceFieldName": "pressure", "aggregateFunction": "maximum" } ] } ] } ] }
Property summary
cttimestamp.json
property summariesProperty | Description | Default | Type | Limits (inclusive) | ||
---|---|---|---|---|---|---|
| enables timestamp/aggregation debugging |
| Boolean |
| ||
contains an array of source tables | array |
The "sourceTableList"
array contains a list of source tables.
Property summary
"sourceTableList"
property summariesProperty | Description | Default | Type | Limits (inclusive) |
---|---|---|---|---|
| contains the c-tree database name to contain the | string | ||
| contains the source table to aggregate from | string | ||
contains a list of storage tables | array |
Property summary
"aggregatedTableList"
properties summaryProperty | Description | Default | Type | Limits (inclusive) | ||
---|---|---|---|---|---|---|
| defines the name of an aggregation table | string | ||||
| defines the source table field name with auto-timestamp value to monitor | string | ||||
| defines the time unit of the aggregation frequency NoteThis parameter sets the width of the aggregation sample window, in units of time — for example, setting | string | ||||
| defines the time value of the aggregation frequency NoteThis parameter sets the width of the aggregation sample window, in units of time — for example, setting | integer | ||||
| indicates if the aggregation table is available | Boolean |
| |||
| sets the SQL owner of the aggregation table | Inherited from the source table or | string | |||
contains a list of aggregated values to include in the aggregation table where each value is one field in the table | array |