Documentation

Siemens S7 Input Plugin

This plugin reads metrics from Siemens PLCs via the S7 protocol.

Introduced in: Telegraf v1.28.0 Tags: hardware OS support: all

Global configuration options

In addition to the plugin-specific configuration settings, plugins support additional global and plugin configuration settings. These settings are used to modify metrics, tags, and field or create aliases and configure ordering, etc. See the CONFIGURATION.md for more details.

Startup error behavior options

In addition to the plugin-specific and global configuration settings the plugin supports options for specifying the behavior when experiencing startup errors using the startup_error_behavior setting. Available values are:

  • error: Telegraf with stop and exit in case of startup errors. This is the default behavior.
  • ignore: Telegraf will ignore startup errors for this plugin and disables it but continues processing for all other plugins.
  • retry: Telegraf will try to startup the plugin in every gather or write cycle in case of startup errors. The plugin is disabled until the startup succeeds.
  • probe: Telegraf will probe the plugin’s function (if possible) and disables the plugin in case probing fails. If the plugin does not support probing, Telegraf will behave as if ignore was set instead.

Configuration

# Plugin for retrieving data from Siemens PLCs via the S7 protocol (RFC1006)
[[inputs.s7comm]]
  ## Parameters to contact the PLC (mandatory)
  ## The server is in the <host>[:port] format where the port defaults to 102
  ## if not explicitly specified.
  server = "127.0.0.1:102"
  rack = 0
  slot = 0

  ## Connection or drive type of S7 protocol
  ## Available options are "PD" (programming  device), "OP" (operator panel) or "basic" (S7 basic communication).
  # connection_type = "PD"

  ## Max count of fields to be bundled in one batch-request. (PDU size)
  # pdu_size = 20

  ## Timeout for requests
  # timeout = "10s"

  ## Log detailed connection messages for tracing issues
  # log_level = "trace"

  ## Metric definition(s)
  [[inputs.s7comm.metric]]
    ## Name of the measurement
    # name = "s7comm"

    ## Field definitions
    ## name    - field name
    ## address - indirect address "<area>.<type><address>[.extra]"
    ##           area    - e.g. be "DB1" for data-block one
    ##           type    - supported types are (uppercase)
    ##                     X  -- bit, requires the bit-number as 'extra'
    ##                           parameter
    ##                     B  -- byte (8 bit)
    ##                     C  -- character (8 bit)
    ##                     W  -- word (16 bit)
    ##                     DW -- double word (32 bit)
    ##                     I  -- integer (16 bit)
    ##                     DI -- double integer (32 bit)
    ##                     LI -- long integer (64 bit) only S7-1200 S7-1500 suported
    ##                     R  -- IEEE 754 real floating point number (32 bit)
    ##                     LR -- IEEE 754 long real floating point number (64 bit) only S7-1200 S7-1500 suported
    ##                     DT -- date-time, always converted to unix timestamp
    ##                           with nano-second precision
    ##                     S  -- string, requires the maximum length of the
    ##                           string as 'extra' parameter
    ##           address - start address to read if not specified otherwise
    ##                     in the type field
    ##           extra   - extra parameter e.g. for the bit and string type
    fields = [
      { name="rpm",             address="DB1.R4"    },
      { name="status_ok",       address="DB1.X2.1"  },
      { name="last_error",      address="DB2.S1.32" },
      { name="last_error_time", address="DB2.DT2"   },
      { name="long_counter",    address="DB3.LR12"  }
    ]

    ## Tags assigned to the metric
    # [inputs.s7comm.metric.tags]
    #   device = "compressor"
    #   location = "main building"

Example Output

s7comm,host=Hugin rpm=712i,status_ok=true,last_error="empty slot",last_error_time=1611319681000000000i 1611332164000000000

Metrics

The format of metrics produced by this plugin depends on the metric configuration(s).


Was this page helpful?

Thank you for your feedback!


New in InfluxDB 3.5

Key enhancements in InfluxDB 3.5 and the InfluxDB 3 Explorer 1.3.

See the Blog Post

InfluxDB 3.5 is now available for both Core and Enterprise, introducing custom plugin repository support, enhanced operational visibility with queryable CLI parameters and manual node management, stronger security controls, and general performance improvements.

InfluxDB 3 Explorer 1.3 brings powerful new capabilities including Dashboards (beta) for saving and organizing your favorite queries, and cache querying for instant access to Last Value and Distinct Value caches—making Explorer a more comprehensive workspace for time series monitoring and analysis.

For more information, check out:

InfluxDB Docker latest tag changing to InfluxDB 3 Core

On November 3, 2025, the latest tag for InfluxDB Docker images will point to InfluxDB 3 Core. To avoid unexpected upgrades, use specific version tags in your Docker deployments.

If using Docker to install and run InfluxDB, the latest tag will point to InfluxDB 3 Core. To avoid unexpected upgrades, use specific version tags in your Docker deployments. For example, if using Docker to run InfluxDB v2, replace the latest version tag with a specific version tag in your Docker pull command–for example:

docker pull influxdb:2