telegraf icon indicating copy to clipboard operation
telegraf copied to clipboard

Modbus default values do not match example config

Open Hipska opened this issue 3 years ago • 2 comments

Relevant telegraf.conf

# Retrieve data from MODBUS slave devices
[[inputs.modbus]]
  name = "SDM630"
  slave_id = 1
  timeout = "1s"
  controller = "file:///dev/ttyUSB0"
  baud_rate = 9600
  data_bits = 8
  parity = "N"
  stop_bits = 1
  transmission-mode = "RTU"
  debug_connection = true
  configuration_type = "register"
  discrete_inputs = [
    { name = "start",          address = [0]},
    { name = "stop",           address = [1]},
    { name = "reset",          address = [2]},
    { name = "emergency_stop", address = [3]},
  ]

Logs from Telegraf

root@sentinel:/etc/telegraf# telegraf -test -config /etc/telegraf/telegraf.conf
2022-09-17T17:13:59Z I! Starting Telegraf 1.24.0
2022-09-17T17:13:59Z I! Available plugins: 222 inputs, 9 aggregators, 26 processors, 20 parsers, 57 outputs
2022-09-17T17:13:59Z I! Loaded inputs: cpu disk kernel mem modbus net netstat processes swap system
2022-09-17T17:13:59Z I! Loaded aggregators: 
2022-09-17T17:13:59Z I! Loaded processors: 
2022-09-17T17:13:59Z W! Outputs are not used in testing mode!
2022-09-17T17:13:59Z I! Tags enabled: host=sentinel
2022-09-17T17:13:59Z E! [telegraf] Error running agent: could not initialize input inputs.modbus: initializing client failed: invalid protocol 'file' - '' 
root@sentinel:/etc/telegraf#

System info

1.24.0

Docker

No response

Steps to reproduce

Run telegraf with the given config

Expected behavior

Default value for transmission_mode should be "RTU"

Actual behavior

Default value for transmission_mode appears to be empty.

Additional info

No response

Hipska avatar Sep 19 '22 15:09 Hipska

@srebhan do you know if you the README or the code should be updated in this case? It didn't seem like the code has changed recently.

sspaink avatar Sep 19 '22 18:09 sspaink

Another thing, shouldn't telegraf complain about non existing transmission-mode?

Hipska avatar Sep 19 '22 18:09 Hipska

@Hipska do you think discrete_input, holding_registers, input_registers, etc. need to also default to what is in the readme?

MyaLongmire avatar Oct 26 '22 15:10 MyaLongmire

I don't actually use Modbus, this was found because of interaction in the community Slack. You should ask @srebhan for this.

Hipska avatar Oct 26 '22 15:10 Hipska