Filippo Giunchedi has uploaded a new change for review. https://gerrit.wikimedia.org/r/181080
Change subject: graphite: introduce local c-relay ...................................................................... graphite: introduce local c-relay The idea behind this change is to have a local carbon-c-relay instance (on port 1903) whose sole task is to forward incoming metrics to the local carbon-cache, in practice replacing carbon-relay's role. In turn, this local carbon-c-relay will receive metrics from a "top level" carbon-c-relay listening on standard port 2003 for line/plaintext protocol metrics. Change-Id: I61f687237baed6674fcc9813acc9df0ce40d4fbb --- M manifests/role/graphite.pp M modules/graphite/files/carbonctl M modules/graphite/manifests/init.pp A modules/graphite/templates/local-relay.conf.erb A modules/graphite/templates/local-relay.upstart.conf.erb 5 files changed, 58 insertions(+), 2 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/operations/puppet refs/changes/80/181080/1 diff --git a/manifests/role/graphite.pp b/manifests/role/graphite.pp index 706a567..f89d058 100644 --- a/manifests/role/graphite.pp +++ b/manifests/role/graphite.pp @@ -149,6 +149,18 @@ }, storage_dir => $carbon_storage_dir, + c_relay_settings => { + 'backends' => [ + '127.0.0.1:2103', + '127.0.0.1:2203', + '127.0.0.1:2303', + '127.0.0.1:2403', + '127.0.0.1:2503', + '127.0.0.1:2603', + '127.0.0.1:2703', + '127.0.0.1:2803', + ], + }, } class { '::graphite::web': diff --git a/modules/graphite/files/carbonctl b/modules/graphite/files/carbonctl index e6d9437..1fd4fac 100755 --- a/modules/graphite/files/carbonctl +++ b/modules/graphite/files/carbonctl @@ -12,6 +12,7 @@ /sbin/status carbon/cache NAME="$name" |& sed 's/ //' done grep -Fqx '[relay]' /etc/carbon/carbon.conf && /sbin/status carbon/relay + [ -e /etc/carbon/local-relay.conf ] && /sbin/status carbon/local-relay } |& { sed 's/, process//' | column -t | tee /dev/stderr | grep -qv running ; } 2>&1 ;; check) diff --git a/modules/graphite/manifests/init.pp b/modules/graphite/manifests/init.pp index 41a27ed..29b5108 100644 --- a/modules/graphite/manifests/init.pp +++ b/modules/graphite/manifests/init.pp @@ -1,20 +1,22 @@ # == Class: graphite # # Graphite is a monitoring tool that stores numeric time-series data and -# renders graphs of this data on demand. It consists of three software +# renders graphs of this data on demand. It consists of the following software # components: # # - Carbon, a daemon that listens for time-series data +# - Carbon-c-relay, an high-performance metric router # - Whisper, a database library for storing time-series data # - Graphite webapp, a webapp which renders graphs on demand # class graphite( $carbon_settings, + $c_relay_settings, $storage_schemas, $storage_aggregation = {}, $storage_dir = '/var/lib/carbon', ) { - require_package('graphite-carbon', 'python-whisper') + require_package('graphite-carbon', 'python-whisper', 'carbon-c-relay') $carbon_service_defaults = { log_updates => false, @@ -62,6 +64,22 @@ notify => Service['carbon'], } + file { '/etc/carbon/local-relay.conf': + content => template('graphite/local-relay.conf.erb'), + require => Class['packages::carbon_c_relay'], + notify => Service['carbon'], + } + + # NOTE: the service is named local-relay as opposed to c-relay otherwise + # we'd have these very similar but different names: + # service carbon-c-relay # from debian package, the standard relay + # service carbon/c-relay # from this module, forwarding to local carbon-cache + file { '/etc/init/carbon/local-relay.conf': + content => template('graphite/local-relay.upstart.conf.erb'), + require => Class['packages::carbon_c_relay'], + notify => Service['carbon'], + } + file { '/etc/init/carbon': source => 'puppet:///modules/graphite/carbon-upstart', recurse => true, diff --git a/modules/graphite/templates/local-relay.conf.erb b/modules/graphite/templates/local-relay.conf.erb new file mode 100644 index 0000000..40d1773 --- /dev/null +++ b/modules/graphite/templates/local-relay.conf.erb @@ -0,0 +1,13 @@ +# simple carbon-c-relay configuration to replace carbon-relay, will +# load-balance metrics sending among all members of the local cluster. + +cluster carbon-cache + any_of + <% @c_relay_settings['backends'].each do |b| -%> + <%= b %> + <% end -%> + ; + +match * + send to carbon-cache + ; diff --git a/modules/graphite/templates/local-relay.upstart.conf.erb b/modules/graphite/templates/local-relay.upstart.conf.erb new file mode 100644 index 0000000..c871672 --- /dev/null +++ b/modules/graphite/templates/local-relay.upstart.conf.erb @@ -0,0 +1,12 @@ +description "carbon-c-relay instance, used to forward to local carbon-cache only" + +start on (local-filesystems and net-device-up IFACE!=lo) +stop on [!12345] + +limit nofile 32768 32768 + +setuid carbon-c-relay + +# it is possible there's another carbon-c-relay running on the same host, so +# change the hostname +exec /usr/bin/carbon-c-relay -H <%= "#{hostname}_local-relay" -%> -p 1903 -f /etc/carbon/local-relay.conf -- To view, visit https://gerrit.wikimedia.org/r/181080 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I61f687237baed6674fcc9813acc9df0ce40d4fbb Gerrit-PatchSet: 1 Gerrit-Project: operations/puppet Gerrit-Branch: production Gerrit-Owner: Filippo Giunchedi <fgiunch...@wikimedia.org> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits