-
Notifications
You must be signed in to change notification settings - Fork 45
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
Added ability to specify a directory of config files #64
Conversation
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.
This is not the way to handle this. Take a look how the multiple files/glob handling was done in the snmp_exporter.
Thanks for the correction. I'll work on implementing this method instead. I wasn't aware this existed with the snmp exporter but I can see the rationale. |
d07bc55
to
6a7b0b7
Compare
How is this? It was quite simple to implement and functions very similarly to snmp_exporter. I'm not sure if the change warrants an additional test case. |
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.
Nice, thanks!
@omnistat could you please update the readme.md that has a conflict, so i can merge this pr ;) |
@bastischubert Done :) |
After using this plugin for a little while, it started to become burdensome to navigate one huge configuration file for every metric of multiple modbus devices. I read through some issues and saw others mention this as well.
I decided to add basic functionality to specify either a single configuration file or a directory of configuration files in the format of modbus.yml. This will load all configurations as if they were in one file, but allows users to seperate them out for readability.
The folder name must end with
.d
to distinguish between a file or folder. For code simplicity, all files within the directory will attempt to be loaded, including non-yaml files, and error accordingly.Example:
Reflecting this change, the
--config.file
parameter has been changed to--config
to be more general.