Ottomata has submitted this change and it was merged.

Change subject: burrow: Add new module for burrow
......................................................................


burrow: Add new module for burrow

Burrow(https://github.com/linkedin/burrow) is a consumer lag
monitoring tool for Kafka, it will monitor the consumer groups on our
Kafka clusters and send emails on their status.

This patch installs and runs burrow on krytpon.

Bug: T115669
Change-Id: Iaf6b2ee804df8f5e951fc7ced770b2565e3adb65
---
A hieradata/role/common/analytics/burrow.yaml
A manifests/role/analytics/burrow.pp
M manifests/site.pp
A modules/burrow/manifests/init.pp
A modules/burrow/templates/burrow.cfg.erb
5 files changed, 122 insertions(+), 1 deletion(-)

Approvals:
  Ottomata: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/hieradata/role/common/analytics/burrow.yaml 
b/hieradata/role/common/analytics/burrow.yaml
new file mode 100644
index 0000000..692891e
--- /dev/null
+++ b/hieradata/role/common/analytics/burrow.yaml
@@ -0,0 +1,5 @@
+burrow::httpserver_port: 8000
+burrow::consumer_groups:
+  - eventlogging-00
+  - eventlogging-mysql-00
+  - eventlogging-files-00
\ No newline at end of file
diff --git a/manifests/role/analytics/burrow.pp 
b/manifests/role/analytics/burrow.pp
new file mode 100644
index 0000000..c4e07fc
--- /dev/null
+++ b/manifests/role/analytics/burrow.pp
@@ -0,0 +1,20 @@
+# == role/analytics/burrow.pp
+# Role classes for burrow, a consumer offset lag monitoring tool
+# for Kafka
+class role::analytics::burrow {
+
+    # Include the kafka config role to get all configuration data
+    include role::analytics::kafka::config
+
+    # One of the params for Class: burrow is consumer_groups, this is 
configured
+    # through hiera and hence not explicitly passed here
+    class { '::burrow':
+        zookeeper_hosts    => $role::analytics::kafka::config::zookeeper_hosts,
+        zookeeper_path     => 
$role::analytics::kafka::config::zookeeper_chroot,
+        kafka_cluster_name => 
$role::analytics::kafka::config::kafka_cluster_name,
+        kafka_brokers      => $role::analytics::kafka::config::brokers_array,
+        smtp_server        => 'polonium.wikimedia.org',
+        from_email         => "burrow@${::fqdn}",
+        to_emails          => '[email protected], [email protected]',
+    }
+}
diff --git a/manifests/site.pp b/manifests/site.pp
index 159654a..90ec840 100644
--- a/manifests/site.pp
+++ b/manifests/site.pp
@@ -1176,7 +1176,10 @@
 
 # virtual machine for misc. PHP apps
 node 'krypton.eqiad.wmnet' {
-    role wikimania_scholarships, iegreview, grafana, gdash
+    # analytics::burrow is a Kafka consumer lag monitor.
+    # Running this here because krypton is a 'misc' Jessie
+    # monitoring host.
+    role wikimania_scholarships, iegreview, grafana, gdash, analytics::burrow
     include standard
 }
 
diff --git a/modules/burrow/manifests/init.pp b/modules/burrow/manifests/init.pp
new file mode 100644
index 0000000..5add01d
--- /dev/null
+++ b/modules/burrow/manifests/init.pp
@@ -0,0 +1,44 @@
+# == Define Class: burrow
+# Burrow is a consumer offset lag monitoring tool for Kakfa
+# This module helps set up a burrow service that provides a
+# http endpoint to query, and will email notifications on
+# consumer groups statuses.
+#
+# == Parameters
+# $client_id          - The client ID string to provide to Kafka when consuming
+# $httpserver_port    - Port at which to make the burrow http endpoint 
available
+# $zookeeper_hosts    - Array of zookeeper host urls
+# $zookeeper_path     - The full path to the znode that is the root for the 
Kafka cluster
+# $kafka_cluster_name - Name of the Kafka cluster
+# $kafka_brokers      - Array of kafka broker urls
+# $consumer_groups    - Consumer groups to be monitored to get email 
notifications
+# $smtp_server        - SMTP server to send emails from
+# $from_email         - From email address for notification
+# $to_email           - Comma separated email addresses to send email 
notification to
+
+class burrow (
+    $ensure = 'present',
+    $client_id = 'burrow-client',
+    $httpserver_port = 8000,
+    $zookeeper_hosts,
+    $zookeeper_path,
+    $kafka_cluster_name,
+    $kafka_brokers,
+    $consumer_groups,
+    $smtp_server,
+    $from_email,
+    $to_emails,
+)
+{
+    require_package('burrow')
+
+    file { "/etc/burrow/burrow.cfg":
+        ensure  => $ensure,
+        content => template('burrow/burrow.cfg.erb'),
+    }
+
+    service { 'burrow':
+        ensure => ensure_service($ensure),
+        enable => true,
+    }
+}
diff --git a/modules/burrow/templates/burrow.cfg.erb 
b/modules/burrow/templates/burrow.cfg.erb
new file mode 100644
index 0000000..db769a1
--- /dev/null
+++ b/modules/burrow/templates/burrow.cfg.erb
@@ -0,0 +1,49 @@
+[general]
+logdir=/var/log/burrow
+logconfig=/etc/burrow/logging.cfg
+pidfile=burrow.pid
+client-id=<%= @client_id %>
+group-blacklist=^(console-consumer-|python-kafka-consumer-).*$
+
+[zookeeper]
+<% @zookeeper_hosts.each do |host| -%>
+    hostname=<%= host %>
+<% end -%>
+port=2181
+timeout=6
+lock-path=/etc/burrow/notifier
+
+[kafka "<%= @kafka_cluster_name %>"]
+<% @kafka_brokers.each do |host| -%>
+    broker=<%= host %>
+<% end -%>
+broker-port=9092
+<% @zookeeper_hosts.each do |host| -%>
+    zookeeper=<%= host %>
+<% end -%>
+zookeeper-port=2181
+zookeeper-path=<%= @zookeeper_path %>
+offsets-topic=__consumer_offsets
+
+[tickers]
+broker-offsets=60
+
+[lagcheck]
+intervals=10
+expire-group=604800
+
+[httpserver]
+server=on
+port=<%= @httpserver_port %>
+
+[smtp]
+server=<%= @smtp_server %>
+port=25
+from=<%= @from_email %>
+template=/etc/burrow/default-email.tmpl
+
+[email "<%= @to_emails %>"]
+<% @consumer_groups.each do |group| -%>
+    group=<%= @kafka_cluster_name %>,<%= group %>
+<% end -%>
+interval=120

-- 
To view, visit https://gerrit.wikimedia.org/r/248079
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: Iaf6b2ee804df8f5e951fc7ced770b2565e3adb65
Gerrit-PatchSet: 16
Gerrit-Project: operations/puppet
Gerrit-Branch: production
Gerrit-Owner: Madhuvishy <[email protected]>
Gerrit-Reviewer: Madhuvishy <[email protected]>
Gerrit-Reviewer: Ori.livneh <[email protected]>
Gerrit-Reviewer: Ottomata <[email protected]>
Gerrit-Reviewer: jenkins-bot <>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to