简体   繁体   中英

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?

I tried with Puppet Storeconfigs : The client node exports the nagios_hostgroup resource:

@@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. 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. For us, it takes up to 30 mins. 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. 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. In 3.4.0 and newer, servicedependencies also are allowed in those bindings.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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