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

Add Bind exporter #312

Merged
merged 17 commits into from
Feb 22, 2021
Merged

Add Bind exporter #312

merged 17 commits into from
Feb 22, 2021

Conversation

anarcat
Copy link

@anarcat anarcat commented Apr 11, 2019

This hooks the bind exporter in this puppet module. it is built on top of #303

@bastelfreak bastelfreak added needs-work not ready to merge just yet tests-fail labels Apr 12, 2019
@dhoppe
Copy link
Member

dhoppe commented Jun 5, 2019

@anarcat Could you please do a rebase?

@anarcat
Copy link
Author

anarcat commented Jun 5, 2019

@dhoppe done, but same here - since this is built on #303, i'd need to resolve that first...

@@ -89,6 +89,7 @@
Boolean $restart_on_change = true,
Boolean $service_enable = true,
String[1] $service_ensure = 'running',
String $service_name = 'apache_exporter',
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like this change, but there are a lot of exporters which still use a static service_name:

apache_exporter.pp
beanstalkd_exporter.pp
collectd_exporter.pp
consul_exporter.pp
elasticsearch_exporter.pp
graphite_exporter.pp
haproxy_exporter.pp
mesos_exporter.pp
mongodb_exporter.pp
mysqld_exporter.pp
nginx_vts_exporter.pp
process_exporter.pp
rabbitmq_exporter.pp
server.pp
snmp_exporter.pp
statsd_exporter.pp
varnish_exporter.pp

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

are you suggesting that this change should also make the service_name dynamic in all those? that change is probably part of #303 anyways...

@@ -0,0 +1,138 @@
# Class: prometheus::bind_exporter
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@anarcat If you introduce a new exporter, you should also provide the files spec/acceptance/bind_exporter.rb, spec/classes/bind_exporter.rb. Otherwise the new exporter will not be tested.

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@dhoppe totally agreed!

@anarcat anarcat force-pushed the bind-exporter branch 3 times, most recently from bfdb901 to 94ec7a1 Compare June 14, 2019 17:15
@anarcat
Copy link
Author

anarcat commented Jun 14, 2019

i've rebased this on master to avoid depending on the Debian branch (#303). This basically means dropping the Debian-specific package/service/perms configuration like this:

prometheus::bind_exporter::package_name: 'prometheus-bind-exporter'
prometheus::bind_exporter::service_name: 'prometheus-bind-exporter'
prometheus::bind_exporter::user: 'prometheus'
prometheus::bind_exporter::group: 'prometheus'

... which then need to be set by the user. But that's a problem that belongs in the Debian package support (#303), not here.

@anarcat anarcat mentioned this pull request Jun 14, 2019
@bastelfreak
Copy link
Member

@anarcat ping :)

@anarcat
Copy link
Author

anarcat commented Sep 6, 2019

one change i made in one of the last few commits is remove support for HTTP-only URL. it seems to me that if we're going to download and run arbitrary code on servers, we should at least do this over HTTPS, no?

@anarcat
Copy link
Author

anarcat commented Sep 6, 2019

@bastelfreak - pong! i think i made a good (if minimal) test suite here. test pass locally at last, and hopefully on travis too as well, although i need to run and can't check any further for now...

hopefully this will be all green and ready to merge once travis finishes!

@anarcat
Copy link
Author

anarcat commented Sep 16, 2019

and travis still fails here, unfortunately. I can't reproduce locally, i don't understand why, and would need help in figuring that out... thanks!

@anarcat
Copy link
Author

anarcat commented Sep 16, 2019

actually, now that i think about it, i think the test failures might be related to the bind exporter itself. i believe i'm running with specific flags locally so that the thing actually works (see also prometheus-community/bind_exporter#50)... maybe that's what's going on here? do the tests actually start bind and everything?

@bastelfreak
Copy link
Member

@anarcat the acceptance tests try to start bind_exporter. Is it failing because bind is missing?

@anarcat
Copy link
Author

anarcat commented Sep 23, 2019

@anarcat the acceptance tests try to start bind_exporter. Is it failing because bind is missing?

that is very likely. can i get away with just apt installing it here?

@bastelfreak
Copy link
Member

You've got multiple options here. Please keep in mind that the acceptance tests are executed on multiple platforms:

docker_sets:
- set: ubuntu1404-64
- set: ubuntu1604-64
- set: ubuntu1804-64
- set: debian8-64
- set: debian9-64
- set: centos7-64

You can run shell commands in an acceptance test:
https://github.com/puppetlabs/puppetlabs-apache/blob/1ea56eca1cb6db3a2f5c4f9f9aae5932e06e6b1e/spec/acceptance/apache_parameters_spec.rb#L121-L132

But you could also tell the spec helper to install another puppet module (for example one to install bind):
https://github.com/voxpupuli/puppet-nodejs/blob/a3aeae0dd4d0138a08499c66e9436d024867ee42/spec/spec_helper_acceptance.rb#L11-L12

@anarcat anarcat force-pushed the bind-exporter branch 2 times, most recently from 5ee134b to da3f338 Compare November 26, 2019 18:41
@@ -328,3 +328,10 @@ prometheus::apache_exporter::package_ensure: 'latest'
prometheus::apache_exporter::package_name: 'apache_exporter'
prometheus::apache_exporter::user: 'apache-exporter'
prometheus::apache_exporter::version: '0.7.0'
prometheus::bind_exporter::download_url: 'https://github.com/digitalocean/bind_exporter/releases/download/v0.2.0-dev/bind_exporter'
Copy link
Member

@alexjfisher alexjfisher Nov 27, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the idea is download_url is a way of a user overriding the url built from the download_url_base and version parameters. As such, it should default to undef.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i don't know how this stuff works. i use debian packages. :p feel free to take over this PR as well, i couldn't figure out how to make the test suite work properly...

@alexjfisher
Copy link
Member

As I think you discovered, the download available from github is not an archive, but the actual executable binary. Even more disappointing is that when I tried it, it didn't even work.
Looks like it's a MacOS binary??

file bind_exporter                                                                                                                                             
bind_exporter: Mach-O i386 executable, flags:<NOUNDEFS>

I was able to compile an amd64 linux binary, but where to host it?

@anarcat
Copy link
Author

anarcat commented Nov 27, 2019

I was able to compile an amd64 linux binary, but where to host it?

at this point, i think one course of action that might be needed is to just fork that darn thing. the patches and MRs are all in, it's just a matter of laying down tags and publishing the release properly...

@anarcat anarcat changed the title Bind exporter WIP: Bind exporter Nov 27, 2019
@anarcat
Copy link
Author

anarcat commented Dec 12, 2019

at this point, i think one course of action that might be needed is to just fork that darn thing. the patches and MRs are all in, it's just a matter of laying down tags and publishing the release properly...

looks like the project might be reclaimed by the prometheus community eventually: prometheus-community/community#15

@anarcat
Copy link
Author

anarcat commented Feb 22, 2021

i rebased this on top of the latest release here, and rebuilt it against teh v.0.4.0 release from prometheus-communtiy.. hopefully this will work?

data/defaults.yaml Outdated Show resolved Hide resolved
@anarcat
Copy link
Author

anarcat commented Feb 22, 2021

CI, as usual, fails here. :( i was hoping the update to 0.4.0 would fix it, but it seems like it didn't. i'd love if someone could help me on that front, otherwise I'll just keep rebasing this in the future. :)

@bastelfreak bastelfreak changed the title WIP: Bind exporter Add Bind exporter Feb 22, 2021
@bastelfreak bastelfreak added enhancement New feature or request and removed needs-work not ready to merge just yet tests-fail labels Feb 22, 2021
@bastelfreak bastelfreak merged commit da536f4 into voxpupuli:master Feb 22, 2021
@anarcat anarcat deleted the bind-exporter branch February 28, 2024 19:03
cegeka-jenkins pushed a commit to cegeka/puppet-prometheus that referenced this pull request Mar 11, 2024
* bind exporter support

* add tests

* fix robocop warnings

* fix download URLs

* bind: remove update tests as there's only one version

* fix download url *again*

* fix download extension type, it can be (and is) empty

* properly set download_url parameters

* mark the url_base as optional, enforce https (!)

* this is not an archive after all

* add support for scrape_job_labels from 8.x

* catchup with the newer bind_exporter version (0.4.0

* convert to puppet strings

* move defaults to the class

This way they show up in the REFERENCE.md documentation

* add missing documentation variables

* mark download_url as optional

* fix some linter warning
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants