[Pkg-puppet-devel] [SCM] Puppet packaging for Debian branch, master, updated. debian/0.24.6-1-356-g5718585

John Ferlito johnf at inodes.org
Fri Jan 23 14:21:57 UTC 2009


The following commit has been merged in the master branch:
commit a0a6d2cfa88cac5418097fb9f71df4cbcae4b192
Author: John Ferlito <johnf at inodes.org>
Date:   Tue Dec 9 11:46:21 2008 +1100

    Add a unique name to objects so we can determine uniqueness when read back in
    
        The nagios object definitions have been updated to correlate with Nagios
        3.0.6.
    
            In Nagios it is possible to have multiple service checks with the
        same service_description. eg I could have an check with a
        service_description of 'SSH' for multiple hosts. So in puppet we can't
        use it as a unique name for the resource. This patch modifies the code
        to use $name as the unique name. For some types eg command_name $name
        ends up in the config and thus we can tell which puppet resources match
        to which nagios ones.  For other types like service there is no direct
        mapping from $name to a nagios attibute. So we use a custom attribute
        called _naginator_name.
    
    Signed-off-by: John Ferlito <johnf at inodes.org>

diff --git a/CHANGELOG b/CHANGELOG
index d75b5bf..cdff75c 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -1,4 +1,8 @@
 0.24.x
+    Fixed #1496 - nagios_servicedependency needs a unique host_name?
+
+    Fixed #1420 - nagios_serviceescalation not allowing host_name more than one type
+
     Fixed #1695 - Solaris 10 zone provider doesn't properly handle unknown zone attributes in newer releases
 
     Fixed #1776 - Trivial fix for gentoo service provider
diff --git a/lib/puppet/external/nagios/base.rb b/lib/puppet/external/nagios/base.rb
index 25c6895..9b9d7ca 100755
--- a/lib/puppet/external/nagios/base.rb
+++ b/lib/puppet/external/nagios/base.rb
@@ -196,6 +196,9 @@ class Nagios::Base
         args.each { |param,value|
             self[param] = value
         }
+        if @namevar == :_naginator_name
+          self['_naginator_name'] = self['name']
+        end
     end
 
     # Handle parameters like attributes.
@@ -321,115 +324,154 @@ class Nagios::Base
     end
 
     # object types
-    newtype :command do
-        setparameters :command_name, :command_line
+    newtype :host do
+        setparameters :host_name, :alias, :display_name, :address, :parents,
+            :hostgroups, :check_command, :initial_state, :max_check_attempts,
+            :check_interval, :retry_interval, :active_checks_enabled,
+            :passive_checks_enabled, :check_period, :obsess_over_host,
+            :check_freshness, :freshness_threshold, :event_handler,
+            :event_handler_enabled, :low_flap_threshold, :high_flap_threshold,
+            :flap_detection_enabled, :flap_detection_options,
+            :failure_prediction_enabled, :process_perf_data,
+            :retain_status_information, :retain_nonstatus_information, :contacts,
+            :contact_groups, :notification_interval, :first_notification_delay,
+            :notification_period, :notification_options, :notifications_enabled,
+            :stalking_options, :notes, :notes_url, :action_url, :icon_image,
+            :icon_image_alt, :vrml_image, :statusmap_image, "2d_coords".intern,
+            "3d_coords".intern,
+            :register, :use
+
+        setsuperior "person"
+        map :address => "ipHostNumber"
     end
 
-    newtype :contact do
-        setparameters :contact_name, :alias, :host_notification_period,
-            :host_notification_commands, :service_notification_period,
-            :service_notification_commands, :register, :email, :pager, 
-            :service_notification_options, :host_notification_options
+    newtype :hostgroup do
+      setparameters :hostgroup_name, :alias, :members, :hostgroup_members, :notes,
+          :notes_url, :action_url,
+          :register, :use
+    end
 
-        setsuperior "person"
+    newtype :service do
+        attach :host => :host_name
+        setparameters :host_name, :hostgroup_name, :service_description,
+            :display_name, :servicegroups, :is_volatile, :check_command,
+            :initial_state, :max_check_attempts, :check_interval, :retry_interval,
+            :normal_check_interval, :retry_check_interval, :active_checks_enabled,
+            :passive_checks_enabled, :parallelize_check, :check_period,
+            :obsess_over_service, :check_freshness, :freshness_threshold,
+            :event_handler, :event_handler_enabled, :low_flap_threshold,
+            :high_flap_threshold, :flap_detection_enabled,:flap_detection_options,
+            :process_perf_data, :failure_prediction_enabled, :retain_status_information,
+            :retain_nonstatus_information, :notification_interval,
+            :first_notification_delay, :notification_period, :notification_options,
+            :notifications_enabled, :contacts, :contact_groups, :stalking_options,
+            :notes, :notes_url, :action_url, :icon_image, :icon_image_alt,
+            :register, :use,
+            :_naginator_name
+
+        suppress :host_name
+
+        setnamevar :_naginator_name
     end
 
-    newtype :contactgroup do
-        setparameters :contactgroup_name, :alias, :members
+    newtype :servicegroup do
+        setparameters :servicegroup_name, :alias, :members, :servicegroup_members,
+            :notes, :notes_url, :action_url,
+            :register, :use
     end
 
-    newtype :host do
-        setparameters :host_name, :notifications_enabled, :event_handler_enabled,
-            :flap_detection_enabled, :process_perf_data, :retain_status_information,
-            :retain_nonstatus_information, :register, :use, :alias,
-            :address, :check_command, :max_check_attempts, :notification_interval,
-            :notification_period, :notification_options, :checks_enabled,
-            :failure_prediction_enabled, :parents, :contact_groups
+    newtype :contact do
+        setparameters :contact_name, :alias, :contactgroups,
+            :host_notifications_enabled, :service_notifications_enabled,
+            :host_notification_period, :service_notification_period,
+            :host_notification_options, :service_notification_options,
+            :host_notification_commands, :service_notification_commands,
+            :email, :pager, :address1, :address2, :address3, :address4,
+            :address5, :address6, :can_submit_commands, :retain_status_information,
+            :retain_nonstatus_information,
+            :register, :use
 
         setsuperior "person"
-        map :address => "ipHostNumber"
     end
 
-    newtype :hostextinfo do
-        auxiliary = true
-        setparameters :host_name, :notes_url, :icon_image, :icon_image_alt, :vrml_image,
-            "2d_coords".intern, "3d_coords".intern
-
-        setnamevar :host_name
+    newtype :contactgroup do
+        setparameters :contactgroup_name, :alias, :members, :contactgroup_members,
+            :register, :use
     end
 
-    newtype :hostgroup do
-        setparameters :hostgroup_name, :alias, :contact_groups, :members
+    # TODO - We should support generic time periods here eg "day 1 - 15"
+    newtype :timeperiod do
+        setparameters :timeperiod_name, :alias, :sunday, :monday, :tuesday,
+            :wednesday, :thursday, :friday, :saturday, :exclude,
+            :register, :use
     end
 
-    newtype :hostescalation do
-        setparameters :name, :first_notification, :last_notification,
-            :notification_interval, :contact_groups,
-            :escalation_options, :register, :hostgroup_name
-        setnamevar :name
-    end              
+    newtype :command do
+        setparameters :command_name, :command_line
+    end
 
-    newtype :hostgroupescalation do
+    newtype :servicedependency do
         auxiliary = true
-        setparameters :hostgroup_name, :first_notification, :last_notification,
-            :contact_groups, :notification_interval
+        setparameters :dependent_host_name, :dependent_hostgroup_name,
+            :dependent_service_description, :host_name, :hostgroup_name,
+            :service_description, :inherits_parent, :execution_failure_criteria,
+            :notification_failure_criteria, :dependency_period,
+            :register, :use,
+            :_naginator_name
 
-        setnamevar :hostgroup_name
+        setnamevar :_naginator_name
     end
 
-    newtype :service do
-        attach :host => :host_name
-        setparameters :name, :active_checks_enabled, :passive_checks_enabled,
-            :parallelize_check, :obsess_over_service, :check_freshness,
-            :notifications_enabled, :event_handler_enabled,
-            :flap_detection_enabled, :process_perf_data,
-            :retain_status_information, :retain_nonstatus_information, :register,
-            :is_volatile, :check_period, :max_check_attempts,
-            :normal_check_interval, :retry_check_interval, :contact_groups,
-            :notification_interval, :notification_period, :notification_options,
-            :service_description, :host_name, :freshness_threshold,
-            :check_command, :hostgroup_name, :event_handler, :servicegroups, :host
-
-        suppress :host_name
+    newtype :serviceescalation do
+        setparameters :host_name, :hostgroup_name, :service_description, :contacts,
+            :contact_groups, :first_notification, :last_notification,
+            :notification_interval, :escalation_period, :escalation_options,
+            :register, :use,
+            :_naginator_name
 
-        setnamevar :service_description
+        setnamevar :_naginator_name
     end
 
-    newtype :servicedependency do
-        auxiliary = true
-        setparameters :host_name, :service_description, :dependent_host_name,
-            :dependent_service_description, :execution_failure_criteria,
-            :notification_failure_criteria, :hostgroup_name, 
-            :dependent_hostgroup_name
+    newtype :hostdependency do
+      auxiliary = true
+      setparameters :dependent_host_name, :dependent_hostgroup_name, :host_name,
+          :hostgroup_name, :inherits_parent, :execution_failure_criteria,
+          :notification_failure_criteria, :dependency_period,
+          :register, :use
 
-        setnamevar :host_name
+      setnamevar :_naginator_name
     end
 
-    newtype :serviceescalation do
-        setparameters :host_name, :service_description, :first_notification,
-            :last_notification, :contact_groups, :notification_interval, :hostgroup_name
+    newtype :hostescalation do
+        setparameters :host_name, :hostgroup_name, :contacts, :contact_groups,
+            :first_notification, :last_notification, :notification_interval,
+            :escalation_period, :escalation_options,
+            :register, :use,
+            :_naginator_name
 
-        setnamevar :host_name
+        setnamevar :_naginator_name
     end
 
-    newtype :servicegroup do
-        setparameters :servicegroup_name, :alias
+    newtype :hostextinfo do
+        auxiliary = true
+        setparameters :host_name, :notes, :notes_url, :icon_image, :icon_image_alt,
+            :vrml_image, :statusmap_image, "2d_coords".intern, "3d_coords".intern,
+            :register, :use
 
-        setnamevar :servicegroup_name
+        setnamevar :host_name
     end
 
     newtype :serviceextinfo do
         auxiliary = true
 
-        setparameters :host_name, :service_description, :icon_image, :icon_image_alt
+        setparameters :host_name, :service_description, :notes, :notes_url,
+            :action_url, :icon_image, :icon_image_alt,
+            :register, :use,
+            :_naginator_name
 
-        setnamevar :host_name
+        setnamevar :_naginator_name
     end
 
-    newtype :timeperiod do
-        setparameters :timeperiod_name, :alias, :sunday, :monday, :tuesday,
-            :wednesday, :thursday, :friday, :saturday
-    end
 end
 
 # $Id$
diff --git a/lib/puppet/type/nagios_hostgroupescalation.rb b/lib/puppet/type/nagios_hostgroupescalation.rb
deleted file mode 100644
index 21b39f6..0000000
--- a/lib/puppet/type/nagios_hostgroupescalation.rb
+++ /dev/null
@@ -1,3 +0,0 @@
-require 'puppet/util/nagios_maker'
-
-Puppet::Util::NagiosMaker.create_nagios_type :hostgroupescalation

-- 
Puppet packaging for Debian



More information about the Pkg-puppet-devel mailing list