-
-
Notifications
You must be signed in to change notification settings - Fork 242
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 Statsd Exporter, Mysqld Exporter, make exporters generic #27
Conversation
@brutus333 - any chance this will be merged? I'd love to use this module to install the statsd_exporter and this would come in super handy. |
I actually need to update this quite a bit. I've updated everything to use a daemon resource. It allows for every prometheus exporter to be added easily. |
In this case, I'll wait a bit for your changes. Did you generalize the exporter support? |
I got close but each exporter is still basically a copy paste. Take a look
at my repo and see what you think
…On Mon., 12 Dec. 2016 at 10:29 pm brutus333 ***@***.***> wrote:
In this case, I'll wait a bit for your changes. Did you generalize the
exporter support?
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#27 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AA-K-850AWUYpPVwOMI3jU0GL-pFwnPaks5rHTAOgaJpZM4K01JZ>
.
|
It is looking very good at first glance but I need to test it a bit; even if each exporter needs code duplication, we can get rid of too many templates issue. One idea to go even further would be to have a defined type for exporters and applying individual values for each type of exported but the hard thing is to add custom parameters for exporters (e.g. my.cnf for mysql exporter). Something similar with keyword arguments in Python would help. |
Thanks guys, this all sounds great, especially being able to add more exporters in a more modular way. |
7d97dbf
to
a28effc
Compare
default => undef, | ||
} | ||
|
||
$extra_statsd_maps = hiera_array('prometheus::statsd_exporter::statsd_maps') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can you add []
as the default?
@@ -0,0 +1,8 @@ | |||
<% @real_statsd_maps.each do |metric| -%> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you change this to real_statsd_maps.sort.each
?
Old Ruby versions have a bug where the order is not deterministic and it triggers the service restart on each run even if the data didn't change.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please add a comment in the README file regarding the breaking change for the alertmanager: since the name of the alertmanager service is changing from alert_manager, the user should be warned.
One solution is to stop and erase the alert_manager service before upgrading.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please add changes to daemon.pp to comply with #30
They are right about the location of systemd files.
Thank you
It could be hard to delete the old alertmanager completely, however stopping it should at least happen so that they don't clash. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure why you deleted these parameters. They are used in manifests.
It was a bad merge. They already exist further up
…On Wed., 14 Dec. 2016 at 11:49 pm brutus333 ***@***.***> wrote:
***@***.**** requested changes on this pull request.
Not sure why you deleted this parameters. They are used in manifests.
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#27 (review)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AA-K-4TWM8c3YEIKpOPPUio_i3LW3huTks5rH-XggaJpZM4K01JZ>
.
|
<% @real_statsd_maps.sort.each do |metric| -%> | ||
<%= metric['map'] %> | ||
name="<%= metric['name'] %>" | ||
<% metric['labels'].each do |key, value| -%> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry, forgot to mention to also add a sort
here as well.
I found two additional issues:
Please fix; I tested with these changes and it looks fine. |
6203ea5
to
19a125c
Compare
@@ -0,0 +1,61 @@ | |||
GEM |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think you should commit this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You should add Gemfile.lock
to .gitignore
@@ -0,0 +1,12 @@ | |||
test.dispatcher.*.*.* |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What's the significance of this configuration?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's the default supplied by the statsd_exporter
@@ -0,0 +1,242 @@ | |||
# Class: prometheus::mysqld_exporter |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What's the reason for renaming prometheus::alert_manager
to prometheus::alertmanager
? This is a breaking change.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the name of the binary and package is alertmanager
not alert_manager
. This was to keep consistency and allows for easier use of the daemon.pp.
@@ -0,0 +1,8 @@ | |||
<% @real_statsd_maps.sort_by!{ |metric| metric[:name] }.each do |metric| -%> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think that you can just use sort_by
instead of sort_by
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't understand.
<% metric['labels'].sort.each do |key, value| -%> | ||
<%= key %>="<%= value %>" | ||
<% end -%> | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think that this blank line is redundant given that the previous line ends with -%>
# | ||
# Daemonize the prometheus node exporter | ||
# Daemonize the prometheus <%= @name %> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this should be "Prometheus <%= @name %> exporter"
# pidfile: /var/run/node_exporter/pidfile | ||
# description: Prometheus Exporter <%= @name %> | ||
# processname: <%= @name %> | ||
# pidfile: /var/run/<%= @name %>/pidfile |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we change this to /var/run/<%= @name %>/<%= @name %>.pid
for consistency with Upstart?
DAEMON=<%= scope.lookupvar('prometheus::node_exporter::bin_dir') %>/node_exporter | ||
PID_FILE=/var/run/node_exporter/node_exporter.pid | ||
LOG_FILE=/var/log/node_exporter | ||
DAEMON=<%= @bin_dir %>/<%= @name %> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This <%= @bin_dir %>/<%= @name %>
logic is repeated in different template files. I think that you should define this value as a Puppet variable instead.
|
||
[ -e /etc/sysconfig/node_exporter ] && . /etc/sysconfig/node_exporter | ||
[ -e /etc/sysconfig/<%= @name %> ] && . /etc/sysconfig/<%= @name %> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think /etc/sysconfig
is a RedHat thing? This should read from /etc/default
for Debian systems.
[Service] | ||
User=<%= @user %> | ||
Group=<%= @group %> | ||
ExecStart=<%= @bin_dir %>/<%= @name %> <%= @options %> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Instead, you should read the options from the defaults file. Like this:
EnvironmentFile=/etc/default/<%= @name %>
ExecStart=<%= @bin_dir %>/<%= @name %> $OPTIONS
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
…daemon.pp; fixed duplicate definition of in alertmanager.pp
puppet-lint: fix arrow_on_right_operand_line
…li#27) * add a statsd_exporter * update templates * :update to use a template * fix bug * migrate to using generic service configurations * update node_exporter * update to just daemon * move node_exporter to use a generic daemon * move the statsd_exporter and alert_manager to generic daemon install * update to make the daemon a resource * update * add mysqld_exporter * update default params * update to use different users * update to use newer version of node_exporter fix mysqld_exporter my.cnf location * update systemd daemon * update to use alertmanager instead of alert_manager * update template filename * update version so that alertmanager breaking changes are known * update from review * update systemd files * update readme * the service should be restarted when the configuration is updated * fix bug in params * fix sorting of an array of hashes * add a lockfile for Gems * update documentation and sort params alphabetically * add some tests * add .gitignore file * remove Gemfile.lock * remove fixture modules * fix comments * shellescape options variable * update statsd template * Fixed daemon.systemd template; fixed duplicate definitions of and in daemon.pp; fixed duplicate definition of in alertmanager.pp * Fixed daemon upstart script * Changed statsd mapping code for ruby 1.8.7 compatibility
…li#27) * add a statsd_exporter * update templates * :update to use a template * fix bug * migrate to using generic service configurations * update node_exporter * update to just daemon * move node_exporter to use a generic daemon * move the statsd_exporter and alert_manager to generic daemon install * update to make the daemon a resource * update * add mysqld_exporter * update default params * update to use different users * update to use newer version of node_exporter fix mysqld_exporter my.cnf location * update systemd daemon * update to use alertmanager instead of alert_manager * update template filename * update version so that alertmanager breaking changes are known * update from review * update systemd files * update readme * the service should be restarted when the configuration is updated * fix bug in params * fix sorting of an array of hashes * add a lockfile for Gems * update documentation and sort params alphabetically * add some tests * add .gitignore file * remove Gemfile.lock * remove fixture modules * fix comments * shellescape options variable * update statsd template * Fixed daemon.systemd template; fixed duplicate definitions of and in daemon.pp; fixed duplicate definition of in alertmanager.pp * Fixed daemon upstart script * Changed statsd mapping code for ruby 1.8.7 compatibility
…li#27) * add a statsd_exporter * update templates * :update to use a template * fix bug * migrate to using generic service configurations * update node_exporter * update to just daemon * move node_exporter to use a generic daemon * move the statsd_exporter and alert_manager to generic daemon install * update to make the daemon a resource * update * add mysqld_exporter * update default params * update to use different users * update to use newer version of node_exporter fix mysqld_exporter my.cnf location * update systemd daemon * update to use alertmanager instead of alert_manager * update template filename * update version so that alertmanager breaking changes are known * update from review * update systemd files * update readme * the service should be restarted when the configuration is updated * fix bug in params * fix sorting of an array of hashes * add a lockfile for Gems * update documentation and sort params alphabetically * add some tests * add .gitignore file * remove Gemfile.lock * remove fixture modules * fix comments * shellescape options variable * update statsd template * Fixed daemon.systemd template; fixed duplicate definitions of and in daemon.pp; fixed duplicate definition of in alertmanager.pp * Fixed daemon upstart script * Changed statsd mapping code for ruby 1.8.7 compatibility
puppet-lint: fix arrow_on_right_operand_line
Add a statsd exporter to the mix