# kepware-opc-telegraf Generate a **Telegraf** config file to ingest **OPC-UA** data based on a **KEPServerEX** project file. The generated config includes two inputs, one based on `opcua_listener` (event-based, instant updates, no initial values or periodic polling) and one based on `opcua` (polling-based, slow, but provides initial values and outputs a value at least every `interval`). It also generates a CSV with a list of all the different data points and their descriptions: [./nodes.csv](./nodes.csv) ## Inputs - **kepware_export.xml** - list of OPC nodes from KEPServerEX (see below) - **base_telegraf.conf.toml** - base Telegraf conf (should contain at least one of `inputs.opcua` or `inputs.opcua_listener`) - **generated_telegraf.conf.toml** - path where to save the generated Telegraf conf - **nodes.csv** - path where to save a CSV with a list of nodes and descriptions ## Getting the project file Open **KEPServerEX**, go to File > Save as > select XML in the file type dropdown. Save it as `kepware_export.xml`. ## Base Telegraf configuration You'll need to configure the base Telegraf config according to your setup. This probably means changing at least `outputs.influxdb_v2.{urls,organization,bucket,token}`. You will also need to set your OPC-UA connection parameters in both of the input config blocks. If you want to disable one of the inputs, remove or comment out the entire block. ## Running the converter If you're running from source, build it first: ```sh go build ``` Once you have the executable: ```sh ./kepware-opc-telegraf -csv_out nodes.csv -telegraf_template ./base_telegraf.conf.toml -telegraf_out ./generated_telegraf.conf.toml ./kepware_export.xml ```