The timing couldn’t been best, since we are releasing (today perhaps ? @joel ) a new python.d guide!
In relation to your question, I think the best route here is to configure 12 different
jobs in the configuration yaml of your collector.
So, your collector will collect data using that particular command from any network card, the network card being passed dynamically as a configuration variable. Thus, you will define 12 different jobs, each one passing a different network card.
What python.d does is to function as an orchestrator. So, for each collector, it will run as many jobs as they are defined in the configuration file, all in parallel.
Taking the example from the documentation:
# module defaults:
update_every : 2
priority : 20000
local: # job name
update_every : 5 # job update frequency
other_var1 : some_val # module specific variable
priority : 5 # job position on dashboard
other_var2 : val # module specific variable
In this configuration, we first define some defaults for the entire module. In case we define the same variable inside a job, the job’s variable will be used in place of the module-wide.
Now, all you have to do to access those variables is:
- When initializing the framework you used, define the configuration argument
configuration = configuration
- get the configuration variable:
self.network_switch = self.configuration.get('<variable_name>', <default_value>). The default value will be used in case the code does not find that configuration variable in your configuration yaml.
anomalies collector, created by @andrewm4894 as an example:
- Access configuration inside the code: netdata/anomalies.chart.py at c527863c5327123a43047bb61e7fdf5325177cbd · netdata/netdata · GitHub
- Configuration file: netdata/anomalies.conf at master · netdata/netdata · GitHub
Python.d is an orchestrator which runs different modules. Each module can run different instances of itself, which are called jobs. This is used when gathering data from different sources/with different methods but for the same application. You can dynamically define parts of your code using the configuration yaml file.
If you have any further question, I would be happy to answer!
EDIT: Welcome to our community!