Siemens S7 Comm Telegraf Input Plugin

Use This InfluxDB Integration for Free

The S7 series is the latest generation of Programmable Logic Controllers (PLCs) built by Siemens. PLCs are industrial computers built for automation and production, and are used in fields such as manufacturing and robotics. Siemens S7 PLCs are built to be versatile and support remote control of machinery. The gos7 library implements Siemens S7 control in golang.

Why use a Telegraf plugin for Siemens S7?

The Siemens S7 Comm plugin lets you collect metrics from a Siemens S7 PLC. You can record information from timers and counters as well as metrics like CPU status and send that data to InfluxDB. This makes it simple to analyze the past performance of your PLC to optimize your application and set up alerts for problems such as CPU overloading.

How to monitor Siemens S7 Comm using the Telegraf plugin

To get started with the Siemens S7 Comm plugin, you set the variable pollInterval to the frequency that you want to collect metrics. Configuration is straightforward. The parameters you need to set before getting started using the plugin are name, plc_ip, plc_rack, plc_slot, connect_timeout, request_timeout, and nodes.

In addition you need to specify one of the following data types in your config file for each node: bool, byte, word, dword, int, dint, uint, udint, real, time

Finally, Siemens S7 Comm is an external plugin and uses shim and execd. Add the following code to your main Telegraf configuration file.

[[inputs.execd]] command = [“/path/to/s7comm”, “-config”, “/path/to/s7comm.plugin.conf”] signal = “none” restart_delay = “10s” data_format = “influx”

Key Siemens S7 Comm metrics to use for monitoring

With the gos7 library you can use the following functions to control your Siemens S7 PLC:

  • Read/Write Data Block
  • Read/Write Merkers
  • Read/Write IPI
  • Read/Write Timer
  • Read/Write Counter
  • Multiple Read/Write Area
  • Get Block Info
  • Hot start/Cold start / Stop PLC
  • Get CPU of PLC status
  • List available blocks in PLC
  • Set/Clear password for session
  • Get CPU protection and CPU Order code
  • Get CPU/CP Information
  • Read/Write clock for the PLC Helpers
  • Get/set value for a byte array for types

The Siemens S7 Comm Telegraf plugin lets you collect these metrics from your PLC.

For more information, please check out the documentation.

Project URL   Documentation

Related resources


The most powerful time series
database as a service

Get Started for Free

Developer Education

Training for time series app developers.

View All Education