Skip to main content
Version: dev

Monitoring Siemens S7 PLC

Monitor values and response time exposed by a Siemens S7 PLC over the S7 protocol.

Protocol: S7

Before You Begin​

  1. Ensure the target PLC is reachable from the HertzBeat collector on the S7 TCP port (default: 102).
  2. Ensure that the PLC permits the required S7 communication and read access to the configured addresses.
  3. Obtain the rack ID, slot ID, controller type, and readable variable addresses from the PLC configuration or the automation engineer.

HertzBeat uses Apache PLC4X plc4j-driver-s7 0.12.0 to communicate with the PLC. Address strings are passed to that driver without conversion. Use the PLC4X S7 address format that matches the target PLC and its variable data types.

Configuration Parameters​

ParameterDescription
S7 Server HostIPv4 address, IPv6 address, or domain name of the target PLC. Do not include a protocol prefix such as s7://.
PortS7 TCP port of the PLC. The template default is 102.
rackIdRemote PLC rack number. It must be numeric; the default is 0.
slotIdRemote PLC CPU slot number. It must be numeric; the default is 0.
controllerTypePLC controller type passed to the PLC4X S7 driver. The template default is S7_1500. Supported values are ANY, S7_200, S7_300, S7_400, S7_1200, S7_1500, and LOGO; select the value appropriate for the target controller.
Request Timeout (ms)Maximum time to wait for a collection request. The template default is 6000 ms; valid values are 400 to 200000. This advanced parameter is hidden in the UI by default.
Holding Register AddressesRequired list of numeric or other non-Boolean PLC variables to read. Each item must be a valid PLC4X S7 tag address.
Coil Register AddressesRequired list of Boolean PLC variables to read. Each item must be a valid PLC4X S7 tag address. Boolean results are reported as 1 for true and 0 for false.

Although the UI uses the names “holding register” and “coil” to group metrics consistently with the PLC collector, the values entered in both lists are native S7 tag addresses, not Modbus addresses.

Address Examples​

The address must include the S7 memory location and data type. Common PLC4X S7 examples are:

PurposeExample address
Boolean in data block 1%DB1.DBX0.0:BOOL
16-bit signed integer in data block 10%DB10.DBW20:INT
Boolean input%I0.0:BOOL
32-bit signed integer in marker memory%MD100:DINT

For a straightforward configuration, add four single-value addresses to each address list. The two metric sets each have four fixed output fields. HertzBeat checks that the number of values produced by each address list is exactly four. If an address uses the template's batch notation such as [n], it counts as n values; ensure the total expanded count is still four.

Collected Metrics​

Metric Set: holding-register​

This availability metric set runs first. A collection failure prevents the lower-priority coil metric set from running in that collection cycle.

MetricUnitDescription
responseTimemsTime required to complete the S7 read request.
address-0noneFirst value resolved from the Holding Register Addresses list.
address-1noneSecond value resolved from the Holding Register Addresses list.
address-2noneThird value resolved from the Holding Register Addresses list.
address-3noneFourth value resolved from the Holding Register Addresses list.

Metric Set: coil​

MetricUnitDescription
responseTimemsTime required to complete the S7 read request.
address-0noneFirst value resolved from the Coil Register Addresses list; Boolean values are converted to 0 or 1.
address-1noneSecond value resolved from the Coil Register Addresses list; Boolean values are converted to 0 or 1.
address-2noneThird value resolved from the Coil Register Addresses list; Boolean values are converted to 0 or 1.
address-3noneFourth value resolved from the Coil Register Addresses list; Boolean values are converted to 0 or 1.

Troubleshooting​

SymptomCheck
Connection or timeout errorVerify network reachability to the configured host and port, then confirm that S7 communication is enabled on the PLC.
Connection established but reads failCheck the rack ID, slot ID, controller type, and the PLC account or PLC project permissions.
Invalid address or tag read errorVerify the address syntax and data type against the PLC project and PLC4X S7 address format.
Template validation error about alias fields and addressesMake sure each address list expands to exactly four values.
Only holding-register metrics are availableResolve the holding-register collection error first; it is the priority-0 availability metric set.