Add SmtpOutput plugin

implements blueprint alerting-lma-collector

Change-Id: I96b3ba35cd90d0ab426474e77b303d3c8012df12
This commit is contained in:
Swann Croiset 2015-07-28 12:58:40 +02:00
parent 27e706d0e5
commit ff7d0ea074
2 changed files with 60 additions and 0 deletions

View File

@ -0,0 +1,44 @@
# 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,
}
}

View File

@ -0,0 +1,16 @@
[<%= @title %>_output]
type = "SmtpOutput"
message_matcher = "<%= @message_matcher %>"
encoder = "<%= @encoder %>_encoder"
send_from = "<%= @send_from %>"
send_to = [<%= @send_to.sort().collect { |email| "'#{email}'"}.join(',') %>]
subject = "<%= @subject %>"
host = "<%= @host %>"
auth = "<%= @auth %>"
<% if @user and not @user.nil? and @password != ''%>
user = "<%= @user %>"
<% end %>
<% if @password and not @password.nil? and @password != '' %>
password = "<%= @password %>"
<% end %>
send_interval = <%= @send_interval %>