On Tue, Aug 06, 2013 at 06:20:09AM -0700, jcbollinger wrote:
>
> 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.
Your explanation just solved my problem. For the record using notify in
the resource purge doesn't work as attested in several google searches
(and confirmed here) with errors like:
warning: /Nagios_service[check_ssh_test1]: Service[nagios] still depends on me -- not purging
However, provided you do the following:
1) name your services like "servicename_${::hostname}"
2) name your hosts as "$::fqdn"
3) Make sure every @@nagios_* resource has "ensure=>'present'"
then the following does work to both remove the resources from the
nagios_*.cfg files __and__ restart nagios:
Get resource ids:
select id,title from resources where title like '%_<yourhostname>' or title='yourfqdn';
Update present to absent for all service checks and the host check.
update param_values set value='absent' where value='present' and (resource_id=1 or resource_id=2);
Since there may be a use case to turn off a single service instead of
blowing away all the service and host checks for a given node, I'll
probably populate a checklist form. Granted, that will require that the
host doesn't redefine it again (different problem).
Anyway, thanks so much for the unmanaged vs managed comment. That was
totally slipping by me while I pounded my head into my desk trying to
figure out why the files were changing but the service wasn't being
notified.