Regular expressions in configuration files


#1

Good afternoon all,

As this vexed me somewhat I thought I would share:

I have set up my hosts to use templates for their base configuration. On top of the host_group membership defined in the template I wish to add extra host_groups. The object definition tricks mention the + operator which, upon further investigation, can be used to add rather than replace hostgroups. So the following host definition will inherit the hostgroup membership defined in template “domain_controller” and add hostgroups windows_D, windows_E (which incidentaly have hard drive checks associated with them):

define host {
                  use                   domain_controller
                  hostgroups        +windows_D,windows_E
                  host_name        219dc01
                  address             192.168.156.1
                  }

Where as the following would replace all hostgroup mambership leaving just windows_D and windows_E as member hosgroups.

define host {
                  use                   domain_controller
                  hostgroups        windows_D,windows_E
                  host_name        219dc01
                  address             192.168.156.1
                  }

Doing the config files this way is saving me quite a bit of time.

Hope one day this helps someone.

Mat.