Filippo Giunchedi has uploaded a new change for review.
https://gerrit.wikimedia.org/r/191652
Change subject: report cassandra metrics with metrics-graphite
......................................................................
report cassandra metrics with metrics-graphite
introduce a new class, cassandra::metrics used to report metrics initially via
metrics-graphite. Note this pulls in dropwizard/metrics with trebuchet which in
turn pulls in the require jars via git-fat via archiva.
Bug: T78514
Change-Id: I6b15e81ae80800dce92f7034f96e93a4368c9372
---
M manifests/init.pp
A manifests/metrics.pp
M templates/cassandra-env.sh.erb
A templates/metrics.yaml.erb
4 files changed, 75 insertions(+), 1 deletion(-)
git pull ssh://gerrit.wikimedia.org:29418/operations/puppet/cassandra
refs/changes/52/191652/1
diff --git a/manifests/init.pp b/manifests/init.pp
index 04e8499..683fdcb 100644
--- a/manifests/init.pp
+++ b/manifests/init.pp
@@ -148,7 +148,11 @@
#
# [*additional_jvm_opts*]
# Additional options to pass to the JVM.
-# Default: undef
+# Default: []
+#
+# [*extra_classpath*]
+# Additional classpath to be appended to the default.
+# Default: []
#
# [*jmx_port*]
# Port to listen for JMX queries.
diff --git a/manifests/metrics.pp b/manifests/metrics.pp
new file mode 100644
index 0000000..ef619f8
--- /dev/null
+++ b/manifests/metrics.pp
@@ -0,0 +1,47 @@
+# == Class: cassandra::metrics
+#
+# Configure metrics reporting for cassandra
+#
+# === Usage
+# class { '::cassandra::metrics':
+# graphite_host => 'graphite.duh',
+# }
+#
+# === Parameters
+# [*graphite_prefix*]
+# The metrics prefix to use
+#
+# [*graphite_host*]
+# What host to send metrics to
+#
+# [*graphite_port*]
+# What port to send metrics to
+
+class cassandra::metrics(
+ $graphite_prefix = "cassandra.${::hostname}",
+ $graphite_host = 'localhost',
+ $graphite_port = '2003',
+) {
+ validate_string($graphite_prefix)
+ validate_string($graphite_host)
+ validate_string($graphite_port)
+
+ package { [ 'dropwizard/metrics' ]:
+ ensure => present,
+ provider => 'trebuchet',
+ }
+
+ file { '/usr/share/cassandra/metrics-graphite.jar':
+ ensure => 'link',
+ target =>
+ '/srv/deployment/dropwizard/metrics/lib/metrics-graphite-2.2.0.jar',
+ require => Package['dropwizard/metrics'],
+ }
+
+ file { '/etc/cassandra/metrics.yaml':
+ content => template("${module_name}/metrics.yaml.erb"),
+ owner => 'cassandra',
+ group => 'cassandra',
+ mode => '0444',
+ }
+}
diff --git a/templates/cassandra-env.sh.erb b/templates/cassandra-env.sh.erb
index 196bb86..732fa29 100644
--- a/templates/cassandra-env.sh.erb
+++ b/templates/cassandra-env.sh.erb
@@ -280,6 +280,10 @@
#MX4J_ADDRESS="-Dmx4jaddress=127.0.0.1"
#MX4J_PORT="-Dmx4jport=8081"
+if [ -e '/etc/cassandra/metrics.yaml' ]; then
+ JVM_OPTS="$JVM_OPTS -Dcassandra.metricsReporterConfigFile=metrics.yaml"
+fi
+
JVM_OPTS="$JVM_OPTS -Dcom.sun.management.jmxremote.port=$JMX_PORT"
JVM_OPTS="$JVM_OPTS -Dcom.sun.management.jmxremote.rmi.port=$JMX_PORT"
JVM_OPTS="$JVM_OPTS -Dcom.sun.management.jmxremote.ssl=false"
diff --git a/templates/metrics.yaml.erb b/templates/metrics.yaml.erb
new file mode 100644
index 0000000..8c4f323
--- /dev/null
+++ b/templates/metrics.yaml.erb
@@ -0,0 +1,19 @@
+graphite:
+ -
+ period: 60
+ timeunit: 'SECONDS'
+ prefix: '<%= @graphite_prefix %>'
+ hosts:
+ - host: '<%= @graphite_host %>'
+ port: <%= @graphite_port %>
+ predicate:
+ color: "white"
+ useQualifiedName: true
+ patterns:
+ - "^org.apache.cassandra.metrics.Cache.+"
+ - "^org.apache.cassandra.metrics.ClientRequest.+"
+ - "^org.apache.cassandra.metrics.Storage.+"
+ - "^org.apache.cassandra.metrics.ThreadPools.+"
+ - "^org.apache.cassandra.metrics.Compaction.+"
+ - "^org.apache.cassandra.metrics.ReadRepair.+"
+ - "^org.apache.cassandra.metrics.CommitLog.+"
--
To view, visit https://gerrit.wikimedia.org/r/191652
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I6b15e81ae80800dce92f7034f96e93a4368c9372
Gerrit-PatchSet: 1
Gerrit-Project: operations/puppet/cassandra
Gerrit-Branch: master
Gerrit-Owner: Filippo Giunchedi <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits