Icinga / icingaweb2-module-director

The Director aims to be your new favourite Icinga config deployment tool. Director is designed for those who want to automate their configuration deployment and those who want to grant their “point & click” users easy access to the configuration.
https://icinga.com/docs/director/latest
GNU General Public License v2.0
413 stars 203 forks source link

Allow passing "env.ICINGAWEB_CONFIGDIR" as command attribute in director commands #1824

Open ValeDaRold opened 5 years ago

ValeDaRold commented 5 years ago

Expected Behavior

In commands, there should be the possibility to specify a custom env.ICINGAWEB_CONFIGDIR if not equal to the default one. It would be great to have an attribute for the command for specifying it.

Current Behavior

For now, if you need to launch for example an icingacli command and your system runs with a custom env.ICINGAWEB_CONFIGDIR, you have to duplicate the command and insert the custom variable.

Our use-case

For example we defined some custom commands with the following template:

object CheckCommand "icingacli-businessprocess-custom" {
        import "icingacli-businessprocess"
        env.ICINGAWEB_CONFIGDIR = "/custom_dir/shared/icingaweb2/conf/"
}

We would like simply to launch the default "icingacli" command with a specific parameter

icingacli-businessprocess --config_dir "/custom_dir/shared/icingaweb2/conf/"
lazyfrosch commented 5 years ago

We don't have plans to configure environment values via Director.

The easiest way is to add such variables to Icinga's local environment.

systemctl show icinga2.service | grep EnvironmentFile

Add your environment to either /etc/sysconfig/icinga2 or /etc/default/icinga2. This is also often useful for libraries and other checks.