CSV Writer

Description

ezvpn-csv-writer is a pre-configured container docker for the IOhubTM environment.

ezvpn-csv-writer creates a CVS file within the EZ Box file system that contains the measurement name, its value and its timestamp. From configuration you can define the file size and retention.

The CSV file can be downloaded by connecting to the EZ Box, for example using filebrowser container.

How to use it

You can use ezvpn-csv-writer directly in IOhubTM for final production, or on your PC for testing purposes.

The Docker image is provided as follows, with the description of each environment variable used by the container.

If used with ezvpn-mqtt, no environment variable needs to be provided.

ezvpn-csv-writer does a subscribe on an MQTT topic and writes the content in a CVS file defined in the container Environment variable CSV_PATH

If you do not define a Volume, the CSV file created will not have persistence and will not be readable externally. In order to read it you will need to mount a Global Volume or an Application Volume to have persistence and to be able to read it. For example, to read the CSV file you can use the filebrowser container. For more informations on "Volumes", please visit this section.

Make sure that the CSV_PATH and the path to the mounted Volume are the same otherwise the CSV files will not be visible. Remember to use a "Global Volume" or an "Application Volume".

CSV format

The data stored on CSV file is on format below:

value,ts,protocol,measurement

value: The measurement value

ts: UNIX timestamp

protocol: The measurement protocol

measurement: The measurement name

Environment variables

When you start the ezvpn-csv-writer container, you can adjust the instance's configuration by passing one or more environment variables to the docker run command.

  • MQTT_HOST: MQTT host. Defaults to 127.0.0.1.
  • MQTT_PORT: MQTT port. Defaults to 1883.
  • MQTT_IN_TOPIC: MQTT topics to subscribe. Default to fld/+/r/#. Subscribe to multiple topics can be obtained defining each topic on a separated line.
  • CSV_PATH: File path of CSV file to be populated with MQTT incoming messages. Defaults to /tmp/log.csv.
  • CSV_MAX_SIZE: Max size for CSV. Units of measures are k (kilobyte), m (megabyte), g(gigabyte). Defaults to 10m.
  • CSV_MAX_ROTATE: Max number of rotated CSV files. Defaults to 10.
  • CSV_CHECK_FREQ: Interval in minutes between each log size check. Defaults to 5.

Docker container details

Image: us-central1-docker.pkg.dev/ez-shared/iohub/iohub-csv-writer

Supported architecture: amd64

Changelog

v1.0.1
  • Smaller image

  • MQTT_IN_TOPIC accepts multiple topics

v1.0.0
  • First Release