This tool generates complete Telegraf configurations for use with the rex_iot output plugin. It automatically discovers data table structures from the REX Controls IoT Cloud JSON-RPC API and validates that your configuration matches the required schema.
telegraf.conf) from a single RexIotTelegraf.json file.rex_json_rpc and rex_legacy type sources (REXYGEN Control System).rex_iot output plugin (no Python needed at runtime).Released versions of the REX IoT Telegraf Configuration Generator can be found at https://download.rexcontrols.cz/partner/daily/iot/rexiot-telegraf-conf/.
Make sure, you have Python 3 with venv installed on your device.
After instalation of the REX IoT Telegraf Configuration Generator follows the Download and install section of the REX IoT Telegraf.
Run the following commands:
wget "https://download.rexcontrols.cz/partner/daily/iot/rexiot-telegraf-conf/latest/rexiot-telegraf-conf-linux.tar.gz" && \
mkdir -p rexiot-telegraf-conf-linux && \
tar -xzf rexiot-telegraf-conf-linux.tar.gz -C rexiot-telegraf-conf-linux && \
sudo ./rexiot-telegraf-conf-linux/install.sh
Download and expand the latest ZIP from https://download.rexcontrols.cz/partner/daily/iot/rexiot-telegraf-conf/latest/rexiot-telegraf-conf-windows.zip .
And run the install.bat.
RexIotTelegraf.json)The configuration file controls Telegraf input and output generation through REX Controls IoT Cloud API discovery.
iot_connectionsNamed dictionary of IoT Cloud connections used for schema discovery and runtime data sending. Each key is a connection name referenced by objects.
url: IoT Cloud JSON-RPC API endpoint for particular Instance and Project (e.g., "https://iot-cloud/api/v0/instance-1/project").api_key: IoT Cloud API authentication key.secret_key: IoT Cloud API secret key.timeout: Request timeout (default: "5s").write_strategy (Optional): Controls which IoT Cloud JSON-RPC method is used. "atomic" (default in plugin) uses insertData where all rows succeed or fail together. "robust" uses insertDataByOne where rows are written individually (significantly slower). "robust_fallback" first tries atomic and, if it fails, retries the batch using robust — suitable for mostly valid data with occasional values outside server-side constraints (e.g. min/max); however, for consistently bad data it is the worst option because every batch triggers two API calls. If omitted, the plugin default is used.ignore_duplicit (Optional): If true, tells the API to silently ignore rows with duplicate timestamps. If omitted, the plugin default is used.omit_disconnected (Optional): If true, skips sending data when the object is disconnected. If omitted, the plugin default is used.When only one connection is defined, objects don't need to specify iot_connection explicitly — it is assigned automatically.
telegrafGlobal settings for data collection and Telegraf agent configuration. See Telegraf Configuration Documentation for details.
sampling_interval: Collection interval (e.g., "2s").flush_interval: How often to send data to IoT Cloud (e.g., "15s").metric_batch_size: Maximum metrics per batch (default: 1000).metric_buffer_limit: Maximum metrics in buffer (default: 10000).agent (Optional): JSON object with additional Telegraf [agent] section parameters (e.g., {"quiet": true, "collection_jitter": "10ms"}). These parameters are passed directly to the generated telegraf.conf without validation. This allows fine-tuning Telegraf behavior without modifying the generator. See Telegraf Agent Configuration for available parameters.Note: merge_period is required only when at least one rex_legacy source is present. In that case, the generator adds [[aggregators.merge]] to the output to merge several metrics together.
sourcesDefinitions of data sources (PLCs, devices). Each key is a source name referenced by objects.
type: Source type (currently supported: "rex_json_rpc", "rex_legacy").url: Address of the REXYGEN Control System API (REXYGEN JSON-RPC for "rex_json_rpc", REXYGEN REST for "rex_legacy").user, pass: Authentication credentials.sampling_interval (Optional): Overrides the global sampling interval for this source.objectsList of objects to monitor. Each object must have:
object_table_id: IoT Cloud object table ID.object_id: IoT Cloud object ID.iot_connection (Optional for single connection): Name of the IoT Cloud connection from iot_connections.source: Reference to a source name from sources.iot_columns: Array of column mappings with:
name: Column name in the data table.rex_path: REXYGEN variable path (connection string) for "rex_json_rpc" sources (e.g., "$.task.AND:U1"). Required for non-default_value columns when source type is rex_json_rpc.rex_uri: REXYGEN relative URI to the value for "rex_legacy" sources (e.g., "myproject_task/AND:U1"). Required for non-default_value columns when source type is rex_legacy.default_value: A constant value sent to IoT Cloud for this column instead of reading from the source. When a column has default_value, it can only contain name, default_value, and optionally virtual with type fields.virtual (Optional): Boolean flag indicating this is a virtual column. Virtual columns:
type field specifying the data type? suffix in the generated schemanull_if conditionsdefault_valuetype (Required for virtual columns): Data type of the column. Must be one of the allowed IoT Cloud types: object_reference, enum_reference, bool, small_int, int, big_int, real, double, varchar, text, numeric_bitfield, bitfield, json_binary, date, time, time_timezone, datetime, datetime_timezone, byte_array, ip_address, uuid. For virtual columns, array suffix [] is also allowed (e.g., int[]). Non-virtual columns MUST NOT have a type field.null_if (Optional): Array of conditions for when this field should be set to null. Each condition has:
control_field: Name of another column whose value determines if this field should be nullvalues: Array of values - if control_field has any of these values, this field is set to nullColumn requirements: Each object must have at least one non-virtual iot_column without default_value (i.e., at least one column that reads real data from the source and is part of the data table schema).
Uniqueness constraint: Each combination of (iot_connection, object_table_id, object_id) must be unique across all objects. Duplicate definitions will cause a validation error.
Additional fields (ignored if present):
Additional human-readable labels like name or description in objects or sources are not used in generation.
rexiot-telegraf-conf path/to/RexIotTelegraf.json [output/path/telegraf.conf]
This command:
RexIotTelegraf.json.telegraf.conf with:
[[inputs.http]] sections for data collection from REX systems.[[outputs.rex_iot]] sections with data table schemas and object mappings (one per IoT connection).If output path is not specified, telegraf.conf is created in the same directory as RexIotTelegraf.json.
See the REX IoT Telegraf for more deatailed deployement instructions.
rexiot-telegraf --config path/to/generated/telegraf.conf
Telegraf will:
rex_iot plugin (no Python needed at runtime).When you run config_generator.py, it performs these API calls:
getTableObjects: Fetches all objects for each object_table_id to get their dataTableId.getTableDataTables: Fetches data table structures (columns, types, optional flags).iot_columns.type field; non-virtual columns do not have a type field.default_value.(iot_connection, object_table_id, object_id) combinations exist.? suffix, and null_if conditions are generated as [[outputs.rex_iot.object.null_if]] sections.config_generator.py: Main configuration generator script.templates/: Jinja2 templates for telegraf.conf generation.Examples/: Example configurations with detailed READMEs.