Alexandros Kosiaris has submitted this change and it was merged.

Change subject: Migrate to ganglia_new::web::view
......................................................................


Migrate to ganglia_new::web::view

One more step towards deprecating ganglia.pp. Delete the old definition
and create a new one with tests and simplified calling
Use this to enable the misc::monitoring::views class inclusion on
uranium that was disabled in d7ae62d

Change-Id: I498c2849eb1872ba0394d8f40050526dfe82a78c
---
M manifests/ganglia.pp
M manifests/misc/monitoring.pp
M manifests/site.pp
M modules/ganglia_new/manifests/web.pp
A modules/ganglia_new/manifests/web/view.pp
R modules/ganglia_new/templates/ganglia_view.json.erb
A modules/ganglia_new/tests/view.pp
7 files changed, 116 insertions(+), 99 deletions(-)

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



diff --git a/manifests/ganglia.pp b/manifests/ganglia.pp
index 1701b3c..5edd4d1 100644
--- a/manifests/ganglia.pp
+++ b/manifests/ganglia.pp
@@ -625,90 +625,6 @@
 }
 
 
-# == Define ganglia::view
-# Defines a Ganglia view JSON file.
-# See 
http://sourceforge.net/apps/trac/ganglia/wiki/ganglia-web-2#JSONdefinitionforviews
-# for documentation on Ganglia view JSON format.
-#
-# == Parameters:
-# $graphs       - Shortcut for describing items that represent 
aggregate_graphs.
-# $items        - Should match exactly the JSON structure expected by Ganglia 
for views.
-# $view_type    - If you are using aggregate_graphs, this must be set to 
'standard'.
-#                 'regex' will allow you to use non-aggregate graphs and match 
hostnames by regex.
-#                 Default: 'standard'.
-# $default_size - Default size for graphs.  Default: 'large'.
-# $conf_dir     - Path to directory where ganglia view JSON files should live.
-#                 Defaults to the appropriate directory based on WMF $::realm. 
 Default: /var/lib/ganglia/conf.
-# $template     - The ERB template to use for the JSON file.  Only change this 
if you need to do fancier things than this define allows.
-#
-# == Examples:
-# # A 'regex' (non-aggregate graph) view:
-# # Note that no aggregate_graphs are used.
-# # This will add 4 graphs to the 'cpu' view.
-# # (i.e. cpu_user and cpu_system for each myhost0 and myhost1)
-# $host_regex = 'myhost[01]'
-# ganglia::view { 'cpu':
-#   view_type => 'regex',
-#   items     => [
-#     {
-#       'metric'   => 'cpu_user',
-#       'hostname' => $host_regex,
-#     }
-#     {
-#       'metric'   => 'cpu_system',
-#       'hostname' => $host_regex,
-#     }
-#   ],
-# }
-#
-#
-# # Use the $graphs parameter to describe aggregate graphs.
-# # You can describe the same graphs to add with $items.
-# # $graphs is just a shortcut.  aggregate_graphs in $items
-# # are a bit overly verbose.
-# $host_regex = 'erbium|oxygen|gadolinium'
-# ganglia::view { 'udp2log':
-#   graphs => [
-#     {
-#       'host_regex'   => $host_regex,
-#       'metric_regex' => 'packet_loss_average',
-#     }
-#     {
-#       'host_regex'   => $host_regex,
-#       'metric_regex' => 'drops',
-#     }
-#     {
-#       'host_regex'   => $host_regex,
-#       'metric_regex' => 'packet_loss_90th',
-#     }
-#   ],
-# }
-#
-define ganglia::view(
-    $graphs       = [],
-    $items        = [],
-    $view_type    = 'standard',
-    $default_size = 'large',
-    $conf_dir     = "${ganglia::web::ganglia_confdir}/conf",
-    $template     = 'ganglia/ganglia_view.json.erb',
-    $description  = undef,
-    $ensure       = 'present'
-)
-{
-    require ganglia::web
-
-    # require ganglia::web
-    if $description {
-        $view_name = $description
-    } else {
-        $view_name = $name
-    }
-    file { "${conf_dir}/view_${name}.json":
-        ensure  => $ensure,
-        content => template($template),
-    }
-}
-
 # == Define ganglia::plugin::python
 #
 # Installs a Ganglia python plugin
diff --git a/manifests/misc/monitoring.pp b/manifests/misc/monitoring.pp
index b333799..375a5d3 100644
--- a/manifests/misc/monitoring.pp
+++ b/manifests/misc/monitoring.pp
@@ -67,7 +67,6 @@
 # Ganglia views that should be
 # avaliable on ganglia.wikimedia.org
 class misc::monitoring::views {
-    require ganglia::web
     include role::analytics::kafka::config
 
     misc::monitoring::view::udp2log { 'udp2log':
@@ -99,7 +98,7 @@
     $auth_dns_host_regex = '^(rubidium|baham|eeden.esams).wikimedia.org$'
     $rec_dns_host_regex = '^(chromium|hydrogen).wikimedia.org$'
 
-    ganglia::view { 'authoritative_dns':
+    ganglia_new::web::view { 'authoritative_dns':
         ensure      => 'present',
         description => 'DNS Authoritative',
         graphs      => [
@@ -142,7 +141,7 @@
         ]
     }
 
-    ganglia::view { 'recursive_dns':
+    ganglia_new::web::view { 'recursive_dns':
         ensure      => 'present',
         description => 'DNS Recursive',
         graphs      => [
@@ -193,16 +192,16 @@
 }
 
 # == Define misc:monitoring::view::udp2log
-# Installs a ganglia::view for a group of nodes
+# Installs a ganglia_new::web::view for a group of nodes
 # running udp2log.  This is just a wrapper for
 # udp2log specific metrics to include in udp2log
 # ganglia views.
 #
 # == Parameters:
-# $host_regex - regex to pass to ganglia::view for matching host names in the 
view.
+# $host_regex - regex to pass to ganglia_new::web::view for matching host 
names in the view.
 #
 define misc::monitoring::view::udp2log($host_regex, $ensure = 'present') {
-    ganglia::view { $name:
+    ganglia_new::web::view { $name:
         ensure => $ensure,
         graphs => [
             {
@@ -258,7 +257,7 @@
 
 
 # == Define misc:monitoring::view::kafka
-# Installs a ganglia::view for a group of nodes
+# Installs a ganglia_new::web::view for a group of nodes
 # running kafka broker servers.  This is just a wrapper for
 # kafka specific metrics to include in kafka
 #
@@ -267,7 +266,7 @@
 # $log_disk_regex            - regex matching disks that have Kafka log 
directories
 #
 define misc::monitoring::view::kafka($kafka_broker_host_regex, 
$kafka_log_disks_regex = '.+', $ensure = 'present') {
-    ganglia::view { $name:
+    ganglia_new::web::view { $name:
         ensure => $ensure,
         graphs => [
             # Messages In
@@ -374,7 +373,7 @@
 # == Define misc::monitoring::view::varnishkafka
 #
 define misc::monitoring::view::varnishkafka($varnishkafka_host_regex = 
'(amssq|cp).+', $topic_regex = '.+', $ensure = 'present') {
-    ganglia::view { "varnishkafka-${title}":
+    ganglia_new::web::view { "varnishkafka-${title}":
         ensure => $ensure,
         graphs => [
             # delivery report error rate
@@ -452,7 +451,7 @@
 # == Class misc::monitoring::view::kafkatee
 #
 class misc::monitoring::view::kafkatee($kafkatee_host_regex, $topic_regex = 
'.+', $ensure = 'present') {
-    ganglia::view { 'kafkatee':
+    ganglia_new::web::view { 'kafkatee':
         ensure => $ensure,
         graphs => [
             # receive transctions per second rate
@@ -488,7 +487,7 @@
 # == Class misc::monitoring::view::hadoop
 #
 class misc::monitoring::view::hadoop($master, $worker_regex, $ensure = 
'present') {
-    ganglia::view { 'hadoop':
+    ganglia_new::web::view { 'hadoop':
         ensure => $ensure,
         graphs => [
             # ResourceManager active applications
@@ -589,7 +588,7 @@
 # $kafka_producer_host_regex - regex matching kafka producer hosts, this is 
the same as upd2log hosts
 #
 class misc::monitoring::view::analytics::data($hdfs_stat_host, 
$kafka_broker_host_regex, $kafka_producer_host_regex, $ensure = 'present') {
-    ganglia::view { 'analytics-data':
+    ganglia_new::web::view { 'analytics-data':
         ensure => $ensure,
         graphs => [
             {
diff --git a/manifests/site.pp b/manifests/site.pp
index e990fe8..54264b3 100644
--- a/manifests/site.pp
+++ b/manifests/site.pp
@@ -2885,8 +2885,7 @@
     include standard
     include admin
     include role::ganglia::web
-    # TODO: Resolve this
-    #include misc::monitoring::views
+    include misc::monitoring::views
 
     interface::add_ip6_mapped { 'main':
         interface => 'eth0',
diff --git a/modules/ganglia_new/manifests/web.pp 
b/modules/ganglia_new/manifests/web.pp
index c3c8e6b..f9d628e 100644
--- a/modules/ganglia_new/manifests/web.pp
+++ b/modules/ganglia_new/manifests/web.pp
@@ -12,7 +12,6 @@
     $ganglia_servername = 'ganglia.wikimedia.org'
     $ganglia_serveralias = 'uranium.wikimedia.org'
     $ganglia_webdir = '/usr/share/ganglia-webfrontend'
-    $ganglia_confdir = '/var/lib/ganglia-web'
     $ganglia_ssl_cert = '/etc/ssl/certs/ganglia.wikimedia.org.pem'
     $ganglia_ssl_key = '/etc/ssl/private/ganglia.wikimedia.org.key'
     $ssl_settings = ssl_ciphersuite('apache-2.2', 'compat')
diff --git a/modules/ganglia_new/manifests/web/view.pp 
b/modules/ganglia_new/manifests/web/view.pp
new file mode 100644
index 0000000..e0b1fce
--- /dev/null
+++ b/modules/ganglia_new/manifests/web/view.pp
@@ -0,0 +1,79 @@
+# == Define ganglia_new::web::view
+# Defines a Ganglia view JSON file.
+# See 
http://sourceforge.net/apps/trac/ganglia/wiki/ganglia-web-2#JSONdefinitionforviews
+# for documentation on Ganglia view JSON format.
+#
+# == Parameters:
+# $graphs       - Shortcut for describing items that represent 
aggregate_graphs.
+# $items        - Should match exactly the JSON structure expected by Ganglia 
for views.
+# $view_type    - If you are using aggregate_graphs, this must be set to 
'standard'.
+#                 'regex' will allow you to use non-aggregate graphs and match 
hostnames by regex.
+#                 Default: 'standard'.
+# $default_size - Default size for graphs.  Default: 'large'.
+# $conf_dir     - Path to directory where ganglia view JSON files should live.
+#                 Defaults to the appropriate directory based on WMF $::realm. 
 Default: /var/lib/ganglia/conf.
+# $template     - The ERB template to use for the JSON file.  Only change this 
if you need to do fancier things than this define allows.
+#
+# == Examples:
+# # A 'regex' (non-aggregate graph) view:
+# # Note that no aggregate_graphs are used.
+# # This will add 4 graphs to the 'cpu' view.
+# # (i.e. cpu_user and cpu_system for each myhost0 and myhost1)
+# $host_regex = 'myhost[01]'
+# ganglia::view { 'cpu':
+#   view_type => 'regex',
+#   items     => [
+#     {
+#       'metric'   => 'cpu_user',
+#       'hostname' => $host_regex,
+#     }
+#     {
+#       'metric'   => 'cpu_system',
+#       'hostname' => $host_regex,
+#     }
+#   ],
+# }
+#
+#
+# # Use the $graphs parameter to describe aggregate graphs.
+# # You can describe the same graphs to add with $items.
+# # $graphs is just a shortcut.  aggregate_graphs in $items
+# # are a bit overly verbose.
+# $host_regex = 'erbium|oxygen|gadolinium'
+# ganglia::view { 'udp2log':
+#   graphs => [
+#     {
+#       'host_regex'   => $host_regex,
+#       'metric_regex' => 'packet_loss_average',
+#     }
+#     {
+#       'host_regex'   => $host_regex,
+#       'metric_regex' => 'drops',
+#     }
+#     {
+#       'host_regex'   => $host_regex,
+#       'metric_regex' => 'packet_loss_90th',
+#     }
+#   ],
+# }
+#
+define ganglia_new::web::view(
+    $graphs       = [],
+    $items        = [],
+    $view_type    = 'standard',
+    $default_size = 'large',
+    $conf_dir     = '/var/lib/ganglia-web/conf',
+    $description  = undef,
+    $ensure       = 'present'
+)
+{
+    if $description {
+        $view_name = $description
+    } else {
+        $view_name = $name
+    }
+    file { "${conf_dir}/view_${name}.json":
+        ensure  => $ensure,
+        content => template('ganglia_new/ganglia_view.json.erb'),
+    }
+}
diff --git a/templates/ganglia/ganglia_view.json.erb 
b/modules/ganglia_new/templates/ganglia_view.json.erb
similarity index 100%
rename from templates/ganglia/ganglia_view.json.erb
rename to modules/ganglia_new/templates/ganglia_view.json.erb
diff --git a/modules/ganglia_new/tests/view.pp 
b/modules/ganglia_new/tests/view.pp
new file mode 100644
index 0000000..30d1c41
--- /dev/null
+++ b/modules/ganglia_new/tests/view.pp
@@ -0,0 +1,25 @@
+#
+
+ganglia_new::web::view { 'kafkatee':
+    ensure => 'present',
+    graphs => [
+        # receive transctions per second rate
+        {
+            'host_regex'   => 'nosuchhost',
+            'metric_regex' => 'kafka.rdkafka.brokers..+\.rx\.per_second',
+            'type'         => 'stack',
+        },
+        # receive bytes per second rate
+        {
+            'host_regex'   => 'nosuchhost',
+            'metric_regex' => 'kafka.rdkafka.brokers..+\.rxbytes\.per_second',
+            'type'         => 'stack',
+        },
+        # round trip time average
+        {
+            'host_regex'   => 'nosuchhost',
+            'metric_regex' => 'kafka.rdkafka.brokers..+\.rtt\.avg',
+            'type'         => 'line',
+        },
+    ],
+}

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I498c2849eb1872ba0394d8f40050526dfe82a78c
Gerrit-PatchSet: 2
Gerrit-Project: operations/puppet
Gerrit-Branch: production
Gerrit-Owner: Alexandros Kosiaris <[email protected]>
Gerrit-Reviewer: Alexandros Kosiaris <[email protected]>
Gerrit-Reviewer: jenkins-bot <>

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

Reply via email to