On Monday, August 5, 2013 3:33:11 PM UTC-5, John Santana wrote:
>
> On Mon, Aug 05, 2013 at 04:22:41PM -0400, Gabriel Filion wrote:
> >
> > you need to export the resource with ensure => absent and run puppet on
> > the host, then on the nagios server so that everything runs fine.
>
> Dozens of VMs are routinely destroyed on a weekly basis and in an
> automated fashion based on load. The nagios_*.cfg files are
> automatically changed, why is the notify not triggering?
>
>
Because there is a difference between unmanaged resources and resources
that are managed 'absent'. Only resources that are actually declared for
the target node are managed, whether declared directly or via collection of
virtual or exported resources. Declaring that unmanaged resources of a
given type should be purged does not make the affected resources managed.
You declare that Service['nagios'] must be notified when a *managed*Nagios_host
or Nagios_service is modified (including from being absent to
being present, or vise versa), but that's not what happens when you remove
the [exported] resource declaration altogether.
> > however in your example, you seem not to be redefining the "target" when
> > collecting, so you might consider using purge => true. to achieve what
> > you want with the workflow you mentioned above (e.g. without the need to
> > export with ensure => absent)
>
> I am purging unless you are referring to a different resource stanza.
> From my OP:
>
> resources { [ "nagios_host", "nagios_service" ]:
> purge => true,
> }
>
>
>
By definition, that causes *un*managed resources of the specified types to
be removed from the system. Because they are unmanaged, their removal does
not cause nagios to be notified.
You could try having that Resources resource notify Service['nagios']
itself:
resources { [ "nagios_host", "nagios_service" ]:
purge => true,
notify => Service['nagios']
}
I don't actually know whether that would work, but it seems right. Be sure
to check both that it causes nagios to be notified when hosts or services
are purged, and that it doesn't do so otherwise. And please let us know
what happens. I'm very curious.
John
--
You received this message because you are subscribed to the Google Groups
"Puppet Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/puppet-users.
For more options, visit https://groups.google.com/groups/opt_out.