-
Notifications
You must be signed in to change notification settings - Fork 5.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
modbus: improved config format #7941
Conversation
* each measurement gets a separate section in config * different measurements can have the same name * each measurement can have custom tags
Hey @h-schwanbeck, thanks very much for caring about this overdue topic! While I like the idea of a more clean config I have some comments:
Regarding 2: I think one option is to have the slave as subsections and allow to specify the measurements as a subsection of this subsection. Do you think this would be possible? Or can you come up with a better structure? |
] | ||
[[inputs.modbus.measurement]] | ||
name = "power" | ||
tags = [ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi Henry, I like being able to specify tags here, but saying key = foo, value = bar feels wrong. The existing way to add tags to a plugin lets you say foo = bar. see https://github.com/influxdata/telegraf/blob/master/docs/CONFIGURATION.md#input-plugins I don't think we should add a second tag settings format.
There's not currently a way to have a plugin get arbitrary settings from toml, like we would need in order to get tags in the foo = bar format. The existing plugin level tags table is handled as a special case that accesses the toml ast.
Line 1231 in d369003
cp.Tags = make(map[string]string) |
I'm working on a PR on the OPC UA input (#8389) that groups variables in a similar way to this PR. I'd like to add tags to a group just like you're doing here. I suspect other similar inputs will need this in the future too. I think the tag config syntax should be the same across plugins and I'd like it to be in foo = bar format.
Lets work together to add a way to get tags in foo = bar format for both PRs.
Hello @srebhan,
Right, stability matters. I'll have a look at the code to see if I can come up with an elegant solution.
Not sure if I understand you correctly. I query two PLCs by including multiple [[inputs.modbus]] sections in my telegraf config. My assumption was that the telegraf core would take care of managing concurrency.
I guess you mean 'tagexclude' and no, there's no advantage, quite the opposite. I have not thought about that when I added the patch. Thanks for the hint, saves a few lines of code. |
* Use 'tagexclude = ["type", ..] instead
Sure telegraf can handle this. However, there are gateway devices which themselves handles slaves e.g. on a serial bus and provide access to those slaves with different slave IDs. I have a SOCOMEC D70 for example having one IP but you can query a dozen of slaves through this one IP. Working with multiple Maybe you can take a look at PR #8013 to see if we can come up with an overarching config scheme!? |
Is there any further update regarding this! |
I agree. It's on my list once #9279 is merged. |
@h-schwanbeck the modbus plugin now has the possibility to specify different configuration formats (see #9279 for an example). Do you want to rebase your PR on that new possibility? |
Hello! I am closing this issue due to inactivity. I hope you were able to resolve your problem, if not please try posting this question in our Community Slack or Community Page. Thank you! |
Dear influxdata team,
I prepared a few patches for the MODBUS input plugin.
Besides some smaller ones to suppress unwanted tags, there is also a breaking change to the config format.
The idea behind this update is that MODBUS devices, like PLCs, often control multiple pieces of equipment one wants to monitor and the semantics of the configuration file should reflect this.
I also think that this is more consistent with the config of other telegraf plugins than the current format.
The introduction of custom tags per measurement enables the user to use more of the potential of InfluxDB.
As an example, let's monitor two identical generators connected to the same PLC.
Current format:
Output:
Proposed format:
Output:
I am looking forward to your feedback and hope you consider merging.
Best regards,
Henry Schwanbeck
Required for all PRs: