Filippo Giunchedi has submitted this change and it was merged. Change subject: cassandra: new metrics-collector version ......................................................................
cassandra: new metrics-collector version deploy a new version of cassandra-metrics-collector, featuring: * daemon mode * metrics blacklist * cassandra instance auto-discovery via cassandra.instance-id JVM property Bug: T113733 Change-Id: Ie98a120f4facf48c3a8786002ef9f75881ce2285 --- M modules/cassandra/manifests/metrics.pp A modules/cassandra/templates/initscripts/cassandra-metrics-collector.systemd.erb A modules/cassandra/templates/metrics-filter.yaml.erb 3 files changed, 58 insertions(+), 14 deletions(-) Approvals: Filippo Giunchedi: Verified; Looks good to me, approved Alexandros Kosiaris: Looks good to me, but someone else must approve diff --git a/modules/cassandra/manifests/metrics.pp b/modules/cassandra/manifests/metrics.pp index dee83dd..87c4ab9 100644 --- a/modules/cassandra/manifests/metrics.pp +++ b/modules/cassandra/manifests/metrics.pp @@ -16,19 +16,45 @@ # # [*graphite_port*] # What port to send metrics to +# +# [*blacklist*] +# Array of strings, each is a regular expression of metric names to blacklist +# (i.e. don't send to graphite) class cassandra::metrics( $graphite_prefix = "cassandra.${::hostname}", $graphite_host = 'localhost', $graphite_port = '2003', + $blacklist = undef, ) { validate_string($graphite_prefix) validate_string($graphite_host) validate_string($graphite_port) + if defined($blacklist) { + validate_array($blacklist) + } + + $filter_file = '/etc/cassandra-metrics-collector/filter.yaml' + $collector_jar = '/usr/local/lib/cassandra-metrics-collector/cassandra-metrics-collector.jar' package { 'cassandra/metrics-collector': ensure => present, provider => 'trebuchet', + } + + file { '/etc/cassandra-metrics-collector': + owner => 'root', + group => 'root', + mode => '0555', + ensure => 'directory', + } + + file { $filter_file: + ensure => 'present', + content => template("${module_name}/metrics-filter.yaml.erb"), + owner => 'root', + group => 'root', + mode => '0444', } file { '/usr/local/lib/cassandra-metrics-collector': @@ -38,25 +64,26 @@ ensure => 'directory', } - file { '/usr/local/lib/cassandra-metrics-collector/cassandra-metrics-collector.jar': + file { $collector_jar: ensure => 'link', - target => '/srv/deployment/cassandra/metrics-collector/lib/cassandra-metrics-collector-1.0.0-20150810.174059-7-jar-with-dependencies.jar', + target => '/srv/deployment/cassandra/metrics-collector/lib/cassandra-metrics-collector-2.0.0-20151001.182133-1-jar-with-dependencies.jar', require => Package['cassandra/metrics-collector'], - } - - file { '/usr/local/bin/cassandra-metrics-collector': - source => "puppet:///modules/${module_name}/cassandra-metrics-collector", - owner => 'root', - group => 'root', - mode => '0555', } cron { 'cassandra-metrics-collector': - ensure => present, - user => 'cassandra', - command => "flock --wait 2 /tmp/cassandra-metrics-collector.lock /usr/local/bin/cassandra-metrics-collector --graphite-host ${graphite_host} --graphite-port ${graphite_port} --prefix ${graphite_prefix} >/dev/null 2>&1", - minute => '*', - require => Package['cassandra/metrics-collector'], + ensure => absent, + user => 'cassandra', + } + + base::service_unit { 'cassandra-metrics-collector': + ensure => present, + template_name => 'cassandra-metrics-collector', + systemd => true, + refresh => false, + require => [ + File[$collector_jar], + File[$filter_file], + ], } # built-in cassandra metrics reporter, T104208 diff --git a/modules/cassandra/templates/initscripts/cassandra-metrics-collector.systemd.erb b/modules/cassandra/templates/initscripts/cassandra-metrics-collector.systemd.erb new file mode 100644 index 0000000..7f811a7 --- /dev/null +++ b/modules/cassandra/templates/initscripts/cassandra-metrics-collector.systemd.erb @@ -0,0 +1,11 @@ +[Unit] +Description=cassandra metrics collector +After=network.target + +[Service] +User=cassandra +<% if @blacklist %> +ExecStart=/usr/bin/java -jar /usr/local/lib/cassandra-metrics-collector/cassandra-metrics-collector.jar --graphite-host <%= @graphite_host %> --graphite-port <%= @graphite_port %> --filter-config <%= @filter_file %> +<% else %> +ExecStart=/usr/bin/java -jar /usr/local/lib/cassandra-metrics-collector/cassandra-metrics-collector.jar --graphite-host <%= @graphite_host %> --graphite-port <%= @graphite_port %> +<% end %> diff --git a/modules/cassandra/templates/metrics-filter.yaml.erb b/modules/cassandra/templates/metrics-filter.yaml.erb new file mode 100644 index 0000000..475d78d --- /dev/null +++ b/modules/cassandra/templates/metrics-filter.yaml.erb @@ -0,0 +1,6 @@ +<% if @blacklist %> +blacklist: + <%- @blacklist.each do |x| -%> + - '<%= x %>' + <%- end -%> +<% end %> -- To view, visit https://gerrit.wikimedia.org/r/243127 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: merged Gerrit-Change-Id: Ie98a120f4facf48c3a8786002ef9f75881ce2285 Gerrit-PatchSet: 4 Gerrit-Project: operations/puppet Gerrit-Branch: production Gerrit-Owner: Filippo Giunchedi <fgiunch...@wikimedia.org> Gerrit-Reviewer: Alexandros Kosiaris <akosia...@wikimedia.org> Gerrit-Reviewer: Eevans <eev...@wikimedia.org> Gerrit-Reviewer: Filippo Giunchedi <fgiunch...@wikimedia.org> Gerrit-Reviewer: jenkins-bot <> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits