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

Comments

Projects
None yet
10 participants
@jasonhancock
Copy link
Contributor

commented Mar 22, 2016

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

This comment has been minimized.

Copy link

commented Mar 22, 2016

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

@tun0

This comment has been minimized.

Copy link

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

This comment has been minimized.

Copy link

commented Apr 4, 2016

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

@gbolo

This comment has been minimized.

Copy link

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

This comment has been minimized.

Copy link

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

This comment has been minimized.

Copy link

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

This comment has been minimized.

Copy link

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

This comment has been minimized.

Copy link

commented Apr 20, 2016

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

@dhs-rec

This comment has been minimized.

Copy link

commented May 31, 2016

Too sad this thing doesn't get officially released.

@dhs-rec

This comment has been minimized.

Copy link

commented Jun 22, 2016

Giving up...

@erude1

This comment has been minimized.

Copy link

commented Jun 30, 2016

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

@Calixx

This comment has been minimized.

Copy link

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

This comment has been minimized.

Copy link

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

This comment has been minimized.

Copy link

commented Oct 4, 2017

@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
You can’t perform that action at this time.