From 07526249a70302bd4ca1472e58071ae4ea0ccd4e Mon Sep 17 00:00:00 2001 From: Swann Croiset Date: Thu, 6 Oct 2016 16:04:00 +0200 Subject: [PATCH] Rename AFD and GSE alerting attributes Depends-On: I30b16d7ef159242f9984b54a8ae344fbf6560314 Change-Id: I7f141fb04edd4a1837f188347d2bf478fe5241c6 --- deployment_scripts/puppet/manifests/nagios.pp | 12 ++++++------ .../parser/functions/afds_to_nagios_services.rb | 6 ++---- .../spec/functions/afds_to_nagios_services_spec.rb | 12 ++++++------ 3 files changed, 14 insertions(+), 16 deletions(-) diff --git a/deployment_scripts/puppet/manifests/nagios.pp b/deployment_scripts/puppet/manifests/nagios.pp index a6bd7c7..d8690dc 100644 --- a/deployment_scripts/puppet/manifests/nagios.pp +++ b/deployment_scripts/puppet/manifests/nagios.pp @@ -57,22 +57,22 @@ $tls_enabled = $nagios_ui['tls_enabled'] $lma_collector = hiera_hash('lma_collector', {}) -if $lma_collector['gse_cluster_global'] and $lma_collector['gse_cluster_global']['activate_alerting'] { +if $lma_collector['gse_cluster_global'] and $lma_collector['gse_cluster_global']['alerting'] != 'disabled' { $global_clusters = keys($lma_collector['gse_cluster_global']['clusters']) - $notification_for_global_clusters = $lma_collector['gse_cluster_global']['enable_notification'] + $notification_for_global_clusters = $lma_collector['gse_cluster_global']['alerting'] == 'enabled_with_notification' }else{ $global_clusters = [] } -if $lma_collector['gse_cluster_node'] and $lma_collector['gse_cluster_node']['activate_alerting'] { +if $lma_collector['gse_cluster_node'] and $lma_collector['gse_cluster_node']['alerting'] != 'disabled' { $node_clusters = keys($lma_collector['gse_cluster_node']['clusters']) - $notification_for_node_clusters = $lma_collector['gse_cluster_node']['enable_notification'] + $notification_for_node_clusters = $lma_collector['gse_cluster_node']['alerting'] == 'enabled_with_notification' }else{ $node_clusters = [] } -if $lma_collector['gse_cluster_service'] and $lma_collector['gse_cluster_service']['activate_alerting'] { +if $lma_collector['gse_cluster_service'] and $lma_collector['gse_cluster_service']['alerting'] != 'disabled' { $service_clusters = keys($lma_collector['gse_cluster_service']['clusters']) - $notification_for_service_clusters = $lma_collector['gse_cluster_service']['enable_notification'] + $notification_for_service_clusters = $lma_collector['gse_cluster_service']['alerting'] == 'enabled_with_notification' }else{ $service_clusters = [] } diff --git a/deployment_scripts/puppet/modules/lma_infra_alerting/lib/puppet/parser/functions/afds_to_nagios_services.rb b/deployment_scripts/puppet/modules/lma_infra_alerting/lib/puppet/parser/functions/afds_to_nagios_services.rb index e48ea88..b1652c8 100644 --- a/deployment_scripts/puppet/modules/lma_infra_alerting/lib/puppet/parser/functions/afds_to_nagios_services.rb +++ b/deployment_scripts/puppet/modules/lma_infra_alerting/lib/puppet/parser/functions/afds_to_nagios_services.rb @@ -80,16 +80,14 @@ Would return: afds_map = afds.select {|c, a| a.has_key?('apply_to_node') and a['apply_to_node'] == cluster} afds_map.each do |logical_cluster, a| node_services = {} - if not a.has_key?('activate_alerting') - configure=true - elsif a['activate_alerting'] == true + if a.has_key?('alerting') and a['alerting'] != 'disabled' configure=true else configure=false end if configure - if a.has_key?('enable_notification') and a['enable_notification'] == true + if a['alerting'] == 'enabled_with_notification' notifications_enabled = 1 end a['alarms'].keys.each do |source| diff --git a/deployment_scripts/puppet/modules/lma_infra_alerting/spec/functions/afds_to_nagios_services_spec.rb b/deployment_scripts/puppet/modules/lma_infra_alerting/spec/functions/afds_to_nagios_services_spec.rb index a8a22be..cab639f 100644 --- a/deployment_scripts/puppet/modules/lma_infra_alerting/spec/functions/afds_to_nagios_services_spec.rb +++ b/deployment_scripts/puppet/modules/lma_infra_alerting/spec/functions/afds_to_nagios_services_spec.rb @@ -90,7 +90,7 @@ describe 'afds_to_nagios_services' do afds = { "controller" => { "apply_to_node" => "controller", - "enable_notification" => true, + "alerting" => "enabled_with_notification", "alarms" => { "system-ctrl" => ["cpu-critical-controller", "cpu-warning-controller"], "fs" => ["fs-critical", "fs-warning"] @@ -98,7 +98,7 @@ describe 'afds_to_nagios_services' do }, "compute" => { "apply_to_node" => "compute", - "enable_notification" => true, + "alerting" => "enabled_with_notification", "alarms" => { "system-compute" => ["cpu-critical-compute", "cpu-warning-compute"], "fs" => ["fs-critical", "fs-critical-compute", "fs-warning"] @@ -106,7 +106,7 @@ describe 'afds_to_nagios_services' do }, "storage" => { "apply_to_node" => "storage", - "enable_notification" => true, + "alerting" => "enabled_with_notification", "alarms" => { "system-storage" => ["cpu-critical-storage", "cpu-warning-storage"], "fs" => ["fs-critical-storage", "fs-warning-storage"] @@ -114,7 +114,7 @@ describe 'afds_to_nagios_services' do }, "elasticsearch-cluster" => { "apply_to_node" => "elasticsearch", - "activate_alerting" => true, + "alerting" => "enabled", "alarms" => { "cpu" => ["cpu-critical-es"], "fs" => ["fs-critical-es", "fs-warning-es"] @@ -122,7 +122,7 @@ describe 'afds_to_nagios_services' do }, "default" => { "apply_to_node" => "default", - "activate_alerting" => true, + "alerting" => "enabled", "alarms" => { "cpu" => ["cpu-critical-default"], "fs" => ["fs-critical", "fs-warning"] @@ -130,7 +130,7 @@ describe 'afds_to_nagios_services' do }, "bar-cluster" => { "apply_to_node" => "bar", - "activate_alerting" => false, + "alerting" => "disabled", "alarms" => { "cpu" => ["cpu-critical-default"], "fs" => ["fs-critical", "fs-warning"]