Elukey has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/394045 )

Change subject: [WIP] profile::hadoop::common: add Prometheus JMX exporter 
configuration
......................................................................

[WIP] profile::hadoop::common: add Prometheus JMX exporter configuration

Bug: T177458
Change-Id: Ida0f54b30a5d12210fb990a2bd36f51ce38fd981
---
M hieradata/common/profile/hadoop/common.yaml
A modules/profile/files/hadoop/prometheus_hdfs_datanode_jmx_exporter.yaml
M modules/profile/manifests/hadoop/common.pp
A modules/profile/manifests/hadoop/monitoring/datanode.pp
4 files changed, 36 insertions(+), 1 deletion(-)


  git pull ssh://gerrit.wikimedia.org:29418/operations/puppet 
refs/changes/45/394045/1

diff --git a/hieradata/common/profile/hadoop/common.yaml 
b/hieradata/common/profile/hadoop/common.yaml
index 15a2b37..3299c50 100644
--- a/hieradata/common/profile/hadoop/common.yaml
+++ b/hieradata/common/profile/hadoop/common.yaml
@@ -33,3 +33,5 @@
     - /var/lib/hadoop/data/k
     - /var/lib/hadoop/data/l
     - /var/lib/hadoop/data/m
+
+profile::hadoop::common::monitoring_enabled: true
diff --git 
a/modules/profile/files/hadoop/prometheus_hdfs_datanode_jmx_exporter.yaml 
b/modules/profile/files/hadoop/prometheus_hdfs_datanode_jmx_exporter.yaml
new file mode 100644
index 0000000..73530b2
--- /dev/null
+++ b/modules/profile/files/hadoop/prometheus_hdfs_datanode_jmx_exporter.yaml
@@ -0,0 +1,3 @@
+---
+lowercaseOutputLabelNames: true
+lowercaseOutputName: false
\ No newline at end of file
diff --git a/modules/profile/manifests/hadoop/common.pp 
b/modules/profile/manifests/hadoop/common.pp
index 7629982..c05041a 100644
--- a/modules/profile/manifests/hadoop/common.pp
+++ b/modules/profile/manifests/hadoop/common.pp
@@ -108,6 +108,9 @@
 #  [*yarn_scheduler_maximum_allocation_vcores*]
 #    Yarn scheduler specific setting. Default: 32
 #
+#  [*monitoring_enabled*]
+#    Configure the Prometheus jmx exporter for all the JVM daemons.
+#
 class profile::hadoop::common (
     $zookeeper_clusters                       = hiera('zookeeper_clusters'),
     $zookeeper_cluster_name                   = 
hiera('profile::hadoop::common::zookeeper_cluster_name'),
@@ -137,6 +140,7 @@
     $yarn_scheduler_maximum_allocation_mb     = 
hiera('profile::hadoop::common::yarn_scheduler_maximum_allocation_mb', 57344),
     $yarn_scheduler_minimum_allocation_vcores = 
hiera('profile::hadoop::common::yarn_scheduler_minimum_allocation_vcores', 0),
     $yarn_scheduler_maximum_allocation_vcores = 
hiera('profile::hadoop::common::yarn_scheduler_maximum_allocation_vcores', 32),
+    $monitoring_enabled                       = 
hiera('profile::hadoop::common::monitoring_enabled'),
 ) {
     # Include Wikimedia's thirdparty/cloudera apt component
     # as an apt source on all Hadoop hosts.  This is needed
@@ -158,6 +162,14 @@
 
     $zookeeper_hosts = 
keys($zookeeper_clusters[$zookeeper_cluster_name]['hosts'])
 
+
+    if $monitoring_enabled {
+        include ::profile::hadoop::monitoring::datanode
+        $hadoop_datanode_opts_prometheus = 
$::profile::hadoop::monitoring::datanode::java_opts
+    } else {
+        $hadoop_datanode_opts_prometheus = ''
+    }
+
     class { '::cdh::hadoop':
         # Default to using running resourcemanager on the same hosts
         # as the namenodes.
@@ -178,7 +190,7 @@
         yarn_nodemanager_opts                       => $yarn_nodemanager_opts,
         yarn_resourcemanager_opts                   => 
$yarn_resourcemanager_opts,
         hadoop_namenode_opts                        => $hadoop_namenode_opts,
-        hadoop_datanode_opts                        => $hadoop_datanode_opts,
+        hadoop_datanode_opts                        => 
"${hadoop_datanode_opts} ${hadoop_datanode_opts_prometheus}",
         mapreduce_history_java_opts                 => 
$mapreduce_history_java_opts,
 
         yarn_app_mapreduce_am_resource_mb           => 
$yarn_app_mapreduce_am_resource_mb,
diff --git a/modules/profile/manifests/hadoop/monitoring/datanode.pp 
b/modules/profile/manifests/hadoop/monitoring/datanode.pp
new file mode 100644
index 0000000..c3cbfa4
--- /dev/null
+++ b/modules/profile/manifests/hadoop/monitoring/datanode.pp
@@ -0,0 +1,18 @@
+# Class: profile::hadoop::monitoring::datanode
+#
+# Sets up Prometheus based monitoring for the Hadoop HDFS Datanode
+#
+class profile::hadoop::monitoring::datanode(
+    $prometheus_nodes        = hiera('prometheus_nodes'),
+) {
+    $jmx_exporter_config_file = 
'/etc/hadoop/prometheus_hdfs_datanode_jmx_exporter.yaml'
+    $prometheus_jmx_exporter_datanode_port = 51010
+    $java_opts = 
"-javaagent:/usr/share/java/prometheus/jmx_prometheus_javaagent.jar=${::ipaddress}:${prometheus_jmx_exporter_datanode_port}:${jmx_exporter_config_file}"
+    profile::prometheus::jmx_exporter { "hdfs_datanode_${::hostname}":
+        hostname         => $::hostname,
+        port             => $prometheus_jmx_exporter_datanode_port,
+        prometheus_nodes => $prometheus_nodes,
+        config_file      => $jmx_exporter_config_file,
+        source           => 
'puppet:///modules/profile/hadoop/prometheus_hdfs_datanode_jmx_exporter.yaml',
+    }
+}
\ No newline at end of file

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ida0f54b30a5d12210fb990a2bd36f51ce38fd981
Gerrit-PatchSet: 1
Gerrit-Project: operations/puppet
Gerrit-Branch: production
Gerrit-Owner: Elukey <ltosc...@wikimedia.org>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to