Nagios hostgroup_name排除项中的通配符

我很难在Nagios中find通配符和正则expression式的良好文档(特别是在排除条件下)。 这是我正在尝试做的一个例子:

nagios.cfg ,设置了以下内容,据说可以启用*? 作为通配符:

 use_regexp_matching=1 use_true_regexp_matching=0 

services.cfg ,我们有一个服务,我们想要适用于除了一些对象之外的所有对象; 那就是所有的Linux主机,而不是负载均衡器。 显式排除工作:

 define service { use generic-service service_description Puppet check hostgroup_name prod, staging, !prod-site_a-lbs check_command check_puppet_alive_nrpe } 

但是,我们有许多站点,每个站点都有自己的主机组中的负载均衡器(因此可以通过站点轻松pipe理通知)。 而不是有一个很长的列表!prod-site_a-lbs!staging-site_a-lbs!prod-site_b-lbs 。 我希望能够将hostgroup_name行修改为:

  hostgroup_name prod, staging, !*-lbs 

我已经尝试过了,尽pipe我们没有收到任何错误,但是此服务检查仍在应用于我们的负载平衡器。 为了仔细检查,我也尝试过:

  hostgroup_name prod, staging, !.*-lbs 

但是,如预期的那样(因为没有设置use_true_regexp_matching ),这会失败,在运行checkconfig-noprecache

  Error: Could not find any hostgroup matching '!.*lbs' ... 

在testing中, .*checkconfig-noprecache接受,如果! 已移除。

我们正在尝试可能吗? 我们可以使用通配符来排除匹配的主机组吗? 或者,有没有其他的select会一样干净?


更新 (2015-09-21):testingKeith的答案后,此configuration正在工作:

services.cfg

 define service { use generic-service service_description Puppet check hostgroup_name prod, staging, !lbs check_command check_puppet_alive_nrpe } 

hostgroups.cfg ,我使用'members'指令中的正则expression式定义了一个新的主机组:

 define hostgroup { hostgroup_name lbs alias Load Balancers members ^lb.* } 

我相信你可以做到这一点的唯一方法是通过使有问题的主机组成一个新的主机组(使用通配符),然后排除这个新的主机组。