Signed-off-by: John Ferlito <jo...@inodes.org>
---
CHANGELOG | 4 +++
lib/puppet/external/nagios/base.rb | 41 +++++++++++++++++++++---------------
2 files changed, 28 insertions(+), 17 deletions(-)
diff --git a/CHANGELOG b/CHANGELOG
index 4cf39b4..6e73d7a 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 #1711 - fileserver test fails due to incorrect mocking
Fixed #1751 - Mac OS X DirectoryService nameservice provider support for
diff --git a/lib/puppet/external/nagios/base.rb b/lib/puppet/external/nagios/base.rb
index 25c6895..bc3f9e1 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 == :_puppet_name
+ self['_puppet_name'] = self['name']
+ end
end
# Handle parameters like attributes.
@@ -363,23 +366,26 @@ class Nagios::Base
end
newtype :hostescalation do
- setparameters :name, :first_notification, :last_notification,
+ setparameters :first_notification, :last_notification,
:notification_interval, :contact_groups,
- :escalation_options, :register, :hostgroup_name
- setnamevar :name
+ :escalation_options, :register, :hostgroup_name,
+ :_puppet_name
+
+ setnamevar :_puppet_name
end
newtype :hostgroupescalation do
auxiliary = true
- setparameters :hostgroup_name, :first_notification, :last_notification,
- :contact_groups, :notification_interval
+ setparameters :first_notification, :last_notification,
+ :contact_groups, :notification_interval,
+ :_puppet_name
- setnamevar :hostgroup_name
+ setnamevar :_puppet_name
end
newtype :service do
attach :host => :host_name
- setparameters :name, :active_checks_enabled, :passive_checks_enabled,
+ setparameters :active_checks_enabled, :passive_checks_enabled,
:parallelize_check, :obsess_over_service, :check_freshness,
:notifications_enabled, :event_handler_enabled,
:flap_detection_enabled, :process_perf_data,
@@ -388,11 +394,12 @@ class Nagios::Base
: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
+ :check_command, :hostgroup_name, :event_handler, :servicegroups, :host,
+ :_puppet_name
suppress :host_name
- setnamevar :service_description
+ setnamevar :_puppet_name
end
newtype :servicedependency do
@@ -400,30 +407,30 @@ class Nagios::Base
setparameters :host_name, :service_description, :dependent_host_name,
:dependent_service_description, :execution_failure_criteria,
:notification_failure_criteria, :hostgroup_name,
- :dependent_hostgroup_name
+ :dependent_hostgroup_name, :_puppet_name
- setnamevar :host_name
+ setnamevar :_puppet_name
end
newtype :serviceescalation do
setparameters :host_name, :service_description, :first_notification,
- :last_notification, :contact_groups, :notification_interval, :hostgroup_name
+ :last_notification, :contact_groups, :notification_interval, :hostgroup_name,
+ :_puppet_name
- setnamevar :host_name
+ setnamevar :_puppet_name
end
newtype :servicegroup do
setparameters :servicegroup_name, :alias
-
- setnamevar :servicegroup_name
end
newtype :serviceextinfo do
auxiliary = true
- setparameters :host_name, :service_description, :icon_image, :icon_image_alt
+ setparameters :host_name, :service_description, :icon_image, :icon_image_alt,
+ :_puppet_name
- setnamevar :host_name
+ setnamevar :_puppet_name
end
newtype :timeperiod do
--
1.5.6.3
> So we use a custom attribute called _puppet_name.
+1
Thanks John, this patch is really helpful.
François
On Tue, Nov 25, 2008 at 11:37:34PM -0600, Luke Kanies wrote:
>
> This is essentially a patch against Naginator[1]; can you provide it
> against that code, and I'll apply and then copy over to Puppet?
Which git repository should I use? I tried
git://git.reductivelabs.com/naginator.git
but it looks like it's missing patches that are in the puppet tree.
Cheers,
John
--
John
Blog http://www.inodes.org/blog
OLPC Friends http//olpcfriends.org
> Am I right in understanding that others are already using this patch
> and it's fixing things for them?
I tested this patch yesterday and I confirm that it's very useful,
thanks John !
Speaking about Nagios: these last days I spent time to test builtin
Nagios types and I noticed that it's not possible to use the concept of
object inheritance. I sent an email on "Puppet Users" group and I'm very
interested to have your opinion on it.
Thanks in advance
Mathieu
Any missing parameters are merely an artifact of when I wrote
Naginator (a few years ago), and I haven't assessed whether there have
been schema changes or anything. Either this is a new parameter, or
it's one I couldn't find evidence of when I wrote Naginator.
--
The only thing that saves us from the bureaucracy is inefficiency. An
efficient bureaucracy is the greatest threat to liberty.
--Eugene McCarthy
>
> Luke,
>
> On Tue, Nov 25, 2008 at 11:37:34PM -0600, Luke Kanies wrote:
>>
>> This is essentially a patch against Naginator[1]; can you provide it
>> against that code, and I'll apply and then copy over to Puppet?
>
> Which git repository should I use? I tried
>
> git://git.reductivelabs.com/naginator.git
>
> but it looks like it's missing patches that are in the puppet tree.
Yeah, that's the repo.
What patches are missing? That's no good.
--
The easiest way for your children to learn about money is for you
not to have any. -- Katharine Whitehorn
See my other email with patches against naginator tree. First patch
brings it up to date with puppet 0.24.x second has my fixes.
>
> On Wed, Nov 26, 2008 at 08:59:20AM -0600, Luke Kanies wrote:
>>> Which git repository should I use? I tried
>>>
>>> git://git.reductivelabs.com/naginator.git
>>>
>>> but it looks like it's missing patches that are in the puppet tree.
>>
>> Yeah, that's the repo.
>>
>> What patches are missing? That's no good.
>
> See my other email with patches against naginator tree. First patch
> brings it up to date with puppet 0.24.x second has my fixes.
Thanks. I'll apply them.
--
To have a right to do a thing is not at all the same as to be right
in doing it. -- G. K. Chesterton