Skip to main content

Data Export

General

Various protocols are made to transmit data points as they are generated. This is enough for a lot of systems (e.g. SCADAs) that have their own databases and devices only have to buffer fairly recent messages in case of connection or transmission errors. However, there is frequently a need to save and keep the data in files, grouped in batches, and later transmit these batches to a remote server via HTTP(S) or FTP(S). For this purpose a dedicated protocol has been created and called Data export.

Data export functionality is available since firmware version v1.5.0, of WCC Lite.

Overview

Data export service gathers information from other protocols, puts it into files (optionally compressing them) after a timeout or when data buffers fill up; eventually periodically sending them to a server. HTTP(S) and FTP(S) servers with optional authentication are supported. A user can optionally choose between ISO8601 and UNIX timestamp time formats (the latter being the default value). More than one instance can set up, for instance, some of the information can be sent to an FTP server, while other could be transmitted to the HTTP server which is able to handle POST requests.

Using WCC Lite for data export

To configure WCC Lite to use data export server a user can fill in the needed parameters in Excel configuration. These parameters are shown in two tables below. Default values are shown in a bold font.

Data export (data-export) parameters for Devices tab table:

Parameter Type Description Mandatory
name string

User-friendly device name

 
device_alias string

Device alias to be used in configuration

Yes
enable boolean

Enabling/disabling of a device

Yes
protocol string

Selection of protocol (Data Export)

Yes
timeout string

Time frame during which transmission to remote server has to be completed (5 seconds)

 
type string

Selection of file format (”csv-simple”)

 
host string

A URL of remote server where files should be sent

Yes

upload_rate_sec

integer

Frequency of generated file uploads (60 seconds)

 

records_buffer_size

integer

A maximum amount of data change entries to hold before initiating logging mechanism (100)

 

logging_period_sec

integer

Describes how frequently data buffer of records_buffer_size is saved to file

 

log_folder

string

A folder in WCC Lite file system to save generated file (”/var/cache/data-export”)

 

timestamp

string

Selection of time format (”unixtimestamp”, ”iso8601”)

 

compress

string

Selection of file compression mechanism (”none”, ”gz”, ”tar.gz”)

 

It is possible that data generation rate is going to be bigger than what data buffer can hold (controlled by records_buffer_size and logging_period_sec). To make sure that no data loss occurs there’s an additional data logging call made in case data buffer reaches a records_buffer_size value.

Signals to be sent are configured differently than signals for most other protocols. As data export service only transmits signals and does no data processing, usual signal logic is not used for them. That means that:

• Signals for data export service are not seen in the Imported Signals tab;
• Signals for data export service are configured in different Excel sheet called DataExport

Parameters to be filled in the DataExport sheet are shown in a table below.

Data export (data-export) parameters for DataExport tab table:

Parameter Type Description Mandatory

device_alias

string

Device alias to be used in configuration Yes

Yes

device_name

string

User friendly device name as in Device sheet

Yes
tag_name string

User friendly signal name

Yes
source_device_alias string

device_alias of a source device

Yes
source_signal_alias string

source_alias of a source signa

Yes
enable boolean

Enabling/disabling of a measurement to be transmitted and logged

Yes
attribute string

Additional attribute to be attached to a signal

 

Debugging data export service

If configuration for Data export service is set up, handler for protocol will start automatically. If configuration is missing or contains errors, protocol will not start. It is done intentionally to decrease unnecessary memory usage.

Data export (data-export) command-line debugging options

bellow described parameters for debugging is accesbile over console (SSH).

-h [--help] Display help information

-c [--config] Configuration file location

-V [ –version ] Show version

-d<debug level> [ –debug ] Set debugging level

-R [ –readyfile] Ready notification file

-p [ –http ] Show HTTP messages

-r [ –redis ] Show Redis output

If Data export service does not work properly (e.g. data is corrupted, etc.), a user can launch a debug session from command line interface and find out why it is not functioning properly. To launch a debugging session, a user should stop data-export processes and run data-export command with respective flags as in table above.

Host URL format rules

Parameter host is highly configurable and might contain a considerable amount of information:

Protocol - FTP or HTTP (encrypted and encrypted);

URL address - both resolved and non-resolved;

Authentication - pair of user and/or password;

Port - useful when non-standard value is used;

Endpoint - a place in server to which a call is made

The format for host parameter can be summarized as:

[ h t t p ( s ) / f t p ( s ) ] : / / [ [ u s e r ] : [ p a s s w o r d ]@] [ URL ] [ : p o r t ] / [ e n d p o i n t ]

Options are printed in square brackets. A protocol has to be selected, otherwise HTTP will be used as a default. User and password pair is optional, but if user:password pair is used, it should proceeded with @ sign.

HTTP and FTP use default or user assigned ports. By default HTTP uses port 80, while HTTPS uses port 443, FTP sends data over port 21, FTPS - over port 990. Make sure that these ports are open in firewall on both server and client side, otherwise data will not be sent succesfully.

Finally, POST request (for HTTP) or upload (for FTP) can be made to a specific place (endpoint). This endpoint should be described after a URL and port (if used).

Format of exported data

For a server to interpret data, a set of rules for a file format have to be established.

As of software version 1.5.0, data format called csv-simple is supported.

Csv-simple format applies to all files by default and is used as in this example:

### DUID:318110353
# device name, tag name, value , quality , timestamp , attribute

inv2 ,LAN0 Total RX,31.579,1,2020−10−13T17:51:32.718 , inv2 ,RAM usage,44.33,1,2020−10−13T17:51:32.473 ,
inv2 ,SMS sent ,12,1,2009−01−06T04:20:45.421 ,Pb
inv2 ,SMS sent ,12,1,2009−01−06T04:20:45.431 ,