Remove the SMTP standalone alerting_mode
This feature was broken and not stable enough for production deployment.
Related-bug: #1606831
Related-bug: #1643542
Change-Id: I0ce52ec01838d891c43d6e797617d3044a02d10f
(cherry picked from commit b7c7e7bdc2
)
This commit is contained in:
parent
4c287e5f9b
commit
dbb85ad2f9
@ -261,23 +261,9 @@ if hiera('lma::collector::influxdb::server', false) {
|
||||
class { 'lma_collector::logs::aggregated_http_metrics': }
|
||||
}
|
||||
|
||||
$alerting_mode = $lma_collector['alerting_mode']
|
||||
if hiera('lma::collector::infrastructure_alerting::server', false) {
|
||||
$deployment_id = hiera('deployment_id')
|
||||
|
||||
if $alerting_mode == 'standalone' {
|
||||
$subject = "LMA Alert Notification - environment ${deployment_id}"
|
||||
class { 'lma_collector::smtp_alert':
|
||||
send_from => $lma_collector['alerting_send_from'],
|
||||
send_to => [$lma_collector['alerting_send_to']],
|
||||
subject => $subject,
|
||||
host => $lma_collector['alerting_smtp_host'],
|
||||
auth => $lma_collector['alerting_smtp_auth'],
|
||||
user => $lma_collector['alerting_smtp_user'],
|
||||
password => $lma_collector['alerting_smtp_password'],
|
||||
}
|
||||
}
|
||||
|
||||
if hiera('lma::collector::infrastructure_alerting::server', false) {
|
||||
lma_collector::gse_nagios { 'global':
|
||||
openstack_deployment_name => $deployment_id,
|
||||
server => hiera('lma::collector::infrastructure_alerting::server'),
|
||||
|
@ -143,34 +143,26 @@ if ($plugin_data) {
|
||||
}
|
||||
}
|
||||
|
||||
if $plugin_data['alerting_mode'] {
|
||||
# Infrastructure Alerting
|
||||
$alerting_mode = $plugin_data['alerting_mode']
|
||||
$lma_infra_alerting = hiera('lma_infrastructure_alerting', {})
|
||||
$infra_alerting_nodes = get_nodes_hash_by_roles($network_metadata, ['infrastructure_alerting', 'primary-infrastructure_alerting'])
|
||||
$infra_alerting_nodes_count = count($infra_alerting_nodes)
|
||||
|
||||
case $alerting_mode {
|
||||
'local': {
|
||||
$infra_vip_name = 'infrastructure_alerting_mgmt_vip'
|
||||
if $network_metadata['vips'][$infra_vip_name] {
|
||||
$nagios_server = $network_metadata['vips'][$infra_vip_name]['ipaddr']
|
||||
} elsif $infra_alerting_nodes_count > 0 {
|
||||
$nagios_server = $infra_alerting_nodes[0]['internal_address']
|
||||
} else {
|
||||
$nagios_server = undef
|
||||
}
|
||||
$nagios_password = $lma_infra_alerting['nagios_password']
|
||||
}
|
||||
default: {
|
||||
fail("'${alerting_mode}' mode not supported for Nagios")
|
||||
}
|
||||
}
|
||||
|
||||
if $infra_alerting_nodes_count > 0 or $nagios_server {
|
||||
$nagios_is_deployed = true
|
||||
} else {
|
||||
$nagios_is_deployed = false
|
||||
}
|
||||
} else {
|
||||
$nagios_is_deployed = false
|
||||
}
|
||||
|
||||
$hiera_file = '/etc/hiera/plugins/lma_collector.yaml'
|
||||
|
||||
|
@ -1,44 +0,0 @@
|
||||
# Copyright 2015 Mirantis, Inc.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||
# not use this file except in compliance with the License. You may obtain
|
||||
# a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
#
|
||||
define heka::output::smtp (
|
||||
$config_dir,
|
||||
$send_from = undef,
|
||||
$send_to = [],
|
||||
$message_matcher = 'FALSE',
|
||||
$encoder = $title,
|
||||
$subject = '',
|
||||
$host = '127.0.0.1:25',
|
||||
$auth = 'none',
|
||||
$user = undef,
|
||||
$password = undef,
|
||||
$send_interval = 0,
|
||||
$ensure = present,
|
||||
) {
|
||||
|
||||
include heka::params
|
||||
if ( $auth != 'none' and $auth != 'Plain' and $auth != 'CRAMMD5'){
|
||||
fail('$auth parameter must be one of: none, Plain or CRAMMD5')
|
||||
}
|
||||
|
||||
validate_array($send_to)
|
||||
|
||||
file { "${config_dir}/output-${title}.toml":
|
||||
ensure => $ensure,
|
||||
content => template('heka/output/smtp.toml.erb'),
|
||||
mode => '0600',
|
||||
owner => $heka::params::user,
|
||||
group => $heka::params::user,
|
||||
}
|
||||
}
|
@ -451,7 +451,6 @@ Public Classes:
|
||||
* [`lma_collector::aggregator::server`](#class-lma_collectoraggregatorserver)
|
||||
* [`lma_collector::gse_policies`](#class-lma_collectorgse_policies)
|
||||
* [`lma_collector::metrics::heka_monitoring`](#class-lma_collectormetricsheka_monitoring)
|
||||
* [`lma_collector::smtp_alert`](#class-lma_collectorsmtp_alert)
|
||||
|
||||
Private Classes:
|
||||
|
||||
@ -894,26 +893,6 @@ Declare this class to collect metrics for the Heka services themselves.
|
||||
log collector listens on.
|
||||
Valid options: a string. Default: `4352`.
|
||||
|
||||
#### Class: `lma_collector::smtp_alert`
|
||||
|
||||
Declare this class to send by email the alert notifications based on the GSE
|
||||
metrics.
|
||||
|
||||
##### Parameters
|
||||
|
||||
* `send_from`: *Required*. Sender email address. Valid options: a string.
|
||||
* `send_to`: *Required*. List of recipient email addresses. Valid options: an array.
|
||||
* `subject`: *Required*. Email subject. Valid options: a string. Default: `LMA
|
||||
Alert Notification`.
|
||||
* `host`: *Optional*. SMTP server address and port. Valid options: a string.
|
||||
Default: `127.0.0.1:25`.
|
||||
* `auth`: *Optional*. SMTP authentication method. Valid options: `none`,
|
||||
`Plain` or `CRAMMD5`. Default: `none`.
|
||||
* `user`: *Optional*. SMTP username. Valid options: a string. Default: `undef`.
|
||||
* `password`: *Optional*. SMTP Password. Valid options: a string. Default: `undef`.
|
||||
* `send_interval`: *Optional*. Minimum time interval in seconds between each
|
||||
email. Valid options: an integer. Default: `0`.
|
||||
|
||||
#### Define: `lma_collector::heka`
|
||||
|
||||
Main Define. Install and configure the Log and Metric collector.
|
||||
|
@ -1,62 +0,0 @@
|
||||
# Copyright 2015 Mirantis, Inc.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||
# not use this file except in compliance with the License. You may obtain
|
||||
# a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
#
|
||||
class lma_collector::smtp_alert (
|
||||
$send_from = undef,
|
||||
$send_to = [],
|
||||
$subject = $lma_collector::params::smtp_subject,
|
||||
$host = '127.0.0.1:25',
|
||||
$auth = 'none',
|
||||
$user = undef,
|
||||
$password = undef,
|
||||
$send_interval = $lma_collector::params::smtp_send_interval,
|
||||
$ensure = present,
|
||||
) inherits lma_collector::params {
|
||||
|
||||
include lma_collector::service::metric
|
||||
|
||||
$lua_modules_dir = $lma_collector::params::lua_modules_dir
|
||||
|
||||
if $host == undef {
|
||||
fail('host parameter is undef!')
|
||||
}
|
||||
$address_port = split($host, ':')
|
||||
if count($address_port) == 1 { # missing port
|
||||
$host_address_port = "${host}:25"
|
||||
} else {
|
||||
$host_address_port = $host
|
||||
}
|
||||
|
||||
heka::encoder::sandbox { 'smtp_alert':
|
||||
config_dir => $lma_collector::params::metric_config_dir,
|
||||
filename => "${lma_collector::params::plugins_dir}/encoders/status_smtp.lua",
|
||||
module_directory => $lua_modules_dir,
|
||||
notify => Class['lma_collector::service::metric'],
|
||||
}
|
||||
|
||||
heka::output::smtp { 'smtp_alert':
|
||||
config_dir => $lma_collector::params::metric_config_dir,
|
||||
send_from => $send_from,
|
||||
send_to => $send_to,
|
||||
message_matcher => 'Type == \'heka.sandbox.gse_cluster_metric\' || Type == \'heka.sandbox.gse_node_cluster_metric\'',
|
||||
encoder => 'smtp_alert',
|
||||
subject => $subject,
|
||||
host => $host_address_port,
|
||||
auth => $auth,
|
||||
user => $user,
|
||||
password => $password,
|
||||
send_interval => $send_interval,
|
||||
notify => Class['lma_collector::service::metric'],
|
||||
}
|
||||
}
|
@ -89,77 +89,7 @@ attributes:
|
||||
restrictions: *disable_influxdb_parameters
|
||||
|
||||
alerting_mode:
|
||||
type: "radio"
|
||||
type: "checkbox"
|
||||
weight: 90
|
||||
value: "local"
|
||||
label: "Alerting"
|
||||
values:
|
||||
- data: "local"
|
||||
value: true
|
||||
label: "Alerts sent to the StackLight Infrastructure Alerting plugin (Nagios) if deployed."
|
||||
- data: "standalone"
|
||||
label: "Alerts sent by email (requires a SMTP server)"
|
||||
|
||||
alerting_send_to:
|
||||
value: ''
|
||||
label: 'The recipient email address'
|
||||
description: ''
|
||||
weight: 91
|
||||
type: "text"
|
||||
restrictions: ¬_standalone
|
||||
- condition: "settings:lma_collector.alerting_mode.value != 'standalone'"
|
||||
action: "disable"
|
||||
regex: &email
|
||||
source: '[a-z0-9!#$%&*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&*+/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.?)?[a-z0-9]?(?:[a-z0-9-]*[a-z0-9])?'
|
||||
error: "Invalid email address"
|
||||
|
||||
alerting_send_from:
|
||||
value: ''
|
||||
label: 'The sender email address'
|
||||
description: ''
|
||||
weight: 92
|
||||
type: "text"
|
||||
restrictions: *not_standalone
|
||||
regex: *email
|
||||
|
||||
alerting_smtp_host:
|
||||
value: ''
|
||||
label: 'SMTP server address'
|
||||
description: 'IP address (or fully qualified domain name) and port of the SMTP server'
|
||||
weight: 93
|
||||
type: "text"
|
||||
restrictions: *not_standalone
|
||||
regex:
|
||||
source: '^[a-zA-Z\d][a-zA-Z\d_\-.]+(:[0-9]+)?$'
|
||||
error: 'Invalid address or name'
|
||||
|
||||
alerting_smtp_auth:
|
||||
type: "radio"
|
||||
weight: 93
|
||||
value: "none"
|
||||
label: "SMTP authentication method"
|
||||
restrictions: *not_standalone
|
||||
values:
|
||||
- data: "none"
|
||||
label: "None"
|
||||
- data: "Plain"
|
||||
label: "Plain"
|
||||
- data: "CRAMMD5"
|
||||
label: "CRAMMD5"
|
||||
|
||||
alerting_smtp_user:
|
||||
value: ''
|
||||
label: 'SMTP user'
|
||||
description: ''
|
||||
weight: 96
|
||||
type: "text"
|
||||
restrictions: ¬_standalone_and_no_auth
|
||||
- condition: "settings:lma_collector.alerting_mode.value != 'standalone' or settings:lma_collector.alerting_smtp_auth.value == 'none'"
|
||||
action: "disable"
|
||||
|
||||
alerting_smtp_password:
|
||||
value: ''
|
||||
label: 'SMTP password'
|
||||
description: ''
|
||||
weight: 97
|
||||
type: "password"
|
||||
restrictions: *not_standalone_and_no_auth
|
||||
|
Loading…
Reference in New Issue
Block a user