
Set up small non master non data elasticsearch daemons on logstash workers to act as local load balancers for the elasticsearch http protocol. Change-Id: Ie3729f851ebef3331a6b69f718e57d663209bfc2
49 lines
1.5 KiB
Puppet
49 lines
1.5 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.
|
|
#
|
|
# Class to install a simple watchdog for the logstash-indexer service.
|
|
# es_api_node is the address to access the elasticsearch api at (should
|
|
# be a 'host:port' string).
|
|
|
|
class logstash::watchdog (
|
|
$cron_ensure = 'present',
|
|
$es_api_node = 'localhost'
|
|
) {
|
|
package { 'jq':
|
|
ensure => present,
|
|
}
|
|
if ! defined(Package['curl']) {
|
|
package { 'curl':
|
|
ensure => present,
|
|
}
|
|
}
|
|
|
|
file { '/usr/local/bin/logstash-watchdog':
|
|
ensure => present,
|
|
source => 'puppet:///modules/logstash/logstash-watchdog.sh',
|
|
replace => true,
|
|
owner => 'root',
|
|
group => 'root',
|
|
mode => '0555',
|
|
}
|
|
|
|
cron { 'logstash-watchdog':
|
|
ensure => $cron_ensure,
|
|
minute => '*/10',
|
|
environment => 'PATH=/bin:/usr/bin:/usr/local/bin',
|
|
command => "sleep $((RANDOM\%60)) && /usr/local/bin/logstash-watchdog ${es_api_node}",
|
|
require => Service['logstash-indexer']
|
|
}
|
|
}
|