[MediaWiki-commits] [Gerrit] Adding define ganglia::view for abstracting ganglia web views. - change (operations/puppet)
Ottomata has submitted this change and it was merged. Change subject: Adding define ganglia::view for abstracting ganglia web views. .. Adding define ganglia::view for abstracting ganglia web views. Adding udp2log view on ganglia.wikimedia.org Change-Id: Ie3ab11316cf89e6ea1c6ec0edb2ea8a80947d9ab --- M manifests/ganglia.pp M manifests/misc/monitoring.pp M manifests/site.pp A templates/ganglia/ganglia_view.json.erb 4 files changed, 158 insertions(+), 1 deletion(-) Approvals: Ryan Lane: Looks good to me, approved Ottomata: Verified; Looks good to me, approved jenkins-bot: Verified diff --git a/manifests/ganglia.pp b/manifests/ganglia.pp index cf82867..a7110e5 100644 --- a/manifests/ganglia.pp +++ b/manifests/ganglia.pp @@ -412,6 +412,7 @@ $ganglia_servername = "ganglia.wmflabs.org" $ganglia_serveralias = "aggregator1.pmtpa.wmflabs" $ganglia_webdir = "/usr/share/ganglia-webfrontend" + $ganglia_confdir = "/var/lib/ganglia/conf" require ganglia::aggregator @@ -421,6 +422,9 @@ # TODO(ssmollett): when switching to ganglia-webfrontend # package, use /usr/share/ganglia-webfrontend $ganglia_webdir = "/srv/org/wikimedia/ganglia-web-3.5.4+security" + # Why is this set to a different directory than $ganglia_webdir??? + $ganglia_confdir = "/srv/org/ganglia_storage/3.5.1/conf" + $ganglia_ssl_cert = "/etc/ssl/certs/star.wikimedia.org.pem" $ganglia_ssl_key = "/etc/ssl/private/star.wikimedia.org.key" } @@ -538,3 +542,79 @@ } } + +# == Define ganlia::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 of 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: to /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 myhost 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 = 'locke|emery|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, + $template = 'ganglia/ganglia_view.json.erb') +{ + require ganglia::web + + # require ganglia::web + $view_name = $name + file { "${conf_dir}/view_${name}.json": + content => template($template), + } +} diff --git a/manifests/misc/monitoring.pp b/manifests/misc/monitoring.pp index d1ccbc8..4f8b9f1 100644 --- a/manifests/misc/monitoring.pp +++ b/manifests/misc/monitoring.pp @@ -40,4 +40,52 @@ source => "puppet:///files/ganglia/plugins/udp_stats.pyconf", notify => Service[gmond]; } +} + +# Ganglia views that should be +# avaliable on ganglia.wikimedia.org +class misc::monitoring::views { + require ganglia::web + + misc::monitoring::view::udp2log { 'udp2log': + host_regex => 'locke|emery|oxygen|gadolinium', + } +} + +# == Define misc:moni
[MediaWiki-commits] [Gerrit] Adding define ganglia::view for abstracting ganglia web views. - change (operations/puppet)
Ottomata has uploaded a new change for review. https://gerrit.wikimedia.org/r/56921 Change subject: Adding define ganglia::view for abstracting ganglia web views. .. Adding define ganglia::view for abstracting ganglia web views. Adding udp2log view on ganglia.wikimedia.org Change-Id: Ie3ab11316cf89e6ea1c6ec0edb2ea8a80947d9ab --- M manifests/ganglia.pp M manifests/misc/monitoring.pp M manifests/site.pp A templates/ganglia/ganglia_view.json.erb 4 files changed, 165 insertions(+), 1 deletion(-) git pull ssh://gerrit.wikimedia.org:29418/operations/puppet refs/changes/21/56921/1 diff --git a/manifests/ganglia.pp b/manifests/ganglia.pp index cf82867..cb1a713 100644 --- a/manifests/ganglia.pp +++ b/manifests/ganglia.pp @@ -538,3 +538,89 @@ } } + +# == Define ganlia::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 of 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: to /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 myhost 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 = 'locke|emery|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 = undef, + $template = 'ganglia/ganglia_view.json.erb') + +{ + if ($conf_dir != undef) { + $confdir = $conf_dir + } + else { + $confdir = $::realm ? { + 'production' => '/srv/org/ganglia_storage/3.5.1/conf', + 'labs' => '/var/lib/ganglia/conf', + default => '/var/lib/ganglia/conf', + } + } + + # require ganglia::web + $view_name = $name + file { "${confdir}/view_${name}.json": + content => template($template), + } +} diff --git a/manifests/misc/monitoring.pp b/manifests/misc/monitoring.pp index d1ccbc8..722d758 100644 --- a/manifests/misc/monitoring.pp +++ b/manifests/misc/monitoring.pp @@ -40,4 +40,53 @@ source => "puppet:///files/ganglia/plugins/udp_stats.pyconf", notify => Service[gmond]; } +} + +# Ganglia views that should be +# avaliable on ganglia.wikimedia.org +class misc::monitoring::views { + require ganglia::web + + misc::monitoring::view::udp2log { 'udp2log': + host_regex => 'locke|emery|oxygen|gadolinium', + } +} + +# == Define misc:monitoring::view::udp2log +# Installs a ganglia::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. +# $conf_dir +# +define misc::monitoring::view::udp2log($host_regex, $conf_dir = undef) { + ganglia::view { $name: + graphs => [ + { + 'host_regex' => $host_regex, +