So another day, another software design problem. This problem is regarding https://github.com/schoentoon/mtop
. In case you don't know what it is going to be. Basically (h)top, but modular. Modular as in you can write your own modules to display your data and modular as in you can write your own client for it. Of course I want to ship it with a set of standard modules to monitor things like cpu, ram, etc. Now this problem is mainly caused by things like the cpu module. A module can only monitor 1 thing and therefore return 1 value. But multi core cpus are very common these days. The quick and dirty way to solve this would be to copy the module so you would end up with cpu0.so cpu1.so cpu2.so, etc. But of course that's the dirty way, which I don't want. Now I already have a small form of config capabilities for modules, not fully implemented yet but there's room for it. So another option here would be to do something like "load_module = cpu.so
cpu=0" in a configuration file. Which is something I don't really want either. I basically need some way for the module to tell, load me again with these settings. But of course for this cpu module dynamically. This of course isn't limited to just that cpu module, it would also apply to a module to monitor free disk space (multiple mount points).
Now what I'm basically asking is, what would be a proper way to basically do this? Thanks.