On 27/07/17 12:06, Jonathan Gazeley wrote:
Hi folks,
I'm trying to track down an issue with my PE installation. I've been
using exported resources to configure my Nagios monitoring since Puppet
0.2.6 but I've just noticed that tags are not behaving as I expected.
The VMs in my estate all have exported resources like this:
@@nagios_service { "check_ping_${::fqdn}":
check_command => 'check_ping',
service_description => 'Ping',
}
and there is a declaration in site.pp to set the resource default, so
these exported resources only get realised on the Nagios server that
they are targeted at:
Nagios_service {
host_name => $::fqdn,
tag => 'monitor.resnet.bris.ac.uk',
use => 'generic-service',
}
I have independently verified that my site.pp is being included.
Now on my Nagios server, I am collecting the resources like this:
Nagios_service <<| tag == $::fqdn |>> {
require => Package['nagios'],
notify => Service['nagios'],
owner => 'root',
group => 'nagios',
mode => '0644',
}
So appropriate resources will get realised on the suitable Nagios
server, so we can explicitly target Nagios checks for prod and dev VMs
at prod and dev Nagios servers. However, Nagios is not realising any
exported resources when I set the filter `tag == $::fqdn` so it looks
like the resources are not being tagged properly. I used puppet query to
look at the exported resources in PuppetDB and found that they are
indeed not tagged with the hostname of the Nagios server,
monitor.resnet.bris.ac.uk.
$ puppet query "resources[certname, type, title, tags] { exported = true
and type = 'Nagios_service' and title =
'check_ping_build-el7.resnet.bris.ac.uk'}"
[ {
"certname" : "build-el7.resnet.bris.ac.uk",
"type" : "Nagios_service",
"title" : "check_ping_build-el7.resnet.bris.ac.uk",
"tags" : [ "check_ping_build-el7.resnet.bris.ac.uk", "class",
"uob_nagios", "uob_nagios::client", "nagios_service", "client" ]
} ]
Any idea why my tag is not being applied as expected? I've checked that
site.pp is being applied and also that the other resource defaults in
Nagios_servier (e.g. the hostname => $::fqdn) is being properly set.
There are a number of problems with tagging, and with exported resources
and tags in particular. The main problem IIRC here is that of: should
the resource be tagged as it was contained when exported or as when
realized? Also, if IIRC, there is an issue with defaults (should the
defaults from the exporting or importing compilation be applied).
There is an epic with tag improvements:
https://tickets.puppetlabs.com/browse/PUP-7536 - not sure if one of
those is your case.
You may want to try using a query against PDB to get the data and then
realize the resource yourself rather than relying on the collector
syntax to do that for you. (Don't know if that will help in your case
though, but that is an approach others are using when they run into
issues with export/import).
Best,
- henrik
--
Visit my Blog "Puppet on the Edge"
http://puppet-on-the-edge.blogspot.se/
--
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 puppet-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit
https://groups.google.com/d/msgid/puppet-users/olcpeh%24vjd%241%40blaine.gmane.org.
For more options, visit https://groups.google.com/d/optout.