[inputs.modbus] Error in plugin: slave 1: EOF

HI! I am using Telegraf to acquire data through the Modbus protocol.
I have two network analyzers: one connected with TCP and one connected via serial.
When I start telegraf, the first acquisition is successful but then I get this error “E! [inputs.modbus] Error in plugin: slave 1: EOF”.

I read other similar topics but unfortunately they didn’t help me.

This is my file telegraf.conf:


# Configuration for telegraf agent
[agent]
  interval = "30s"
  round_interval = true
  metric_batch_size = 1000
  metric_buffer_limit = 10000
  collection_jitter = "5s"
  flush_interval = "10s"
  flush_jitter = "0s"
  precision = "0s"
  hostname = ""
  omit_hostname = false

      [[inputs.modbus]]

        name = "raspberrypi"
        timeout = "1s"
        controller = "file:///dev/serial/by-path/platform-3f980000.usb-usb-0:1:1.0-port0"
        baud_rate = 9600
        data_bits = 8
        parity = "N"
        stop_bits = 1
        transmission_mode = "RTU"
        debug_connection = true
        configuration_type = "request"

[[inputs.modbus.request]]
    slave_id = 5
    byte_order = "ABCD"
    register = "holding"
    fields = [
         { address = 856, name = "Energia Attiva Positiva",type = "INT32"},
         { address = 858, name = "Energia Reattiva Positiva",type = "INT32"},
         { address = 50514, name = "V12",type = "INT32", scale=0.01},
         { address = 50516, name = "V23",type = "INT32", scale=0.01},
         { address = 50518, name = "V31",type = "INT32", scale=0.01},
         { address = 50520, name = "V1",type = "INT32", scale=0.01},
         { address = 50522, name = "V2",type = "INT32", scale=0.01},
         { address = 50524, name = "V3",type = "INT32", scale=0.01},
         { address = 50526, name = "Frequenza",type = "INT32", scale=0.01},
         { address = 50528, name = "I1",type = "INT32", scale=0.01},
         { address = 50530, name = "I2",type = "INT32", scale=0.01},
         { address = 50532, name = "I3",type = "INT32", scale=0.01},
         { address = 50534, name = "IN",type = "INT32", scale=0.01},
         { address = 50536, name = "Potenza Attiva",type = "INT32", scale=0.01},
         { address = 50538, name = "Potenza Reattiva",type = "INT32", scale=0.01},
         { address = 50540, name = "Potenza Apparente",type = "INT32", scale=0.01},
         { address = 50542, name = "Fattore di Potenza",type = "INT32", scale=0.001},
    ]

    [inputs.modbus.request.tags]
      slave_id = "5"
      location = "DIRIS A-10"


   [[inputs.modbus]]

      name = "CCI"
      timeout = "1s"

    busy_retries = 1
    busy_retries_wait = "100ms"
    controller = "tcp://192.168.3.30:503"
    transmission_mode = "TCP"
    debug_connection = true
    configuration_type = "request"

    [[inputs.modbus.request]]
      byte_order = "ABCD"
      register = "holding"
      fields = [
         { address = 2562, name = "V1",type = "FLOAT32"},
         { address = 2564, name = "V2",type = "FLOAT32"},
         { address = 2566, name = "V3",type = "FLOAT32"},
    ]

    [inputs.modbus.request.tags]
      location = "EMS-96"

Try increasing timeout parameter

1 Like

An EOF usually indicates that the connection to the device is lost. If increasing the idle-timeout doesnt help, maybe your device requires a reconnect after each request, which can be done by activating the corresponding workaround:

  [inputs.modbus.workarounds]
    ## Close the connection after every gather cycle.
    ## Usually the plugin closes the connection after a certain idle-timeout,
    ## however, if you query a device with limited simultaneous connectivity
    ## (e.g. serial devices) from multiple instances you might want to only
    ## stay connected during gather and disconnect afterwards.
    close_connection_after_gather = true
1 Like

Thanks a lot for the tip @Srebhan, it seems to work now!
I had already tried this solution taking inspiration from the documentation on Github but evidently I had made a mistake in some other point.
Thanks for your time!

1 Like