Add UI options for Alerting feature
4 options: - disable alerting (default) - use a local node provided by the LMA Infrastructure Plugin - use a remote Nagios server - use the "standalone" SMTP support implements blueprint alerting-lma-collector Change-Id: If84275428b3d4b1b4b70177b8f87ec8b5bf6ee80
This commit is contained in:
parent
ff7d0ea074
commit
db695f5a17
|
@ -56,8 +56,8 @@ if $influxdb_mode == 'local' {
|
|||
}
|
||||
}
|
||||
|
||||
$nagios_mode = $lma_collector['nagios_mode']
|
||||
if $nagios_mode == 'local' {
|
||||
$alerting_mode = $lma_collector['alerting_mode']
|
||||
if $alerting_mode == 'local' {
|
||||
# Check that the LMA-Infrastructure-Alerting plugin is enabled for that environment
|
||||
# and that the node names match
|
||||
$infra_alerting = hiera('lma_infrastructure_alerting', false)
|
||||
|
|
|
@ -160,15 +160,15 @@ if $lma_collector['influxdb_mode'] != 'disabled' {
|
|||
}
|
||||
}
|
||||
|
||||
$nagios_mode = $lma_collector['nagios_mode']
|
||||
if $nagios_mode != 'disabled' {
|
||||
$alerting_mode = $lma_collector['alerting_mode']
|
||||
if $alerting_mode != 'disabled' {
|
||||
|
||||
$deployment_id = hiera('deployment_id')
|
||||
if $nagios_mode == 'remote' {
|
||||
if $alerting_mode == 'remote' {
|
||||
$nagios_url = $lma_collector['nagios_url']
|
||||
$nagios_user = $lma_collector['nagios_user']
|
||||
$nagios_password = $lma_collector['nagios_password']
|
||||
} elsif $nagios_mode == 'local' {
|
||||
} elsif $alerting_mode == 'local' {
|
||||
$lma_infra_alerting = hiera('lma_infrastructure_alerting', false)
|
||||
$nagios_node_name = $lma_infra_alerting['node_name']
|
||||
$nagios_nodes = filter_nodes(hiera('nodes'), 'user_node_name', $nagios_node_name)
|
||||
|
@ -182,7 +182,7 @@ if $nagios_mode != 'disabled' {
|
|||
$http_path = $lma_collector::params::nagios_http_path
|
||||
$nagios_url = "http://${nagios_server}:${http_port}/${http_path}"
|
||||
} else {
|
||||
fail("'${nagios_mode}' mode not supported for the infrastructure alerting service")
|
||||
fail("'${alerting_mode}' mode not supported for the infrastructure alerting service")
|
||||
}
|
||||
|
||||
class { 'lma_collector::nagios':
|
||||
|
|
|
@ -106,20 +106,87 @@ attributes:
|
|||
- condition: "true"
|
||||
action: "hide"
|
||||
|
||||
nagios_mode:
|
||||
alerting_mode:
|
||||
type: "radio"
|
||||
weight: 90
|
||||
value: "local"
|
||||
value: "disabled"
|
||||
label: "Alerting"
|
||||
values:
|
||||
- data: "disabled"
|
||||
label: "Disabled"
|
||||
- data: "standalone"
|
||||
label: "Alerts sent by email (requires a SMTP server)"
|
||||
- data: "local"
|
||||
label: "Local node"
|
||||
label: "Alerts sent to a local node running the LMA Infrastructure Alerting plugin"
|
||||
- data: "remote"
|
||||
label: "Remote server"
|
||||
label: "Alerts sent to a remote Nagios server"
|
||||
restrictions: *all_disabled_msg
|
||||
|
||||
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
|
||||
|
||||
nagios_url:
|
||||
value: ''
|
||||
label: 'Nagios URL'
|
||||
|
@ -130,7 +197,7 @@ attributes:
|
|||
source: '^(http(s?):\/\/)?([a-zA-Z\d]+[a-zA-Z\d_\-.]*)(:[0-9]+)?(\/[a-zA-Z0-9_\-\s.\/\?%#&=]*)?$'
|
||||
error: "Invalid URL"
|
||||
restrictions: ¬_remote
|
||||
- condition: "settings:lma_collector.nagios_mode.value != 'remote'"
|
||||
- condition: "settings:lma_collector.alerting_mode.value != 'remote'"
|
||||
action: "disable"
|
||||
|
||||
nagios_user:
|
||||
|
|
Loading…
Reference in New Issue