Do not send GSE to Nagios when activate_alerting=false

DocImpact
blueprint: alarming-refactoring

Change-Id: Ie343672afd4a222a3d7f920182a0b2e90e1fd6de
This commit is contained in:
Swann Croiset 2016-09-13 10:00:31 +02:00
parent 692cb46fbe
commit cc5aadb474
6 changed files with 25 additions and 3 deletions

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -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}",