From cc5aadb474a8dc60cdef9248dd1e90f94318148f Mon Sep 17 00:00:00 2001 From: Swann Croiset Date: Tue, 13 Sep 2016 10:00:31 +0200 Subject: [PATCH] Do not send GSE to Nagios when activate_alerting=false DocImpact blueprint: alarming-refactoring Change-Id: Ie343672afd4a222a3d7f920182a0b2e90e1fd6de --- .../fuel_lma_collector/templates/clusters.yaml.erb | 6 ++++++ deployment_scripts/puppet/modules/lma_collector/README.md | 4 ++++ .../modules/lma_collector/files/plugins/common/gse.lua | 8 +++++++- .../files/plugins/filters/gse_cluster_filter.lua | 4 +++- .../modules/lma_collector/manifests/gse_cluster_filter.pp | 4 ++++ .../puppet/modules/lma_collector/manifests/gse_nagios.pp | 2 +- 6 files changed, 25 insertions(+), 3 deletions(-) diff --git a/deployment_scripts/puppet/modules/fuel_lma_collector/templates/clusters.yaml.erb b/deployment_scripts/puppet/modules/fuel_lma_collector/templates/clusters.yaml.erb index 8d1e6fbcd..08f29c408 100644 --- a/deployment_scripts/puppet/modules/fuel_lma_collector/templates/clusters.yaml.erb +++ b/deployment_scripts/puppet/modules/fuel_lma_collector/templates/clusters.yaml.erb @@ -115,6 +115,8 @@ lma_collector: output_metric_name: cluster_service_status interval: 10 warm_up_period: 20 + enable_notification: false + activate_alerting: true clusters: nova-logs: policy: highest_severity @@ -440,6 +442,8 @@ lma_collector: output_metric_name: cluster_node_status interval: 10 warm_up_period: 80 + enable_notification: false + activate_alerting: true clusters: controller: policy: majority_of_members @@ -536,6 +540,8 @@ lma_collector: output_metric_name: cluster_status interval: 10 warm_up_period: 30 + enable_notification: true + activate_alerting: true clusters: mysql: policy: highest_severity diff --git a/deployment_scripts/puppet/modules/lma_collector/README.md b/deployment_scripts/puppet/modules/lma_collector/README.md index 1ca334a41..840d3a70a 100644 --- a/deployment_scripts/puppet/modules/lma_collector/README.md +++ b/deployment_scripts/puppet/modules/lma_collector/README.md @@ -1097,6 +1097,10 @@ in Heka. * `warm_up_period`: *Optional*. Number of seconds after a (re)start that the GSE plugin will wait before emitting its metric messages. Valid options: an integer. Default: undef. +* `enable_notification`: *Optional*. Whether or not enable notifications in the + alerting system. Valid options: a boolean. Default: true. +* `activate_alerting`: *Optional*. Whether or not configure alerting system + for all clusters. Valid options: a boolean. Default: true. #### Define `lma_collector::gse_nagios` diff --git a/deployment_scripts/puppet/modules/lma_collector/files/plugins/common/gse.lua b/deployment_scripts/puppet/modules/lma_collector/files/plugins/common/gse.lua index ec56496fe..16bb95046 100644 --- a/deployment_scripts/puppet/modules/lma_collector/files/plugins/common/gse.lua +++ b/deployment_scripts/puppet/modules/lma_collector/files/plugins/common/gse.lua @@ -125,7 +125,7 @@ end -- compute the cluster metric and inject it into the Heka pipeline -- the metric's value is computed using the status of its members -function inject_cluster_metric(msg_type, cluster_name, metric_name, interval, source) +function inject_cluster_metric(msg_type, cluster_name, metric_name, interval, source, to_alerting) local payload local status, alarms = resolve_status(cluster_name) @@ -139,6 +139,11 @@ function inject_cluster_metric(msg_type, cluster_name, metric_name, interval, so payload = '{"alarms":[]}' end + local no_alerting + if to_alerting ~= nil and to_alerting == false then + no_alerting = true + end + local msg = { Type = msg_type, Payload = payload, @@ -149,6 +154,7 @@ function inject_cluster_metric(msg_type, cluster_name, metric_name, interval, so tag_fields={'cluster_name'}, interval=interval, source=source, + no_alerting=no_alerting, } } lma.inject_tags(msg) diff --git a/deployment_scripts/puppet/modules/lma_collector/files/plugins/filters/gse_cluster_filter.lua b/deployment_scripts/puppet/modules/lma_collector/files/plugins/filters/gse_cluster_filter.lua index 48d6d5696..6c8415fbb 100644 --- a/deployment_scripts/puppet/modules/lma_collector/files/plugins/filters/gse_cluster_filter.lua +++ b/deployment_scripts/puppet/modules/lma_collector/files/plugins/filters/gse_cluster_filter.lua @@ -29,6 +29,7 @@ local interval = (read_config('interval') or error('interval must be specified!' local interval_in_ns = interval * 1e9 local max_inject = (read_config('max_inject') or 10) + 0 local warm_up_period = ((read_config('warm_up_period') or 0) + 0) * 1e9 +local activate_alerting = read_config('activate_alerting') or true local is_active = false local first_tick @@ -122,7 +123,8 @@ function timer_event(ns) cluster_name, output_metric_name, interval, - source + source, + activate_alerting ) last_index = i injected = injected + 1 diff --git a/deployment_scripts/puppet/modules/lma_collector/manifests/gse_cluster_filter.pp b/deployment_scripts/puppet/modules/lma_collector/manifests/gse_cluster_filter.pp index a93149de1..d7ce5a647 100644 --- a/deployment_scripts/puppet/modules/lma_collector/manifests/gse_cluster_filter.pp +++ b/deployment_scripts/puppet/modules/lma_collector/manifests/gse_cluster_filter.pp @@ -21,6 +21,8 @@ define lma_collector::gse_cluster_filter ( $cluster_field = undef, $clusters = {}, $warm_up_period = undef, + $enable_notification = true, + $activate_alerting = true, $ensure = present, ) { include lma_collector::params @@ -66,6 +68,8 @@ define lma_collector::gse_cluster_filter ( member_field => $member_field, max_inject => $lma_collector::params::hekad_max_timer_inject, warm_up_period => $warm_up_period, + enable_notification => $enable_notification, + activate_alerting => $activate_alerting, }, module_directory => $lua_modules_dir, require => File[$topology_file], diff --git a/deployment_scripts/puppet/modules/lma_collector/manifests/gse_nagios.pp b/deployment_scripts/puppet/modules/lma_collector/manifests/gse_nagios.pp index 9e9af5924..88a63c726 100644 --- a/deployment_scripts/puppet/modules/lma_collector/manifests/gse_nagios.pp +++ b/deployment_scripts/puppet/modules/lma_collector/manifests/gse_nagios.pp @@ -50,7 +50,7 @@ define lma_collector::gse_nagios ( ensure => $ensure, config_dir => $lma_collector::params::metric_config_dir, url => $url, - message_matcher => "Type == 'heka.sandbox.${message_type}'", + message_matcher => "Type == 'heka.sandbox.${message_type}' && Fields[no_alerting] == NIL", username => $user, password => $password, encoder => "nagios_gse_${title}",