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 [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-users?hl=en
-~----------~----~----~----~------~----~------~--~---