puppetexplorer
puppetexplorer copied to clipboard
Population metric names changed in PuppetDB 4.x
Population metric names changed in PuppetDB 4.x
https://docs.puppetlabs.com/puppetdb/4.0/api/metrics/v1/changes-from-puppetdb-v3.html#population-metrics
For example, the following metrics:
puppetlabs.puppetdb.query.population:type=default,name=num-nodes
puppetlabs.puppetdb.query.population:type=default,name=num-resources
puppetlabs.puppetdb.query.population:type=default,name=avg-resources-per-node
puppetlabs.puppetdb.query.population:type=default,name=pct-resource-dupes
are now, respectively:
puppetlabs.puppetdb.population:name=num-nodes
puppetlabs.puppetdb.population:name=num-resources
puppetlabs.puppetdb.population:name=avg-resources-per-node
puppetlabs.puppetdb.population:name=pct-resource-dupes
As I'm proxying puppetexplorer with Apache, the addition of a rewrite rule works around this for now:
RewriteEngine On
RewriteRule ^/api/metrics/v1/mbeans/puppetlabs.puppetdb.query.population:type=default,name=(.*)$ https://%{HTTP_HOST}/api/metrics/v1/mbeans/puppetlabs.puppetdb.population:name=$1 [R=301,L]
I've been scratching my head since yesterday trying to fix this, works mint now, thanks heaps!
"Perfect!"
If it were a real solution instead of a (rather nicely executed, I must admit) work-around, it'd be Perfect! ;-)
Any idea when this is going to be released? The RewriteRule workaround doesn't work for me.
The rewrite rule works, but should be fixed in the application code to generate the proper http request in the first place. please fix it
For anyone using the spotify-puppetexplorer module, @jasonhancock's temp fix can be added to the apache class pretty easily:
Edit: Fixed based on @dhs-rec's comment! 😄
class {'::puppetexplorer':
vhost_options => {
rewrites => [ { rewrite_rule => ['^/api/metrics/v1/mbeans/puppetlabs.puppetdb.query.population:type=default,name=(.*)$ https://%{HTTP_HOST}/api/metrics/v1/mbeans/puppetlabs.puppetdb.population:name=$1 [R=301,L]'] } ] }
}
}
Final closing }
is missing.
However, still doesn't work for me. I still get messages like this one when reloading the dashboard page:
Could not fetch metric pct-resource-dupes from PuppetDB
I can confirm that the workaround does work, even in hiera:
puppetexplorer::vhost_options:
rewrites:
- rewrite_rule:
- '^/api/metrics/v1/mbeans/puppetlabs.puppetdb.query.population:type=default,name=(.*)$ https://%%{}{HTTP_HOST}/api/metrics/v1/mbeans/puppetlabs.puppetdb.population:name=$1 [R=301,L]'
Any news on the issue? Puppetexplorer is still unusable for me.
Too sad this thing doesn't get officially released.
Giving up...
Thanks for sharing this fix jasonhancock. Worked like a charm for me.
Thanks for the fix - after an additional
sudo setsebool -P httpd_can_network_connect on
it works like a charm for me.
This had me puzzled for a while. The Rewrite rule was not working. I disabled SSL from my config, and the Rewrite has https.
NB: This is only if you are arent using SSL
Change
https://%{HTTP_HOST}
To
http://%{HTTP_HOST}
Works now!
@shaunrampersad changing the rewrite rule to the following would work in both scenarios:
%{REQUEST_SCHEME}://%{HTTP_HOST}