diff --git a/deployment_scripts/puppet/manifests/configure_afd_filters.pp b/deployment_scripts/puppet/manifests/configure_afd_filters.pp index 490c17e47..89c25751b 100644 --- a/deployment_scripts/puppet/manifests/configure_afd_filters.pp +++ b/deployment_scripts/puppet/manifests/configure_afd_filters.pp @@ -47,12 +47,25 @@ class { 'fuel_lma_collector::afds': # Forward AFD status to Nagios if deployed if hiera('lma::collector::infrastructure_alerting::server', false) { lma_collector::afd_nagios { 'nodes': - ensure => present, - hostname => $::hostname, - server => hiera('lma::collector::infrastructure_alerting::server'), - http_port => hiera('lma::collector::infrastructure_alerting::http_port'), - http_path => hiera('lma::collector::infrastructure_alerting::http_path'), - user => hiera('lma::collector::infrastructure_alerting::user'), - password => hiera('lma::collector::infrastructure_alerting::password'), + ensure => present, + hostname => $::hostname, + server => hiera('lma::collector::infrastructure_alerting::server'), + http_port => hiera('lma::collector::infrastructure_alerting::http_port'), + http_path => hiera('lma::collector::infrastructure_alerting::http_path'), + user => hiera('lma::collector::infrastructure_alerting::user'), + password => hiera('lma::collector::infrastructure_alerting::password'), + service_template => '%{node_role}.%{source}', + message_type => 'afd_node_metric', + } + lma_collector::afd_nagios { 'services': + ensure => present, + hostname => $::hostname, + server => hiera('lma::collector::infrastructure_alerting::server'), + http_port => hiera('lma::collector::infrastructure_alerting::http_port'), + http_path => hiera('lma::collector::infrastructure_alerting::http_path'), + user => hiera('lma::collector::infrastructure_alerting::user'), + password => hiera('lma::collector::infrastructure_alerting::password'), + service_template => '%{service}.%{source}', + message_type => 'afd_service_metric', } } diff --git a/deployment_scripts/puppet/modules/lma_collector/files/plugins/common/afd.lua b/deployment_scripts/puppet/modules/lma_collector/files/plugins/common/afd.lua index 47ee250ff..29d52d7c6 100644 --- a/deployment_scripts/puppet/modules/lma_collector/files/plugins/common/afd.lua +++ b/deployment_scripts/puppet/modules/lma_collector/files/plugins/common/afd.lua @@ -130,7 +130,7 @@ end -- inject an AFD event into the Heka pipeline function inject_afd_metric(msg_type, msg_tag_name, msg_tag_value, metric_name, - value, hostname, interval, source) + value, hostname, interval, source, to_alerting) local payload if #alarms > 0 then @@ -144,6 +144,11 @@ function inject_afd_metric(msg_type, msg_tag_name, msg_tag_value, metric_name, 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, @@ -154,6 +159,7 @@ function inject_afd_metric(msg_type, msg_tag_name, msg_tag_value, metric_name, interval=interval, source=source, tag_fields={msg_tag_name, 'source'}, + no_alerting = no_alerting, } } msg.Fields[msg_tag_name] = msg_tag_value, diff --git a/deployment_scripts/puppet/modules/lma_collector/files/plugins/filters/afd.lua b/deployment_scripts/puppet/modules/lma_collector/files/plugins/filters/afd.lua index 6a7628807..bf1032261 100644 --- a/deployment_scripts/puppet/modules/lma_collector/files/plugins/filters/afd.lua +++ b/deployment_scripts/puppet/modules/lma_collector/files/plugins/filters/afd.lua @@ -19,6 +19,7 @@ local afd = require 'afd' -- node or service local afd_type = read_config('afd_type') or error('afd_type must be specified!') +local activate_alerting = read_config('activate_alerting') or true local msg_type local msg_field_name local afd_entity @@ -90,7 +91,7 @@ function timer_event(ns) end afd.inject_afd_metric(msg_type, afd_entity, afd_entity_value, msg_field_name, - state, hostname, interval, msg_field_source) + state, hostname, interval, msg_field_source, activate_alerting) end else A.set_start_time(ns) diff --git a/deployment_scripts/puppet/modules/lma_collector/manifests/afd_nagios.pp b/deployment_scripts/puppet/modules/lma_collector/manifests/afd_nagios.pp index e51650280..342334a40 100644 --- a/deployment_scripts/puppet/modules/lma_collector/manifests/afd_nagios.pp +++ b/deployment_scripts/puppet/modules/lma_collector/manifests/afd_nagios.pp @@ -42,11 +42,15 @@ define lma_collector::afd_nagios( notify => Class['lma_collector::service::metric'], } + $matcher = join(["Fields[${lma_collector::params::aggregator_flag}] == NIL", + "Type == 'heka.sandbox.${message_type}'", + 'Fields[no_alerting] == NIL'], ' && ') + heka::output::http { "nagios_afd_${title}": ensure => $ensure, config_dir => $lma_collector::params::metric_config_dir, url => $url, - message_matcher => "Fields[${lma_collector::params::aggregator_flag}] == NIL && Type == 'heka.sandbox.${message_type}'", + message_matcher => $matcher, username => $user, password => $password, encoder => "nagios_afd_${title}",