Ashley Penney
2009-May-05 17:05 UTC
[Puppet Users] defined() and ordering and helppppppppp
I''m fed up so I thought I''d turn to you guys and see if you can stop me from setting fire to my office. I''m trying to add nagios::service{} statements to various modules throughout my configuration, but ONLY if the node in question uses a define of nagios::target. This is so I don''t break nagios constantly by adding apache on unmonitored hosts. In nodes.pp: (this is hlslinutil1, the nagios server itself) # Must be before other modules! nagios::target{ "": notification_period => "24x7" } include nagios defaultclass{$environment:} include commvault include puppetmaster include splunk::client include cobbler nagios/manifests/defines.pp: define nagios::target( $notification_period = "24x7" ){ nagios::host {$fqdn: notification_period => "$notification_period"} nagios::service::ping{$fqdn:} nagios::service { "ssh-$hostname": host_name => "$fqdn", check_command => ''check_ssh'', service_description => "ssh-$hostname", } } apache/manifests/init.pp: if defined(Nagios::Target[""]) { if $apachelistening80 == "true" { nagios::service { "http-$hostname": host_name => "$fqdn", service_description => "http on $hostname", check_command => "check_http_url!$fqdn!/serveralive.html"; } } if $apachelistening443 == "true" { nagios::service { "https-$hostname": host_name => "$fqdn", service_description => "https on $hostname", check_command => "check_https_url!$fqdn!/serveralive.html"; } } } ------------- The nagios module includes apache, so what I wanted to see was: nagios::target is called. nagios is included. apache is included -> does the check, sees nagios::target already called, adds the two nagios::service statements. What I see is: no monitoring on apache at all. I have tried dozens of ways around this but I just cannot work out what the hell is wrong. I can''t do defined(Nagios_host) (adds apache monitoring for all hosts), I can''t do defined(Nagios_host["$fqdn"]) (doesn''t work at all again) and I''m out of clever ideas. It''s almost as if it checks the defined() against the puppetmaster rather than the client. Someone rescue me? --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Puppet Users" group. To post to this group, send email to puppet-users@googlegroups.com To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en -~----------~----~----~----~------~----~------~--~---
Luke Kanies
2009-May-05 21:50 UTC
[Puppet Users] Re: defined() and ordering and helppppppppp
On May 5, 2009, at 12:05 PM, Ashley Penney wrote:> > I''m fed up so I thought I''d turn to you guys and see if you can stop > me from setting fire to my office. I''m trying to add > nagios::service{} statements to various modules throughout my > configuration, but ONLY if the node in question uses a define of > nagios::target. This is so I don''t break nagios constantly by adding > apache on unmonitored hosts. > > In nodes.pp: (this is hlslinutil1, the nagios server itself) > > # Must be before other modules! > nagios::target{ "": notification_period => "24x7" } > include nagios > > defaultclass{$environment:} > include commvault > include puppetmaster > include splunk::client > include cobbler > > nagios/manifests/defines.pp: > > define nagios::target( > $notification_period = "24x7" > ){ > nagios::host {$fqdn: notification_period => "$notification_period"} > > nagios::service::ping{$fqdn:} > > nagios::service { "ssh-$hostname": > host_name => "$fqdn", > check_command => ''check_ssh'', > service_description => "ssh-$hostname", > } > } > > apache/manifests/init.pp: > > if defined(Nagios::Target[""]) { > if $apachelistening80 == "true" { > nagios::service { "http-$hostname": > host_name => "$fqdn", > service_description => "http on $hostname", > check_command => > "check_http_url!$fqdn!/serveralive.html"; > } > } > > if $apachelistening443 == "true" { > nagios::service { "https-$hostname": > host_name => "$fqdn", > service_description => "https on $hostname", > check_command => > "check_https_url!$fqdn!/serveralive.html"; > } > } > } > > ------------- > > The nagios module includes apache, so what I wanted to see was: > > nagios::target is called. > nagios is included. > apache is included -> does the check, sees nagios::target already > called, adds the two nagios::service statements. > > What I see is: > > no monitoring on apache at all. > > I have tried dozens of ways around this but I just cannot work out > what the hell is wrong. I can''t do defined(Nagios_host) (adds apache > monitoring for all hosts), I can''t do defined(Nagios_host["$fqdn"]) > (doesn''t work at all again) and I''m out of clever ideas. It''s almost > as if it checks the defined() against the puppetmaster rather than the > client. Someone rescue me?What version are you on? For some versions in the 0.24 series, the defined resource got removed when it was evaluated, so defined(Nagios::Target[foo]) wouldn''t work. I believe that was fixed around 0.24.5, but I''m not positive, it could be later. -- The most incomprehensible thing about the world is that it is at all comprehensible. --Albert Einstein --------------------------------------------------------------------- Luke Kanies | http://reductivelabs.com | http://madstop.com --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Puppet Users" group. To post to this group, send email to puppet-users@googlegroups.com To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en -~----------~----~----~----~------~----~------~--~---
Ashley Penney
2009-May-05 23:11 UTC
[Puppet Users] Re: defined() and ordering and helppppppppp
We''re on the latest .24 epel release (I''m at home so I can''t check). Working over this with Volcane we determined the problem was my define not having a name, and when I changed them to nagios::target{ "$fqdn": } i was able to get this working properly. Pretty weird but at least it was fixable. On Tue, May 5, 2009 at 5:50 PM, Luke Kanies <luke@madstop.com> wrote:> What version are you on? > > For some versions in the 0.24 series, the defined resource got removed > when it was evaluated, so defined(Nagios::Target[foo]) wouldn''t work. > > I believe that was fixed around 0.24.5, but I''m not positive, it could > be later. > > -- > The most incomprehensible thing about the world is that it is at all > comprehensible. --Albert Einstein > --------------------------------------------------------------------- > Luke Kanies | http://reductivelabs.com | http://madstop.com > > > > >--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Puppet Users" group. To post to this group, send email to puppet-users@googlegroups.com To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en -~----------~----~----~----~------~----~------~--~---
Luke Kanies
2009-May-05 23:27 UTC
[Puppet Users] Re: defined() and ordering and helppppppppp
Ok, great. And thanks for the follow-up. On May 5, 2009, at 6:11 PM, Ashley Penney wrote:> > We''re on the latest .24 epel release (I''m at home so I can''t check). > Working over this with Volcane we determined the problem was my define > not having a name, and when I changed them to nagios::target{ "$fqdn": > } i was able to get this working properly. Pretty weird but at least > it was fixable. > > On Tue, May 5, 2009 at 5:50 PM, Luke Kanies <luke@madstop.com> wrote: > >> What version are you on? >> >> For some versions in the 0.24 series, the defined resource got >> removed >> when it was evaluated, so defined(Nagios::Target[foo]) wouldn''t work. >> >> I believe that was fixed around 0.24.5, but I''m not positive, it >> could >> be later. >> >> -- >> The most incomprehensible thing about the world is that it is at all >> comprehensible. --Albert Einstein >> --------------------------------------------------------------------- >> Luke Kanies | http://reductivelabs.com | http://madstop.com >> >> >>> >> > > >-- Patriotism is often an arbitrary veneration of real estate above principles. -- George Jean Nathan --------------------------------------------------------------------- Luke Kanies | http://reductivelabs.com | http://madstop.com --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Puppet Users" group. To post to this group, send email to puppet-users@googlegroups.com To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en -~----------~----~----~----~------~----~------~--~---