Issue #1496 has been updated by Alex Urbanowicz.

Status changed from Closed to Re-opened
Affected version changed from 0.24.6 to 0.24.8
Keywords set to exportedresources

I have a following nagios service manifest:

        define service( $contactgroup, $command )  {

            @@nagios_service { "$title_$hostname":
                use                 => "generic-service",
                host_name           => $hostname,
                service_description => "$title",
                is_volatile         => 0,

                contact_groups => $contactgroup,

                check_period          => "24x7",
                max_check_attempts    => 2,
                normal_check_interval => 5,
                retry_check_interval  => 3,
                check_command         => $command,

                notification_interval => 480,
                notification_period   => "dayhours",
                notification_options  => "u,c,r,w",

                tag     => $environment,
                require => 
[Nagios_contactgroup["artegence-admins"],Nagios_host["$hostname"]],
                notify  => [Exec["chmod_nagios"], Service["nagios"]],
            }

            @@nagios_servicedependency { "$title_DEP_$hostname":

                host_name => $hostname,
                service_description => "$title",
                dependent_host_name => $hostname,
                notification_failure_criteria => "w,u,c",
                execution_failure_criteria    => "n,p",  

                require => [Nagios_service["$title_$hostname"], 
Nagios_host["$hostname"]],
                notify  => [Exec["chmod_nagios"], Service["nagios"]],
                tag     => $environment,
                ensure  => present,
            }
        }

When I use it in service class definition like:

nagios::service { YUM: contactgroup => somecontactgroup, command => 
somenagioscommand }

and in another

nagios::service { PUPPET: contactgroup => somecontactgroup, command => 
somenagioscommand }

I get Duplicate definition: Nagios_service[hostname] with references to file 
and line where the define() is defined. When I paste the code directly to 
respective classes and replace $title by hand with PUPPET and YUM respectively, 
everything works ok.
----------------------------------------
Bug #1496: nagios_servicedependency needs a unique host_name?
http://projects.reductivelabs.com/issues/1496

Author: Tim Stoop
Status: Re-opened
Priority: Normal
Assigned to: James Turnbull
Category: nagios
Target version: 0.24.7
Affected version: 0.24.8
Keywords: exportedresources
Branch: 


Hi all,

I might be doing something wrong here, but... I've created a definition that 
adds exported resources for websites that are hosted on that machine. However, 
these Nagios service checks depend on the overall availability of apache. So I 
tried to simply add a dependency on the apache check for each of the http 
website checks. The definition looks like this:
<pre>
        define my_site ($documentroot = "/var/www", $check_priority = 
"important") {
                apache::site { $name:
                        documentroot => $documentroot, 
                }

                @@nagios_service { "$fqdn $name http check":
                        ensure => present,
                        target => "/etc/nagios2/cust/services-by-puppet.cfg",
                        use => "${check_priority}-service", 
                        host_name => $fqdn,
                        service_description => "$name at $hostname",
                        #notify => Service["nagios2"],
                        check_command => "check_http2!$name!10!20",
                }

                @@nagios_servicedependency { "$fqdn $name http dependency":
                        ensure => present,
                        target => "/tmp/servicedependencies-by-puppet.cfg", 
                        dependent_host_name => $fqdn,
                        dependent_service_description => "$name at $hostname",
                        host_name => $fqdn,
                        service_description => "apache",
                        execution_failure_criteria => "c", 
                        notification_failure_criteria => "w,c",
                 } 
        }
</pre>

I get the following error:

@err: Could not create sharedhosting1.example.com test1.example.com http 
dependency: sharedhosting1.example.com test2.example.com http dependency 
already exists with name sharedhosting1.example.com@

Adding an alias to the nagios_servicedependency doesn't seem to solve this.

Am I doing something wrong or is this a bug in the type?


-- 
You have received this notification because you have either subscribed to it, 
or are involved in it.
To change your notification preferences, please click here: 
http://reductivelabs.com/redmine/my/account

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Puppet Bugs" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/puppet-bugs?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to