Empty hostgroups and service definitions


I am creating a Nagios configuration set that will be used in multiple places. The issue is we have multiple environments running the same software. So my plan was to have a single set of configs, all sharing the same service definitions that I apply to hostgroups. Then each environemnt only need a custom contact and host configs with the hosts being applied to hostgroups. Works well, until our new env was created with some hostgroups empty. This is intentional but now Nagios complains:

Error: Could not expand hostgroups and/or hosts specified in service

I understand that the hostgroup is empty, what I would expect is that the service would not show up, just as if I had left off the host/hostgroup specification. Anyway to have Nagios ignore empty hostgroups and services using them?


Just coment out (in .cfg files) those unused hostgroups and services applied to hosts which don’t exist. I don’t know of any other solution to make Nagios ignore configured but unused hosts/services.