Rename AFD and GSE alerting attributes

Depends-On: I30b16d7ef159242f9984b54a8ae344fbf6560314

Change-Id: I7f141fb04edd4a1837f188347d2bf478fe5241c6
This commit is contained in:
Swann Croiset 2016-10-06 16:04:00 +02:00
parent 9f2f45af91
commit 07526249a7
3 changed files with 14 additions and 16 deletions

View File

@ -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 = []
}

View File

@ -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|

View File

@ -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"]