Topics

Add Topics

InfluxDB Connector topics are “Auto” topics which means that no individual tags or tag mappings are required. You can think of an “Auto” topic as a placeholder that generates InfluxDB measurements, tag keys, field keys and field values on the fly, depending on what data is “sent” to the topic. We’ll have an example in a later section.

To add topics, click the “Add” button with an InfluxDB Connector database node selected in the main application’s nagivation pane (the selected database in the example below is called “TestDB”). This will add a topic with default settings.

../_images/influxdb-add-topic.png

Topic Settings

For each topic you can configure:

  • Name
    The topic’s name; choose any descriptive name.
  • InfluxDB Measurement Name
    All data for this topic will be stored as part of the specified measurement. Change the default value to your liking. You may have multiple Connector topics storing data for the same measurement; in that case you should probably define additional tag keys for each of these topics so you can distinguish the data later. Do not “escape” the measurement name; the Connector will do this for you.
  • InfluxDB Tag Key for output topic names
    You can optionally add an InfluxDB tag key that will have the name of a derived output topic assigned (please see the usage example below for an explanation). The default value for this key is “topic”. If you would prefer not to use this additional InfluxDB tag then clear the entry field and leave it blank. Do not “escape” the tag key; the Connector will do this for you.
  • Additional InfluxDB Tag Key/Value pairs
    You can optionally define additional InfluxDB tag keys and values; these will be added to each measurement. Do not “escape” the tag keys or values but avoid using the equal ‘=’ sign as part of the name or value; the Connector will escape other characters. Simply separate the key/value pairs by comma.
  • InfluxDB timestamp precision
    Select the timestamp precision for field value time stamps that are to be stored with field values. Note that UA Office Link uses timestamps in units of 100 nanoseconds and true nanosecond precision is not achievable.
  • InfluxDB Retention Policy
    Enter the name of a InfluxDB retention policy that should be applied to measurements.
  • InfluxDB (Enterprise) write consistency
    Select a write consistency option for cluster storage. The consistency option is sent to the InfluxDB service with each request to store values.
  • Write value status field
    Tick this option to store a numerical “status” code (following the OPC UA specification) as an additional field value.
  • Uncertain value options
    • Write the uncertain value
      When a tag value with “uncertain” status is received (following the OPC UA meaning of “uncertain”) then the uncertain value is written to the database like a “good” value would be.
    • Write a default value (zero or empty)
      When a tag value with “uncertain” status is received then a zero is written for numerical values and an empty string is written for string values.
    • Ignore (do not write)
      When a tag value with “uncertain” status is received then it is ignored.
  • Bad value options
    • Write a default value (zero or empty)
      When a tag value with “bad” status is received (in the OPC UA sense) then a zero is written for numerical values and an empty string is written for string values.
    • Ignore (do not write)
      When a tag value with “bad” status is received then it is ignored.

Usage example

The following image shows an example. A topic called “Signal Generators” is configured to use measurement name “Signals” and to use the additional tag key “generator” for derived output topics. All other settings are left to the default.

../_images/influxdb-usage1.png

A task called “Task1” is configured to transfer data to InfluxDB (see image below). The task receives input from OPC UA connector topics “SignalGenerator1”, “SignalGenerator2” and “SignalGenerator3”. The InfluxDB connector’s placeholder topic “Signal Generators” derives corresponding output topics for InfluxDB including the configured InfluxDB tag key called “generator”; the value for this tag key is set to the name of the derived output topic which carries the same name as the corresponding input topic (“SignalGenerator1”, “SignalGenerator2” and “SignalGenerator3”).

Values within the derived topics are stored as InfluxDB field keys and field values. In the example below the field keys are “Ramp1”, “Random1” and “Sine1”.

../_images/influxdb-usage2.png

InfluxDB can now be queried for the stored values. For example, to retrieve the “Sine1” signal of signal generator “SignalGenerator1” of the “Signals” measurement, type the following query into the InfluxDB command line.

select Sine1 from Signals where (generator='SignalGenerator1')
../_images/influxdb-usage3.png

Remove Topics

Remove topics by selecting a database in the navigation panel and one or more topics in the content panel. Click on the “Remove” toolbar button to remove selected topics.

../_images/influxdb-remove-topic.png

Warning

Note that topics are also removed from any task using the topics.