NagiosEnterprises / ncpa

Nagios Cross-Platform Agent
Other
177 stars 95 forks source link

multiple plugin_path #811

Open BorisTrnka opened 3 years ago

BorisTrnka commented 3 years ago

Hello,

Is there a way to define multiple plugins directories? E.g. I'd like to separate plugins scripts based on theirs scope into separate directories. Now I can define one-and-only "plugin_path" ( default = "plugins/").

Is it possible define more? E.g.

plugin_path = plugins/
plugin_path = DBplugins/
plugin_path = APPplugins/

If not, can this be implemented?

Thanks

ericloyd commented 3 years ago

We had previously asked for the plugins directory to be searched recursively. I can't remember what the status was, but that would be one way to separate your plugins, by subdirectory.

BorisTrnka commented 2 years ago

Hi, thanks for the hint. Tested and yes, it seems to be implemented (interesting how it process scripts in sub-folders and scripts with same names). We will validate if usable for our purpose, but still I would say having an option to define multiple path would be usable and appreciated feature also for other users.

Thanks for considering its implementation, could you? Please. ;)

ccztux commented 2 years ago

I like the idea to define multiple plugin paths. So it would be possible to additionally define the standard nagios plugin path /usr/local/nagios/libexec without working with symlinks.

BorisTrnka commented 2 years ago

Hi, just short update - the subdirs works fine. Still it would be great to be able to define and use multiple directories which are not sub-dirs (as mentioned by ccztux).

ericloyd commented 2 years ago

I still think that multiple plugin paths is not necessary. If you want /usr/local/nagios/libexec to be your plugin path, then you can specify that in the NCPA config file. Or you can do what we do and write a wrapper plugin that verifies some information first, and then calls /usr/local/nagios/libexec/ passing the parameters from NCPA to it. This wrapper then goes in the NCPA plugin directory. This way, we can create NCPA-versions of, for example, check_http that don't interfere with the /usr/local/nagios/libexec/check_http plugin even though they are the same name.

There are a lot of things you can do with the subdirs as well. And since NCPA is designed to run on non-Unix based systems, you need to consider the effort to provide the same functionality on multiple platforms simultaneously like Windows and MacOS. So I think the development effort that would go into multiple directories could be better spent on fixing bugs like #869 and #868 (especially those two, right now).