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

**URL:** <https://community.influxdata.com/t/inputs-modbus-error-in-plugin-slave-1-eof/35486>\
**Category:** Telegraf\
**Created:** [August 29, 2024, 1:35pm UTC](https://community.influxdata.com/t/inputs-modbus-error-in-plugin-slave-1-eof/35486 "2024-08-29T13:35:05Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![lucariello](https://sea1.discourse-cdn.com/flex023/user_avatar/community.influxdata.com/lucariello/32/16102_2.png) [@lucariello](https://community.influxdata.com/u/lucariello)\
**Post date:** [August 29, 2024, 1:35pm UTC](https://community.influxdata.com/t/inputs-modbus-error-in-plugin-slave-1-eof/35486/1 "2024-08-29T13:35:06Z")

</div>

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:

```auto

# 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"
```

---

<div class="post-metadata">

**Author:** ![ebabeshko](https://sea1.discourse-cdn.com/flex023/user_avatar/community.influxdata.com/ebabeshko/32/14844_2.png) [@ebabeshko](https://community.influxdata.com/u/ebabeshko)\
**Post date:** [August 29, 2024, 3:41pm UTC](https://community.influxdata.com/t/inputs-modbus-error-in-plugin-slave-1-eof/35486/2 "2024-08-29T15:41:38Z")

</div>

Try increasing `timeout` parameter

---

<div class="post-metadata">

**Author:** ![srebhan](https://sea1.discourse-cdn.com/flex023/user_avatar/community.influxdata.com/srebhan/32/8572_2.png) [@srebhan](https://community.influxdata.com/u/srebhan)\
**Post date:** [August 29, 2024, 6:57pm UTC](https://community.influxdata.com/t/inputs-modbus-error-in-plugin-slave-1-eof/35486/3 "2024-08-29T18:57:13Z")

</div>

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:

```toml
  [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

```

---

<div class="post-metadata">

**Author:** ![lucariello](https://sea1.discourse-cdn.com/flex023/user_avatar/community.influxdata.com/lucariello/32/16102_2.png) [@lucariello](https://community.influxdata.com/u/lucariello)\
**Post date:** [August 30, 2024, 6:58am UTC](https://community.influxdata.com/t/inputs-modbus-error-in-plugin-slave-1-eof/35486/4 "2024-08-30T06:58:50Z")

</div>

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!
