# 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`). ## 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 ## 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 kepware_export.xml base_telegraf.conf.toml generated_telegraf.conf.toml ```