[Input.Modbus] not start after reboot & Error in plugin

Hi,
I am using telegraf 1.18 and Influxfdb 1.8.5. in Raspberry pi 3 B+.

Config below Input modbus Serial controller
[[inputs.modbus]]
name = “Meter1”
slave_id = 1
timeout = “2s”
busy_retries = 10
busy_retries_wait = “200ms”

### Serial (RS485; RS232)
  controller = "file:///dev/ttyUSB0"
  baud_rate = 9600
  data_bits = 8
  parity = "N"
  stop_bits = 1
  transmission_mode = "RTU"


$ sudo systemctl status telegraf
 telegraf[446]: 2021-05-19T06:20:30Z E! [inputs.modbus] Error in plugin

$ sudo telegraf --test
Started and Showed Measurement value without error

If I Start with $ sudo telegraf

telegraf Stared , loaded Input.Modbus and data collection working perfectly.

After reboot the data collection not started automatically. I also tried serial port permission permanent process. Can’t find the solutions for auto start . when I entered manually $sudo telegraf then it will started collection.

How to enable auto collection for Input.Modbus.

Any one face this issue.

I think you should check the permission for the telegraf user to access the tty interface, which is most probably what is preventing telegraf to run: you overcome this limit when you run with sudo, as you have full rights.

Hi… Thanks…

I already provided permission for system user ttyUSB0 and it also work well $ telegraf (without sudo) The main problem is the system reboot after the Input.Modbus collection not started.
Anyway, How to provide permission for telegraf user.

Try from here usb - How do I allow a non-default user to use serial device ttyUSB0? - Ask Ubuntu

i tried this process both https://www.programmersought.com/article/990156421/… not solved issue.

sudo adduser pi dialout
The user `pi' is already a member of `dialout'

The telegraf user is not “pi” but “telegraf”, if you didn’t change it on purpose.
Run this and check which is the user
cat /lib/systemd/system/telegraf.service | grep "User"

1 Like

Thank you so much !!!

Added Telegraf user to dialout
$ cat /lib/systemd/system/telegraf.service | grep “User”
User=telegraf
$ sudo adduser telegraf dialout
Adding user telegraf' to group dialout’ …
Adding user telegraf to group dialout
Done.

After reboot the Modbus Collection started automatically.

Have a nice day…

2 Likes