Matthew Treinish 9f6089824b
Enable mqtt notifications from logstash gearman worker
This commit enables the mqtt notifications in the gearman worker. Most
of the setup was already there from our previous failed attempts to
leverage the logstash plugin directly. This just pivots that to use the
gearman worker instead.

Change-Id: I6becec12604c61fe50d3e6b9c7ed9f9e9be311ae
Depends-On: I0a17444cce18dd4b63f1f924e393483f6d8fe8eb
Depends-On: I43be3562780c61591ebede61f3a8929e8217f199
2017-05-03 15:57:30 -04:00

95 lines
2.8 KiB
Puppet

# Copyright 2013 Hewlett-Packard Development Company, L.P.
#
# 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.
#
# Logstash indexer worker glue class.
#
class openstack_project::logstash_worker (
$discover_node = 'elasticsearch01.openstack.org',
$filter_rev = 'master',
$filter_source = 'https://git.openstack.org/openstack-infra/logstash-filters',
$enable_mqtt = true,
$mqtt_hostname = 'firehose.openstack.org',
$mqtt_port = 8883,
$mqtt_topic = "logstash/${::hostname}",
$mqtt_username = 'infra',
$mqtt_password = undef,
$mqtt_ca_cert_contents = undef,
) {
file { '/etc/logprocessor/worker.yaml':
ensure => present,
owner => 'root',
group => 'root',
mode => '0644',
content => template('openstack_project/logstash/jenkins-log-worker.yaml.erb'),
}
file { '/etc/default/logstash-indexer':
ensure => present,
owner => 'root',
group => 'root',
mode => '0644',
source => 'puppet:///modules/openstack_project/logstash/logstash-indexer.default',
}
vcsrepo { '/opt/logstash-filters':
ensure => latest,
provider => git,
revision => $filter_rev,
source => $filter_source,
}
include ::logstash
logstash::filter { 'openstack-logstash-filters':
level => '50',
target => '/opt/logstash-filters/filters/openstack-filters.conf',
require => [
Class['::logstash'],
Vcsrepo['/opt/logstash-filters'],
],
notify => Service['logstash'],
}
file { '/etc/logstash/mqtt-root-CA.pem.crt':
ensure => present,
content => $mqtt_ca_cert_contents,
replace => true,
owner => 'subunit',
group => 'subunit',
mode => '0555',
}
validate_array($elasticsearch_nodes) # needed by output.conf.erb
class { '::logstash::indexer':
input_template => 'openstack_project/logstash/input.conf.erb',
output_template => 'openstack_project/logstash/output.conf.erb',
require => Logstash::Filter['openstack-logstash-filters'],
}
include ::log_processor
log_processor::worker { 'A':
config_file => '/etc/logprocessor/worker.yaml',
}
log_processor::worker { 'B':
config_file => '/etc/logprocessor/worker.yaml',
}
log_processor::worker { 'C':
config_file => '/etc/logprocessor/worker.yaml',
}
log_processor::worker { 'D':
config_file => '/etc/logprocessor/worker.yaml',
}
}