Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Population metric names changed in PuppetDB 4.x #49

Open
jasonhancock opened this issue Mar 22, 2016 · 14 comments
Open

Population metric names changed in PuppetDB 4.x #49

jasonhancock opened this issue Mar 22, 2016 · 14 comments

Comments

@jasonhancock
Copy link
Contributor

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]
@therin
Copy link

therin commented Mar 22, 2016

I've been scratching my head since yesterday trying to fix this, works mint now, thanks heaps!

@tun0
Copy link

tun0 commented Mar 23, 2016

"Perfect!"

If it were a real solution instead of a (rather nicely executed, I must admit) work-around, it'd be Perfect! ;-)

jasonhancock added a commit to jasonhancock/puppetexplorer that referenced this issue Mar 28, 2016
@dhs-rec
Copy link

dhs-rec commented Apr 4, 2016

Any idea when this is going to be released? The RewriteRule workaround doesn't work for me.

@gbolo
Copy link

gbolo commented Apr 11, 2016

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

@petems
Copy link

petems commented Apr 14, 2016

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]'] } ] }
  }
}

@dhs-rec
Copy link

dhs-rec commented Apr 15, 2016

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

@gbolo
Copy link

gbolo commented Apr 15, 2016

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]'

@dhs-rec
Copy link

dhs-rec commented Apr 20, 2016

Any news on the issue? Puppetexplorer is still unusable for me.

@dhs-rec
Copy link

dhs-rec commented May 31, 2016

Too sad this thing doesn't get officially released.

@dhs-rec
Copy link

dhs-rec commented Jun 22, 2016

Giving up...

@edrude
Copy link

edrude commented Jun 30, 2016

Thanks for sharing this fix jasonhancock. Worked like a charm for me.

@Calixx
Copy link

Calixx commented Oct 19, 2016

Thanks for the fix - after an additional
sudo setsebool -P httpd_can_network_connect on
it works like a charm for me.

@shaunrampersad
Copy link

shaunrampersad commented Jan 24, 2017

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!

@irfanypatel
Copy link

@shaunrampersad changing the rewrite rule to the following would work in both scenarios:

%{REQUEST_SCHEME}://%{HTTP_HOST}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

10 participants