Add Modbus Input Plugin#4623
Conversation
|
The final code will need a industrial controller on the network to poll it's data. Also this specific library needs to be loaded. "github.com/goburrow/modbus" |
|
Thanks @fdamador, you should be able to add the modbus library by running |
|
Ok, a bit confused, since I'm a windows person, but deb refers to golang dep....not debian deb command. Update - not sure what else you need me to do. Looks like gofmt here is ok with my modbus_test.go, which matches what I submitted. Also the dependencies work on my end. do you need to run dep ensure -add github.com/goburrow/modbus on your end? |
|
Correct, |
Signed-off-by: Administrator <franklin.amador@ausenco.com>
Signed-off-by: Administrator <franklin.amador@ausenco.com>
|
Hi Yesterday I tested the plugin with my modbus controller and I have some comments
conf file -> https://github.com/fdamador/telegraf/blob/master/plugins/inputs/modbus/README.md#configuration
modbus plugin execute write operations
|
|
Thank you for the comments.
|
If you generated the config file and open it, you can see the key [[inputs.modbus]] , but in the README the key is [[inputs.bond]]
My controller only allow 10 TCP connections , when I run the plugin , 2 minutes after my controller show me 10 connections 💀 💭 I can generate a dump file with wireshark to see the tcp conections, maybe this weekend.
but It is possible read different registers , I mean can I read for example , Input Contacts, Output Coils, Input Register at same time. |
Signed-off-by: franklin amador <fdamador@comcast.net>
|
@garciaolais - updated plugin to handle one connection at a time. Can you retest? @glinton - can you explain the test-go1.XXX errors I'm adding this to the master branch. Do I also need to add it to each revision? |
|
@fdamador update your branch with our master, then remove the |
Signed-off-by: franklin amador <fdamador@comcast.net>
glinton
left a comment
There was a problem hiding this comment.
Also pull and merge influx's master branch into yours.
| name = "github.com/go-sql-driver/mysql" | ||
| version = "1.4.0" | ||
|
|
||
| [[constraint]] |
There was a problem hiding this comment.
Don't forget to run dep ensure prior to committing the gopkg.lock changes
There was a problem hiding this comment.
Hmm. Not sure why when I run this on fdamador\telegraf, I get errors related to influxdata\telegraf references.
Subpackage github.com/influxdata/telegraf// is missing. (Package is required by (root).)
Hi @fdamador, at this moment I dont have a modbus controller 😢 , as soon I can get one , I will test it ⚙️ btw , I made my own modbus plugin 😄 https://github.com/garciaolais/telegraf/tree/input/modbus/plugins/inputs/modbus but I don't sended the PR because I have trouble with the testing part 😕 😖 ❓ ❓ You can check my implementation, maybe we can work and made a better version of the plugin 😃 Features
this is and example of a Home Energy Monitor 🏭 ⚡️ 👀 📈 using the plugin and Modbus controller |
|
@garciaolais - The best free slave simulators TCP/Serial are from PeakHMI Overall, I'm glad my initial open source code got you to code additional functionalities (bells/whistles) to get a better modbus plugin made. That's the beauty of Open Source. Yeah, let's work together to get the testing code done. Let me know how you want to proceed. |
|
@garciaolais, @fdamador did you join forces and is there any progress ? Do you need some help ? |
@gregorybrzeski at the moment I'm not working ⛔️ 🔧 in the plugin , I hope restart working in 2 Weeks 📅 I appreciate your help! btw. a few weeks ago 📆 I received emails 📫 from users that using the plugin
other user
|
|
|
@garciaolais - No I have not had time to join forces yet. However, I'm glad to retract this commit since I see you are pushing your Modbus Plugin. Very hard to make this system compile when working on a windows machine. Seems like their tools are all developed and based in Linux. I will think twice before starting another project unless I can compile it first. So many headaches!?! |
Yeah for sure this is true, let me know if I can help. Once #6154 PR is building on CircleCI I will add some links to the build. Even if you don't have time for to review the code maybe you can do some testing? |
|
Is there hope regarding the finishing of the plugin? I'm not a programmer but more an user and would be glad to read out Modbus TCP hardware with telegraf! |
@ttjaden you can follow the plugin development in this PR 6154 I'm waiting for review 👓 . If you need help with the actual plugin , I can help you |
|
@garciaolais : Is there a way to use the plugin without waiting on the official integration in telegraf? What would be the steps that I have to do without crashing my existing productive telegraf-setting? |
|
@ttjaden there is a simple way and it works great ! Have a look at instructions which @garciaolais provided here: |
@ttjaden you can use the steps shared by @gregorybrzeski but you will need to use the current development branch and if you any question we can help you |
|
@garciaolais : Hello, where do I have to write all the commands from these instructions #6154, to make the Modbus Plugin Work through TCP? Also, why do you need the WSL to make the plugin work with TCP? Thank you. |
|
Hello @D4V1D-G
These instructions #6154 (comment) are deprecated 😞 please check the README and note difference between my old instructions and the new readme For example in my old comment the configuration is in last version is
No, you can use many options(.exe, Debian package, go run, Docker) to run the plugin. if you have some question ❓ about how to run and config in your system, I can help you 👍 |
|
@garciaolais Thank you for your quick answer! I am using telegraf.exe to send the data to influxdb and using exactly the same script for the controller and the rest of the plugin: But I always get the errror: [inputs.modbus] Error in plugin: dial tcp 10.160.81.14:7116: i/o timeout Do you have an idea of what I am missing? |
Do you have a Modbus controller in your localhost? Can you share your config file? |
|
The modbus controller is connected via the TCP port (10.160.81.14:7116). |
|
I changed the ip addr in your config file and I tested with my controller Some controller does not allow two or more simultaneous connections , please check that you can see your controller from your PC or increment the timeout setting in your config file
|
|
@garciaolais |
|
@D4V1D-G |
|
status message ESTABLISHED is show when you run telegraf? or when you run another thing? What kind of modbus controller do you have? |
Indeed, it is a network data monitoring software tester, that is reading the traffic on the port.
I am currently working with an EPever EPsolar Tracer3215BN and I am converting the modbus RS485 to TCP with an USR-TCP232-304. Thank you. |
I can not find 🔍 any information about what modbus implementation, but I think the problem is that the converter use Modbus RTU over TCP and this protocol it is not support yet with the modbus plugin. 😞 I see another libs have problems too with that converter pymodbus-dev/pymodbus#382 |
The converter also offers to operate with a simulated COM port so we come back to a Modbus RTU protocole.
But the part in bold is a Linux configuration, if I am not mistaking. Is there a way to put the data from the simulated COM port on a windows platform on telegraf? Thank you. |
|
Does #7535 help? |
|
@danielnelson Unfortunately, Issue #7535 does not help, because program in modbus.go is expecting a "file" or a "tcp" in the controller name, and this error message comes up in the command prompt when trying #7535 :
@garciaolais Here in this WSL Comment, are you using Linux because your telegraf, influxDB and grafana is on Linux? Thanks. |
|
@D4V1D-G Looks like we will need to make some code changes in order to test this. Can you open a new issue for Windows COM syntax and the modbus plugin? -- edit -- I'll just turn 7535 into the issue to track this. |
@D4V1D-G Actually I have telegraf+influxdb+grafana running Docker Desktop (Win 10) and I manage docker trough WSL Linux |





Required for all PRs:
This is a new input plugin that will poll industrial controllers supporting TCP/RTU Modbus client connections. Data will be logged by register number polled.