How to change/modify a plugin?

Hey there

I am using telegraf to collect some information over modbus TCP.
The problem now is I need to do some changes on the modbus plugin and I dont know where I can find the client.go file.
My problems are the same issues like these at the topic below and I need to change the safety check “if count != length” in the client.go file, which is part of the telegraf modbus plugin.

I do not find the file on my server, can anybody help me here?
I installed telegraf on ubuntu (Install Telegraf | Telegraf 1.21 Documentation)

Telegraf is a compiled executable binary. The go source files can be found in the GitHub repository…

@cbring, did you read the issue you linked? The problem is in the library we use (as described in the issue) and a bug was filed against this library (RTU over TCP error: response data size '5' does not match count '4' · Issue #52 · grid-x/modbus · GitHub).
There is nothing we can do from the Telegraf side to fix this, all we can do is to wait for the project to fix the issue. So if you want to help, you can open a pull-request on grid-x/modbus with a fix (see my comment for ideas)…

Yeah I know, I am not so experienced in this. My idea was to download this binary local on my server and modify these lines. But I guess this is not possible is it?

No that’s not possible. At least not easily… Binary patching is like black magic and you should not get into this. What you can do though is to fix that bug in source-code and recompile. Even better, once you fixed the code upstream, we could easily bump the version in telegraf and you get a nightly build with that change in…