简体   繁体   English

使用Puppet清单自动创建Nagios主机组

[英]automatic creation of Nagios hostgroup using Puppet manifest

Is there any way to create the Nagios hostgroup only when the first (or at least one) member of that hostgroup comes on line? 仅当该hostgroup的第一个(或至少一个)成员上线时,才可以创建Nagios hostgroup吗?

I tried with Puppet Storeconfigs : The client node exports the nagios_hostgroup resource: 我尝试使用Puppet Storeconfigs :客户端节点导出nagios_hostgroup资源:

@@nagios_hostgroup { 'cloud-app':
    alias => "Application Servers",
} 

and the server node collects it: 服务器节点收集它:

Nagios_hostgroup <<| |>> { notify => Service['nagios'] }

It works for the first node but get "duplicate definition" error as soon as the second node of that hostgroup comes online and try to export the very same resource. 它适用于第一个节点,但是一旦该主机组的第二个节点联机并尝试导出完全相同的资源,就会出现“重复定义”错误。

Specifying hostgroup in the Nagios server manifest (and exporting the nagios_host instead) initially solve this issue but the biggest problem with this approach is: in a multi hostgroup configuration, Nagios won't start until atleast one member from the each hostgroup comes on-line. 指定hostgroup中的Nagios服务器清单(和出口nagios_host代替)初步解决了这个问题,但这种方法最大的问题是:在多主机组的配置,Nagios将不会启动,直到从ATLEAST一个成员的每个主机组来上线。 This leaves us with a huge inconvenience. 这给我们带来了极大的不便。 As all the hostgroups are created during the Nagios server configuration, Nagios refuses to start until the first member of the last hostgroup is configured. 由于所有主机组都是在Nagios服务器配置期间创建的,因此Nagios拒绝启动,直到配置了最后一个主机组的第一个成员。 For us, it takes up to 30 mins. 对于我们来说,最多需要30分钟。 Is there any workaround/fix for this issue? 有没有解决此问题的方法/解决方案? Any pointer would be greatly appreciated. 任何指针将不胜感激。 Cheers!! 干杯!!

It's simpler than that: you can simply ask Nagios not to complain about hostgroups without members. 比这简单得多:您可以简单地要求Nagios不要抱怨没有成员的主机组。 As discussed in this thread , as of Nagios 3.3.1 you can use the allow_empty_hostgroups_assignment=1 directive in your main config to get Nagios to start. 本线程中所述 ,从Nagios 3.3.1开始,您可以在主配置中使用allow_empty_hostgroups_assignment = 1指令来启动Nagios。 In 3.4.0 and newer, servicedependencies also are allowed in those bindings. 在3.4.0及更高版本中,这些绑定中还允许服务依赖项。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM