Eevans has uploaded a new change for review. ( https://gerrit.wikimedia.org/r/332535 )
Change subject: WIP: Enable Prometheus JMX exporter on Cassandra nodes ...................................................................... WIP: Enable Prometheus JMX exporter on Cassandra nodes Strawman proposal for selectively enabling the JMX exporter agent; I propose that once vetted for production use, we simply install/enable it everywhere. Bug: T155120 Change-Id: I8b70ada1ede13338f36b90ce704e8bbdfb468889 --- A modules/cassandra/files/prometheus_jmx_exporter.yaml M modules/cassandra/manifests/init.pp M modules/cassandra/manifests/instance.pp M modules/cassandra/templates/cassandra-env.sh-2.2.erb 4 files changed, 39 insertions(+), 6 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/operations/puppet refs/changes/35/332535/1 diff --git a/modules/cassandra/files/prometheus_jmx_exporter.yaml b/modules/cassandra/files/prometheus_jmx_exporter.yaml new file mode 100644 index 0000000..6397585 --- /dev/null +++ b/modules/cassandra/files/prometheus_jmx_exporter.yaml @@ -0,0 +1,13 @@ +--- +lowercaseOutputLabelNames: true +lowercaseOutputName: true +rules: + - pattern: org.apache.cassandra.metrics<type=(Connection|Streaming), scope=(\S*), name=(\S*)><>(Count|Value) + name: cassandra_$1_$3 + labels: + address: "$2" + - pattern: org.apache.cassandra.metrics<type=(\S*)(?:, ((?!scope)\S*)=(\S*))?(?:, scope=(\S*))?, name=(\S*)><>(Count|Value) + name: cassandra_$1_$5 + labels: + "$1": "$4" + "$2": "$3" diff --git a/modules/cassandra/manifests/init.pp b/modules/cassandra/manifests/init.pp index 2be9cc1..0d4b427 100644 --- a/modules/cassandra/manifests/init.pp +++ b/modules/cassandra/manifests/init.pp @@ -485,4 +485,9 @@ group => 'cassandra', mode => '0755', } + + scap::target { 'cassandra/prometheus_jmx_exporter': + deploy_user => 'deploy-service', + manage_user => true, + } } diff --git a/modules/cassandra/manifests/instance.pp b/modules/cassandra/manifests/instance.pp index 11e9343..d82a0a1 100644 --- a/modules/cassandra/manifests/instance.pp +++ b/modules/cassandra/manifests/instance.pp @@ -33,7 +33,7 @@ # will be inherited here and can be used e.g. in templates. # # Default: $::cassandra::instances - +# define cassandra::instance( $instances = $::cassandra::instances, ) { @@ -42,11 +42,13 @@ fail("instance ${instance_name} not found in ${instances}") } - $this_instance = $instances[$instance_name] - $jmx_port = $this_instance['jmx_port'] - $listen_address = $this_instance['listen_address'] - $rpc_address = $this_instance['rpc_address'] - $rpc_interface = $this_instance['rpc_interface'] + $this_instance = $instances[$instance_name] + $jmx_port = $this_instance['jmx_port'] + $listen_address = $this_instance['listen_address'] + $rpc_address = $this_instance['rpc_address'] + $rpc_interface = $this_instance['rpc_interface'] + $jmx_exporter_enabled = $this_instance['jmx_exporter_enabled'] + if $rpc_interface { interface::ip { "cassandra-${instance_name}_rpc_${rpc_interface}": interface => $rpc_interface, @@ -163,6 +165,15 @@ require => Package['cassandra'], } + file { "${config_directory}/prometheus_jmx_exporter.yaml": + ensure => present, + source => "puppet:///modules/${module_name}/prometheus_jmx_exporter.yaml", + owner => 'cassandra', + group => 'cassandra', + mode => '0400', + require => Package['cassandra'], + } + if $application_username != undef { file { "${config_directory}/adduser.cql": content => template("${module_name}/adduser.cql.erb"), diff --git a/modules/cassandra/templates/cassandra-env.sh-2.2.erb b/modules/cassandra/templates/cassandra-env.sh-2.2.erb index a177ecb..98cdde2 100644 --- a/modules/cassandra/templates/cassandra-env.sh-2.2.erb +++ b/modules/cassandra/templates/cassandra-env.sh-2.2.erb @@ -342,3 +342,7 @@ <% if not @additional_jvm_opts.empty? -%> JVM_OPTS="$JVM_OPTS <%= Array(@additional_jvm_opts).join(' ') %>" <% end -%> + +<% if @jmx_exporter_enabled -%> +JVM_OPTS="$JVM_OPTS -javaagent:/srv/deployment/cassandra/jmx_exporter/lib/jmx_prometheus_javaagent-0.8-SNAPSHOT.jar=<%= @listen_address %>:9999:/etc/cassandra/jmx_exporter.yaml" +<% end -%> -- To view, visit https://gerrit.wikimedia.org/r/332535 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I8b70ada1ede13338f36b90ce704e8bbdfb468889 Gerrit-PatchSet: 1 Gerrit-Project: operations/puppet Gerrit-Branch: production Gerrit-Owner: Eevans <eev...@wikimedia.org> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits