opscode-cookbooks/nagios — pull request #210 by josephholsten (2013-10-19 05:02:32+00:00)
Title: Add host templates

Add nagios.host_template attribute

At present, all hosts must share the same attributes from the server and default-host templates (`notifications_enabled`, `event_handler_enabled`, `flap_detection_enabled`, `failure_prediction_enabled`, `process_perf_data`, `retain_status_information`, `retain_nonstatus_information` & `notification_period` are hard-coded, `check_period`, `check_interval`, `retry_interval`, `max_check_attempts`, `check_command`, `notification_interval`, `notification_options` & `contact_groups` are configurable). That is, different sets of machines are not able to have different behaviour for their host-alive check.

In order to have different hosts support different behaviour than the default template, this patch adds a node attribute to specify the desired host template object, per http://nagios.sourceforge.net/docs/3_0/objectinheritance.html

Add host templates from data bags

Modeled on the service templates, this creates host templates which default to using the default-host template, and allow configuring the following atributes: check_interval, retry_interval, notification_interval, action_url, check_freshness, check_period, contact_groups, check_command, event_handler_enabled, flap_detection_enabled, max_check_attempts, notes_url, notification_options, notification_period, notifications_enabled, obsess_over_host, passive_checks_enabled, process_perf_data, retain_nonstatus_information & retain_status_information.

The official nagios documentation allows for some other values for the host object: parents, hostgroups, initial_state, active_checks_enabled, freshness_threshold, event_handler, low_flap_threshold, high_flap_thresholdflap_detection_options, contacts, first_notification_delay, stalking_options, note, icon_image, icon_image_alt, vrml_image, statusmap_image, 2d_coords & 3d_coords. These are left unconfigurable because they neither are related to configurable options for service templates, nor configurable for the default host template.These are probably unnecessary for a template, but may be added later for completeness.