Retire repository

Fuel repositories are all retired in openstack namespace, retire
remaining fuel repos in x namespace since they are unused now.

This change removes all content from the repository and adds the usual
README file to point out that the repository is retired following the
process from
https://docs.openstack.org/infra/manual/drivers.html#retiring-a-project

See also
http://lists.openstack.org/pipermail/openstack-discuss/2019-December/011675.html

A related change is: https://review.opendev.org/699752 .

Change-Id: I8aded54f1b9f3b79f3a4bf8f607d3695b92f528b
This commit is contained in:
Andreas Jaeger 2019-12-18 19:39:39 +01:00
parent 55be414aeb
commit c929899400
422 changed files with 10 additions and 40938 deletions

4
.gitignore vendored
View File

@ -1,4 +0,0 @@
.bundled_gems/
.build/
lma_collector*rpm
.tox

201
LICENSE
View File

@ -1,201 +0,0 @@
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.
"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:
(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.
You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS
APPENDIX: How to apply the Apache License to your work.
To apply the Apache License to your work, attach the following
boilerplate notice, with the fields enclosed by brackets "[]"
replaced with your own identifying information. (Don't include
the brackets!) The text should be enclosed in the appropriate
comment syntax for the file format. We also recommend that a
file or class name and description of purpose be included on the
same "printed page" as the copyright notice for easier
identification within third-party archives.
Copyright [yyyy] [name of copyright owner]
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.

View File

@ -1,95 +0,0 @@
The StackLight Collector Plugin for Fuel
========================================
The StackLight Collector Plugin is used to install and
configure several software components that are used to
collect and process all the data that we think is relevant
to provide deep operational insights about your OpenStack environment.
These finely integrated components are collectively referred to as
the StackLight Collector (or just the Collector).
The Collecor is a key component of the so-called Logging,
Monitoring and Alerting (LMA) toolchain of Mirantis OpenStack.
Please start with the [StackLight Collector Plugin Overview](
http://fuel-plugin-lma-collector.readthedocs.org/en/latest/overview.html)
to getting started.
Release Notes
-------------
A summary description of the features are provided in the [Release Notes](
http://fuel-plugin-lma-collector.readthedocs.org/en/latest/releases.html)
section of the plugin's documentation.
Requirements
------------
The requirements are provided in the [Requirements](
http://fuel-plugin-lma-collector.readthedocs.org/en/latest/overview.html#requirements)
section of the plugin's documentation.
Known issues
------------
All known issues are listed on [Launchpad](
https://bugs.launchpad.net/lma-toolchain).
Limitations
-----------
All known limitations are described in the [Limitations](
http://fuel-plugin-lma-collector.readthedocs.org/en/latest/overview.html#limitations)
section of the plugin's documentation.
Installation
------------
The installation instructions of the StackLight Collector are provided
in the [Installation](
http://fuel-plugin-lma-collector.readthedocs.org/en/latest/installation.html#installation)
section of the plugin's documentation.
User Guide
----------
Instructions for how to configure the StackLight Collector
are provided in the [Configuration Guide](
http://fuel-plugin-lma-collector.readthedocs.org/en/latest/configuration.html)
and [Alarms Configuration Guide](
http://fuel-plugin-lma-collector.readthedocs.org/en/latest/alarms.html)
sections of the plugin's documentation.
Communication
-------------
The *OpenStack Development Mailing List* is the preferred way to communicate
with the members of the project.
Emails should be sent to `openstack-dev@lists.openstack.org` with the subject
prefixed by `[fuel][plugins][lma]`.
Reporting Bugs
--------------
Bugs should be filed against the [LMA toolchain project](
https://launchpad.net/lma-toolchain) on Launchpad (not Github!).
Contributing
------------
If you would like to contribute to the development of this plugin,
you must follow the [OpenStack development workflow](
http://docs.openstack.org/infra/manual/developers.html#development-workflow)
instructions.
Patch reviews take place on the [OpenStack Gerrit](
https://review.openstack.org/#/q/status:open+project:openstack/fuel-plugin-lma-collector,n,z)
system.
Contributors
------------
* Guillaume Thouvenin <gthouvenin@mirantis.com>
* Patrick Petit <ppetit@mirantis.com>
* Simon Pasquier <spasquier@mirantis.com>
* Swann Croiset <scroiset@mirantis.com>

10
README.rst Normal file
View File

@ -0,0 +1,10 @@
This project is no longer maintained.
The contents of this repository are still available in the Git
source code management system. To see the contents of this
repository before it reached its end of life, please check out the
previous commit with "git checkout HEAD^1".
For any further questions, please email
openstack-discuss@lists.openstack.org or join #openstack-dev on
Freenode.

View File

@ -1,2 +0,0 @@
This directory contains various scripts and tools that help with the deployment
and management of the StackLight toolchain. These materials are provided as-is.

View File

@ -1,74 +0,0 @@
[openstack_sample_amqp]
type = "AMQPInput"
url = "amqp://<USER>:<PASS>@<RABBIT_ADDRESS>:5673/"
exchange = "ceilometer"
exchange_type = "topic"
exchange_durability = false
exchange_auto_delete = false
queue_auto_delete = false
queue = "metering.sample"
routing_key = "metering.sample"
decoder = "sample_decoder"
splitter = "NullSplitter"
can_exit = false
[sample_decoder]
type = "SandboxDecoder"
filename = "/usr/share/lma_collector/decoders/metering.lua"
module_directory = "/usr/share/lma_collector_modules;/usr/share/heka/lua_modules"
[sample_decoder.config]
#decode_resources = "TRUE"
metadata_fields = 'status deleted container_format min_ram updated_at min_disk is_public size checksum created_at disk_format protected instance_host host display_name instance_id instance_type status state'
[ceilometer_influxdb_accumulator_filter]
type = "SandboxFilter"
filename = "/usr/share/lma_collector/filters/influxdb_accumulator.lua"
preserve_data = false
message_matcher = "Fields[aggregator] == NIL && Type =~ /ceilometer_samples$/"
ticker_interval = 1
module_directory = "/usr/share/lma_collector_modules;/usr/share/heka/lua_modules"
[ceilometer_influxdb_accumulator_filter.config]
tag_fields = 'deployment_id environment_label hostname tenant_id user_id'
time_precision = 'ms'
payload_name = 'sample_data'
bulk_metric_type_matcher = 'ceilometer_samples$'
flush_count = 10
[influxdb_encoder]
type = "PayloadEncoder"
append_newlines = false
prefix_ts = false
[samples_influxdb_output]
type = "HttpOutput"
message_matcher = "Fields[payload_type] == 'txt' && Fields[payload_name] == 'sample_data'"
encoder = "influxdb_encoder"
address = "http://10.109.41.14:8086/write?db=ceilometer&precision=ms"
username = "ceilo"
password = "<PASSWORD>"
http_timeout = 5000
method = "POST"
[samples_influxdb_output.headers]
Content-Type = ["application/x-www-form-urlencoded"]
[elasticsearch_resource_output]
type = "ElasticSearchOutput"
message_matcher = "Type == 'resource'"
encoder = "elasticsearch_resource_encoder"
flush_interval = 5000
flush_count = 10
server = "http://<ES>:9200"
[elasticsearch_resource_encoder]
type = "SandboxEncoder"
filename = "/usr/share/lma_collector/encoders/es_bulk.lua"
module_directory = "/usr/share/lma_collector_modules;/usr/share/heka/lua_modules"
[elasticsearch_resource_encoder.config]
index = "ceilometer_resource"
type_name = "source"

View File

@ -1,24 +0,0 @@
[gse_afd_notification_filter]
type = "SandboxFilter"
filename = "/usr/share/lma_collector/filters/gse_afd_tcp_notifier.lua"
message_matcher="(Type =~ /heka.sandbox.gse_.*metric$/ || Type =~ /heka.sandbox.afd_.*metric$/) && Fields[aggregator] == NIL"
module_directory = "/usr/share/lma_collector_modules;/usr/share/heka/lua_modules"
[gse_afd_notification_filter.config]
not_ok_mode = false
debug_mode = false
[rst_encoder]
type = "RstEncoder"
[tcp_notifier_output]
type = "TcpOutput"
message_matcher = "Type == 'heka.sandbox.gse_afd_notification'"
encoder = "rst_encoder"
address = "127.0.0.1:40000"
use_buffering = true
[tcp_notifier_output.buffering]
full_action = "drop"
max_buffer_size = 268435456
max_file_size = 67108864

View File

@ -1,28 +0,0 @@
#!/bin/bash
# Copyright 2016 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.
function check_fuel_nodes_file {
if [ ! -f "$1" ]; then
echo "You must first run the following command on the Fuel master node:"
echo " fuel nodes > $1"
exit 1
fi
}
# Get IPs list of online nodes from 'fuel command' output.
function get_ready_nodes {
# "fuel nodes" command output differs form Fuel 8 and 9 for online nodes: True/False and 0/1
fuel nodes | grep ready | awk -F '|' -vOFS=':' '{print $5,$9 }'|tr -d ' '|grep -E ':1|:True'|awk -F ':' '{print $1}'
}

View File

@ -1,41 +0,0 @@
#!/bin/bash
# Copyright 2016 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.
set -e
DIAG_DIR=/var/lma_diagnostics
. "$(dirname "$(readlink -f "$0")")"/common.sh
node_list=$(get_ready_nodes)
rm -rf "$DIAG_DIR"
mkdir $DIAG_DIR
echo "Running lma_diagnostic tool on all nodes which are ready and online (this can take several minutes)"
mco rpc --timeout 300 --verbose --display all --agent execute_shell_command --action execute --argument cmd="/usr/local/bin/lma_diagnostics" > "$DIAG_DIR/outputs.log" 2>&1
for n in $node_list; do
echo "Downloading diagnostic for node $n"
rsync -arz "$n:$DIAG_DIR" "$DIAG_DIR/$n/" || echo "Fail to retrieve diagnostic from $n"
done
fuel plugins > "$DIAG_DIR/fuel_plugins"
CURRENT_DATE=$(date +%Y-%m-%d_%H-%M-%s)
tar czvf "${DIAG_DIR}.${CURRENT_DATE}.tgz" -C "$DIAG_DIR" . >/dev/null
echo "The diagnostic archive is here: ${DIAG_DIR}.${CURRENT_DATE}.tgz"
exit 0

View File

@ -1,2 +0,0 @@
Gemfile.lock
.bundle

View File

@ -1,23 +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.
source 'https://rubygems.org'
group :development, :test do
gem 'rake'
gem "puppet", ENV['PUPPET_VERSION'] || '~> 3.4.0'
# Newer puppetlabs_spec_helper depends on rubocop-rspec that requires ruby >= 2.2.0
gem 'puppetlabs_spec_helper', '~> 1.1.1'
# puppet-lint >= 2.2.0 don't support Puppet 3.x anymore
gem 'puppet-lint', '~> 2.1.0'
end

View File

@ -1,14 +0,0 @@
require 'puppet-lint/tasks/puppet-lint'
require 'puppet-syntax/tasks/puppet-syntax'
PuppetLint.configuration.fail_on_warnings = true
PuppetLint.configuration.send('disable_80chars')
PuppetLint.configuration.send('disable_class_inherits_from_params_class')
PuppetLint.configuration.send('disable_class_parameter_defaults')
PuppetLint.configuration.send('disable_variable_contains_dash')
desc "Run lint, and syntax tests."
task :test => [
:lint,
:syntax,
]

View File

@ -1,109 +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.
notice('fuel-plugin-lma-collector: aggregator.pp')
prepare_network_config(hiera_hash('network_scheme', {}))
$mgmt_address = get_network_role_property('management', 'ipaddr')
$lma_collector = hiera_hash('lma_collector')
$node_profiles = hiera_hash('lma::collector::node_profiles')
$is_controller = $node_profiles['controller']
$is_mysql_server = $node_profiles['mysql']
$is_rabbitmq = $node_profiles['rabbitmq']
$network_metadata = hiera_hash('network_metadata')
$controllers = get_nodes_hash_by_roles($network_metadata, ['primary-controller', 'controller'])
$aggregator_address = hiera('management_vip')
$management_network = hiera('management_network_range')
$aggregator_port = 5565
$check_port = 5566
if $is_controller or $is_rabbitmq or $is_mysql_server {
# On nodes where pacemaker is deployed, make sure the Log and Metric collector services
# are configured with the "pacemaker" provider
Service<| title == 'log_collector' |> {
provider => 'pacemaker'
}
Service<| title == 'metric_collector' |> {
provider => 'pacemaker'
}
}
# On a dedicated environment, without controllers, we don't deploy the
# aggregator client.
if size(keys($controllers)) > 0 {
class { 'lma_collector::aggregator::client':
address => $aggregator_address,
port => $aggregator_port,
}
}
if $is_controller {
class { 'lma_collector::aggregator::server':
listen_address => $mgmt_address,
listen_port => $aggregator_port,
http_check_port => $check_port,
}
# Hacks needed to leverage the haproxy_service defined type
include haproxy::params
Haproxy::Service { use_include => true }
Haproxy::Balancermember { use_include => true }
# HAProxy configuration
openstack::ha::haproxy_service { 'lma':
order => '999',
listen_port => $aggregator_port,
balancermember_port => $aggregator_port,
haproxy_config_options => {
'option' => ['httpchk', 'tcplog'],
'balance' => 'roundrobin',
'mode' => 'tcp',
},
balancermember_options => "check port ${check_port}",
internal => true,
internal_virtual_ip => $aggregator_address,
public => false,
public_virtual_ip => undef,
ipaddresses => [ $mgmt_address ],
server_names => [ $::hostname ],
}
# Allow traffic from HAProxy to the local LMA collector
firewall { '998 lma':
port => [$aggregator_port, $check_port],
source => $management_network,
destination => $mgmt_address,
proto => 'tcp',
action => 'accept',
}
# Configure the GSE filters emitting the status metrics for:
# - service clusters
# - node clusters
# - global clusters
create_resources(lma_collector::gse_cluster_filter, {
'service' => $lma_collector['gse_cluster_service'],
'node' => $lma_collector['gse_cluster_node'],
'global' => $lma_collector['gse_cluster_global'],
}, {
require => Class['lma_collector::gse_policies']
})
class { 'lma_collector::gse_policies':
policies => $lma_collector['gse_policies']
}
}

View File

@ -1,379 +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.
notice('fuel-plugin-lma-collector: base.pp')
$heka_version = '0.10.0'
# TODO(spasquier): fail if Neutron isn't used
prepare_network_config(hiera_hash('network_scheme', {}))
$fuel_version = 0 + hiera('fuel_version')
$lma_collector = hiera_hash('lma_collector')
$node_profiles = hiera_hash('lma::collector::node_profiles')
$is_controller = $node_profiles['controller']
$is_base_os = $node_profiles['base_os']
$is_mysql_server = $node_profiles['mysql']
$is_rabbitmq = $node_profiles['rabbitmq']
if $lma_collector['environment_label'] != '' {
$environment_label = $lma_collector['environment_label']
} else {
$environment_label = join(['env-', hiera('deployment_id')], '')
}
$tags = {
deployment_id => hiera('deployment_id'),
openstack_region => 'RegionOne',
openstack_release => hiera('openstack_version'),
openstack_roles => join(hiera('roles'), ','),
environment_label => $environment_label,
}
if $is_controller {
# "keystone" group required for lma_collector::logs::openstack to be able
# to read log files located in /var/log/keystone
$additional_groups = ['haclient', 'keystone']
} else {
$additional_groups = []
}
case $::osfamily {
'Debian': {
$heka_user = 'heka'
}
'RedHat': {
# For CentOS, the LMA collector needs to run as root because the files
# created by RSyslog aren't created with the correct mode for now.
$heka_user = 'root'
}
default: {
fail("${::osfamily} not supported")
}
}
class { 'lma_collector':
tags => $tags,
}
if $is_controller {
$install_heka_init_script = false
# On controller nodes the increase of the AFD filters puts too much load on
# the heka pipeline which can block heka (idle packs).
# It was observed that a poolsize set to 200 solves the issue.
$poolsize = 200
} else {
$install_heka_init_script = true
$poolsize = 100
}
lma_collector::heka { 'log_collector':
user => $heka_user,
groups => $additional_groups,
install_init_script => $install_heka_init_script,
version => $heka_version,
heka_monitoring => false,
require => Class['lma_collector'],
}
lma_collector::heka { 'metric_collector':
user => $heka_user,
groups => $additional_groups,
install_init_script => $install_heka_init_script,
version => $heka_version,
poolsize => $poolsize,
heka_monitoring => false,
require => Class['lma_collector'],
}
# The LMA collector service is managed by Pacemaker on nodes that are
# running RabbitMQ and database in detached mode and also on controller nodes.
# We use pacemaker_wrappers::service to reconfigure the service resource
# to use the "pacemaker" service provider
if $is_controller or $is_rabbitmq or $is_mysql_server {
$rabbitmq_resource = 'master_p_rabbitmq-server'
if $fuel_version < 9.0 {
pacemaker_wrappers::service { 'log_collector':
ensure => present,
prefix => false,
primitive_class => 'ocf',
primitive_type => 'ocf-lma_collector',
complex_type => 'clone',
use_handler => false,
ms_metadata => {
# the resource should start as soon as the dependent resources (eg RabbitMQ)
# are running *locally*
'interleave' => true,
},
metadata => {
# Make sure that Pacemaker tries to restart the resource if it fails
# too many times
'failure-timeout' => '120s',
'migration-threshold' => '3',
},
parameters => {
'service_name' => 'log_collector',
'config' => '/etc/log_collector',
'log_file' => '/var/log/log_collector.log',
'user' => $heka_user,
},
operations => {
'monitor' => {
'interval' => '20',
'timeout' => '10',
},
'start' => {
'timeout' => '30',
},
'stop' => {
'timeout' => '30',
},
},
}
if $is_rabbitmq {
cs_rsc_colocation { "${log_service_name}-with-rabbitmq":
ensure => present,
alias => 'log_collector',
primitives => ['clone_log_collector', $rabbitmq_resource],
score => 0,
require => Pacemaker_wrappers::Service['log_collector'],
}
cs_rsc_order { 'log_collector-after-rabbitmq':
ensure => present,
alias => 'log_collector',
first => $rabbitmq_resource,
second => 'clone_log_collector',
# Heka cannot start if RabbitMQ isn't ready to accept connections. But
# once it is initialized, it can recover from a RabbitMQ outage. This is
# why we set score to 0 (interleave) meaning that the collector should
# start once RabbitMQ is active but a restart of RabbitMQ
# won't trigger a restart of the LMA collector.
score => 0,
require => Cs_rsc_colocation['log_collector'],
before => Class['lma_collector'],
}
}
pacemaker_wrappers::service { 'metric_collector':
ensure => present,
prefix => false,
primitive_class => 'ocf',
primitive_type => 'ocf-lma_collector',
complex_type => 'clone',
use_handler => false,
ms_metadata => {
# The resource can start at any time
'interleave' => false,
},
metadata => {
# Make sure that Pacemaker tries to restart the resource if it fails
# too many times
'failure-timeout' => '120s',
'migration-threshold' => '3',
},
parameters => {
'service_name' => 'metric_collector',
'config' => '/etc/metric_collector',
'log_file' => '/var/log/metric_collector.log',
'user' => $heka_user,
},
operations => {
'monitor' => {
'interval' => '20',
'timeout' => '10',
},
'start' => {
'timeout' => '30',
},
'stop' => {
'timeout' => '30',
},
},
}
} else {
pacemaker::service { 'log_collector':
ensure => present,
prefix => false,
primitive_class => 'ocf',
primitive_type => 'ocf-lma_collector',
use_handler => false,
complex_type => 'clone',
complex_metadata => {
# the resource should start as soon as the dependent resources
# (eg RabbitMQ) are running *locally*
'interleave' => true,
},
metadata => {
# Make sure that Pacemaker tries to restart the resource if it fails
# too many times
'failure-timeout' => '120s',
'migration-threshold' => '3',
},
parameters => {
'service_name' => 'log_collector',
'config' => '/etc/log_collector',
'log_file' => '/var/log/log_collector.log',
'user' => $heka_user,
},
operations => {
'monitor' => {
'interval' => '20',
'timeout' => '10',
},
'start' => {
'timeout' => '30',
},
'stop' => {
'timeout' => '30',
},
},
require => Lma_collector::Heka['log_collector'],
}
if $is_rabbitmq {
pcmk_colocation { 'log_collector-with-rabbitmq':
ensure => present,
alias => 'log_collector',
first => $rabbitmq_resource,
second => 'clone_log_collector',
score => 0,
require => Pacemaker::Service['log_collector'],
}
pcmk_order { 'log_collector-after-rabbitmq':
ensure => present,
first => $rabbitmq_resource,
second => 'clone_log_collector',
# Heka cannot start if RabbitMQ isn't ready to accept connections. But
# once it is initialized, it can recover from a RabbitMQ outage. This is
# why we set score to 0 (interleave) meaning that the collector should
# start once RabbitMQ is active but a restart of RabbitMQ
# won't trigger a restart of the LMA collector.
score => 0,
require => Pcmk_colocation['log_collector-with-rabbitmq'],
}
}
pacemaker::service { 'metric_collector':
ensure => present,
prefix => false,
primitive_class => 'ocf',
primitive_type => 'ocf-lma_collector',
use_handler => false,
complex_type => 'clone',
complex_metadata => {
# The resource can start at any time
'interleave' => false,
},
metadata => {
# Make sure that Pacemaker tries to restart the resource if it fails
# too many times
'failure-timeout' => '120s',
'migration-threshold' => '3',
},
parameters => {
'service_name' => 'metric_collector',
'config' => '/etc/metric_collector',
'log_file' => '/var/log/metric_collector.log',
'user' => $heka_user,
},
operations => {
'monitor' => {
'interval' => '20',
'timeout' => '10',
},
'start' => {
'timeout' => '30',
},
'stop' => {
'timeout' => '30',
},
},
require => Lma_collector::Heka['metric_collector'],
}
}
}
class { 'lma_collector::logs::hdd_errors_counter':
require => Class['lma_collector']
}
if hiera('lma::collector::elasticsearch::server', false) {
class { 'lma_collector::logs::system':
require => Class['lma_collector'],
}
if (str2bool($::ovs_log_directory)){
# install logstreamer for open vSwitch if log directory exists
class { 'lma_collector::logs::ovs':
require => Class['lma_collector'],
}
}
class { 'lma_collector::elasticsearch':
server => hiera('lma::collector::elasticsearch::server'),
port => hiera('lma::collector::elasticsearch::rest_port'),
flush_interval => hiera('lma::collector::elasticsearch::flush_interval'),
flush_count => hiera('lma::collector::elasticsearch::flush_count'),
require => Class['lma_collector'],
}
if $is_mysql_server {
class { 'lma_collector::logs::mysql':
require => Class['lma_collector'],
}
}
if $is_rabbitmq {
class { 'lma_collector::logs::rabbitmq':
require => Class['lma_collector'],
}
}
}
if hiera('lma::collector::influxdb::server', false) {
class { 'lma_collector::influxdb':
server => hiera('lma::collector::influxdb::server'),
port => hiera('lma::collector::influxdb::port'),
database => hiera('lma::collector::influxdb::database'),
user => hiera('lma::collector::influxdb::user'),
password => hiera('lma::collector::influxdb::password'),
tag_fields => ['deployment_id', 'environment_label', 'tenant_id', 'user_id'],
require => Class['lma_collector'],
}
}
if $is_rabbitmq and (hiera('lma::collector::elasticsearch::server', false) or hiera('lma::collector::influxdb::server', false)){
# OpenStack notifications are always useful for indexation and metrics
# collection
$messaging_address = get_network_role_property('mgmt/messaging', 'ipaddr')
$rabbit = hiera_hash('rabbit')
class { 'lma_collector::notifications::input':
topic => 'lma_notifications',
host => $messaging_address,
port => hiera('amqp_port', '5673'),
user => 'nova',
password => $rabbit['password'],
}
if hiera('lma::collector::influxdb::server', false) {
class { 'lma_collector::notifications::metrics': }
}
}
class { 'fuel_lma_collector::tools': }

View File

@ -1,69 +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.
notice('fuel-plugin-lma-collector: cinder.pp')
$ceilometer = hiera_hash('ceilometer', {})
$node_profiles = hiera_hash('lma::collector::node_profiles')
$is_controller = $node_profiles['controller']
$is_rabbitmq = $node_profiles['rabbitmq']
$is_mysql_server = $node_profiles['mysql']
if $is_controller or $is_rabbitmq or $is_mysql_server {
# On nodes where pacemaker is deployed, make sure Log and Metric collector services
# are configured with the "pacemaker" provider
Service<| title == 'log_collector' |> {
provider => 'pacemaker'
}
Service<| title == 'metric_collector' |> {
provider => 'pacemaker'
}
}
if hiera('lma::collector::influxdb::server', false) {
class { 'lma_collector::logs::counter':
hostname => $::hostname,
}
}
if hiera('lma::collector::elasticsearch::server', false) {
lma_collector::logs::openstack { 'cinder': }
}
if $ceilometer['enabled'] {
$notification_topics = ['notifications', 'lma_notifications']
}
else {
$notification_topics = ['lma_notifications']
}
# OpenStack notifcations are always useful for indexation and metrics collection
include cinder::params
$volume_service = $::cinder::params::volume_service
cinder_config { 'DEFAULT/notification_topics':
value => join($notification_topics, ','),
notify => Service[$volume_service],
}
cinder_config { 'DEFAULT/notification_driver':
value => 'messaging',
notify => Service[$volume_service],
}
service { $volume_service:
hasstatus => true,
hasrestart => true,
}

View File

@ -1,26 +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.
notice('fuel-plugin-lma-collector: cleanup_apt_config.pp')
case $::osfamily {
'Debian': {
file { '/etc/apt/apt.conf.d/99norecommends':
ensure => absent,
}
}
default: {
# Currently only Debian like distributions need specific configuration.
}
}

View File

@ -1,368 +0,0 @@
# Copyright 2016 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.
notice('fuel-plugin-lma-collector: collectd.pp')
if hiera('lma::collector::influxdb::server', false) {
prepare_network_config(hiera_hash('network_scheme', {}))
$fuel_version = 0 + hiera('fuel_version')
$management_vip = hiera('management_vip')
$mgmt_address = get_network_role_property('management', 'ipaddr')
$lma_collector = hiera_hash('lma_collector')
$node_profiles = hiera_hash('lma::collector::node_profiles')
$is_controller = $node_profiles['controller']
$is_base_os = $node_profiles['base_os']
$is_mysql_server = $node_profiles['mysql']
$is_rabbitmq = $node_profiles['rabbitmq']
$is_compute = $node_profiles['compute']
$is_ceph_osd = $node_profiles['ceph_osd']
$is_elasticsearch_node = $node_profiles['elasticsearch']
$is_influxdb_node = $node_profiles['influxdb']
$nova = hiera_hash('nova', {})
$neutron = hiera_hash('quantum_settings', {})
$cinder = hiera_hash('cinder', {})
$haproxy_socket = '/var/lib/haproxy/stats'
$storage_options = hiera_hash('storage', {})
if $storage_options['volumes_ceph'] or $storage_options['images_ceph'] or
$storage_options['objects_ceph'] or $storage_options['ephemeral_ceph']{
$ceph_enabled = true
} else {
$ceph_enabled = false
}
if $is_controller or $is_rabbitmq {
Service<| title == 'metric_collector' |> {
provider => 'pacemaker'
}
}
if $is_elasticsearch_node {
$process_matches = [{name => 'elasticsearch', regex => 'java'}]
} else {
$process_matches = undef
}
if $is_influxdb_node {
$processes = ['influxd', 'grafana-server', 'hekad', 'collectd']
} else {
$processes = ['hekad', 'collectd']
}
if $is_controller {
# collectd plugins on controller do many network I/O operations, so
# it is recommended to increase this value
$read_threads = 10
} else {
$read_threads = 5
}
class { 'lma_collector::collectd::base':
processes => $processes,
process_matches => $process_matches,
# Purge the default configuration shipped with the collectd package
purge => true,
read_threads => $read_threads,
}
if $is_mysql_server {
class { 'lma_collector::collectd::mysql':
username => hiera('lma::collector::monitor::mysql_username'),
password => hiera('lma::collector::monitor::mysql_password'),
socket => hiera('lma::collector::monitor::mysql_socket'),
require => Class['lma_collector::collectd::base'],
}
lma_collector::collectd::dbi_mysql_status { 'mysql_status':
username => hiera('lma::collector::monitor::mysql_username'),
dbname => hiera('lma::collector::monitor::mysql_db'),
password => hiera('lma::collector::monitor::mysql_password'),
require => Class['lma_collector::collectd::base'],
}
}
if $is_rabbitmq {
$rabbit = hiera_hash('rabbit')
if $rabbit['user'] {
$rabbitmq_user = $rabbit['user']
}
else {
$rabbitmq_user = 'nova'
}
class { 'lma_collector::collectd::rabbitmq':
username => $rabbitmq_user,
password => $rabbit['password'],
require => Class['lma_collector::collectd::base'],
}
}
# Configure Pacemaker plugin
if $is_controller {
$pacemaker_master_resource = 'vip__management'
$controller_resources = {
'vip__public' => 'vip__public',
'vip__management' => 'vip__management',
'vip__vrouter_pub' => 'vip__vrouter_pub',
'vip__vrouter' => 'vip__vrouter',
'p_haproxy' => 'haproxy',
}
} else {
$pacemaker_master_resource = undef
$controller_resources = {}
}
# Deal with detach-* plugins
if $is_mysql_server {
if $fuel_version < 9.0 {
$mysql_resource_name = 'p_mysql'
} else {
$mysql_resource_name = 'p_mysqld'
}
$mysql_resource = {
"${mysql_resource_name}" => 'mysqld',
}
}
else {
$mysql_resource = {}
}
if $is_rabbitmq {
$rabbitmq_resource = {
'p_rabbitmq-server' => 'rabbitmq',
}
}
else {
$rabbitmq_resource = {}
}
$resources = merge($controller_resources, $mysql_resource, $rabbitmq_resource)
if ! empty($resources) {
class { 'lma_collector::collectd::pacemaker':
resources => $resources,
notify_resource => $pacemaker_master_resource,
hostname => $::fqdn,
require => Class['lma_collector::collectd::base'],
}
}
if $is_controller {
# Configure OpenStack plugins
$openstack_service_config = {
user => 'nova',
password => $nova['user_password'],
tenant => 'services',
keystone_url => "http://${management_vip}:5000/v2.0",
pacemaker_master_resource => $pacemaker_master_resource,
require => Class['lma_collector::collectd::base'],
}
$openstack_services = {
'nova_services' => $openstack_service_config,
'cinder_services' => $openstack_service_config,
'keystone' => $openstack_service_config,
'neutron_agents' => $openstack_service_config,
}
$nova_polling = {
'polling_interval' => 60,
'pagination_limit' => 500,
}
$cinder_polling = {
'polling_interval' => 60,
'pagination_limit' => 500,
}
$glance_polling = {
'polling_interval' => 60,
'pagination_limit' => 25,
}
$neutron_polling = {
'polling_interval' => 60,
'pagination_limit' => 100,
}
$openstack_resources = {
'nova' => merge($openstack_service_config, $nova_polling),
'cinder' => merge($openstack_service_config, $cinder_polling),
'glance' => merge($openstack_service_config, $glance_polling),
'neutron' => merge($openstack_service_config, $neutron_polling),
}
create_resources(lma_collector::collectd::openstack, $openstack_services)
create_resources(lma_collector::collectd::openstack, $openstack_resources)
# FIXME(elemoine) use the special attribute * when Fuel uses a Puppet version
# that supports it.
class { 'lma_collector::collectd::openstack_checks':
user => $openstack_service_config[user],
password => $openstack_service_config[password],
tenant => $openstack_service_config[tenant],
keystone_url => $openstack_service_config[keystone_url],
pacemaker_master_resource => $openstack_service_config[pacemaker_master_resource],
require => Class['lma_collector::collectd::base'],
}
# FIXME(elemoine) use the special attribute * when Fuel uses a Puppet version
# that supports it.
class { 'lma_collector::collectd::hypervisor':
user => $openstack_service_config[user],
password => $openstack_service_config[password],
tenant => $openstack_service_config[tenant],
keystone_url => $openstack_service_config[keystone_url],
pacemaker_master_resource => $openstack_service_config[pacemaker_master_resource],
# Fuel sets cpu_allocation_ratio to 8.0 in nova.conf
cpu_allocation_ratio => 8.0,
require => Class['lma_collector::collectd::base'],
}
class { 'lma_collector::collectd::haproxy':
socket => $haproxy_socket,
# Ignore internal stats ('Stats' for 6.1, 'stats' for 7.0), lma proxies and
# Nova EC2
proxy_ignore => ['Stats', 'stats', 'lma', 'nova-api-1'],
proxy_names => {
'ceilometer' => 'ceilometer-api',
'cinder-api' => 'cinder-api',
'glance-api' => 'glance-api',
'glance-registry' => 'glance-registry-api',
'heat-api' => 'heat-api',
'heat-api-cfn' => 'heat-cfn-api',
'heat-api-cloudwatch' => 'heat-cloudwatch-api',
'horizon' => 'horizon-web',
'horizon-ssl' => 'horizon-https',
'keystone-1' => 'keystone-public-api',
'keystone-2' => 'keystone-admin-api',
'murano' => 'murano-api',
'mysqld' => 'mysqld-tcp',
'neutron' => 'neutron-api',
# starting with Mitaka (and later)
'nova-api' => 'nova-api',
# before Mitaka
'nova-api-2' => 'nova-api',
'nova-novncproxy' => 'nova-novncproxy-websocket',
'nova-metadata-api' => 'nova-metadata-api',
'sahara' => 'sahara-api',
'swift' => 'swift-api',
},
require => Class['lma_collector::collectd::base'],
}
if $ceph_enabled {
class { 'lma_collector::collectd::ceph_mon':
require => Class['lma_collector::collectd::base'],
}
}
class { 'lma_collector::collectd::memcached':
host => get_network_role_property('mgmt/memcache', 'ipaddr'),
require => Class['lma_collector::collectd::base'],
}
# Enable the Apache status module
class { 'fuel_lma_collector::mod_status': }
class { 'lma_collector::collectd::apache':
require => Class['lma_collector::collectd::base'],
}
# Check local endpoint
$cinder_api = get_network_role_property('cinder/api', 'ipaddr')
$glance_api = get_network_role_property('glance/api', 'ipaddr')
$heat_api = get_network_role_property('heat/api', 'ipaddr')
$keystone_api = get_network_role_property('keystone/api', 'ipaddr')
$neutron_api = get_network_role_property('neutron/api', 'ipaddr')
$nova_api = get_network_role_property('nova/api', 'ipaddr')
$swift_api = get_network_role_property('swift/api', 'ipaddr')
if $fuel_version < 9.0 {
$cinder_expected_code = 200
} else {
# Since Mitaka, Cinder returns 300 instead of 200 in previous releases
$cinder_expected_code = 300
}
class { 'lma_collector::collectd::check_local_endpoint':
urls => {
'cinder-api' => "http://${cinder_api}:8776",
'glance-api' => "http://${glance_api}:9292",
'heat-api' => "http://${heat_api}:8004",
'heat-cfn-api' => "http://${heat_api}:8000",
'keystone-public-api' => "http://${keystone_api}:5000",
'neutron-api' => "http://${neutron_api}:9696",
'nova-api' => "http://${nova_api}:8774",
'swift-api' => "http://${swift_api}:8080/info",
},
expected_codes => {
'cinder-api' => $cinder_expected_code,
'glance-api' => 300,
'heat-api' => 300,
'heat-cfn-api' => 300,
'keystone-public-api' => 300,
'neutron-api' => 200,
'nova-api' => 200,
'swift-api' => 200,
},
timeout => 1,
max_retries => 3,
require => Class['lma_collector::collectd::base'],
}
$influxdb_server = hiera('lma::collector::influxdb::server')
$influxdb_port = hiera('lma::collector::influxdb::port')
class { 'lma_collector::collectd::http_check':
urls => {
'influxdb-cluster' => "http://${influxdb_server}:${influxdb_port}/ping",
},
expected_codes => {
'influxdb-cluster' => 204
},
timeout => 1,
max_retries => 3,
pacemaker_master_resource => $pacemaker_master_resource,
require => Class['lma_collector::collectd::base'],
}
}
# Compute
if $is_compute {
class { 'lma_collector::collectd::libvirt':
require => Class['lma_collector::collectd::base'],
}
class { 'lma_collector::collectd::libvirt_check':
require => Class['lma_collector::collectd::base'],
}
}
# Ceph OSD
if $is_ceph_osd {
class { 'lma_collector::collectd::ceph_osd':
require => Class['lma_collector::collectd::base'],
}
}
# InfluxDB
if $is_influxdb_node {
class { 'lma_collector::collectd::influxdb':
username => 'root',
password => hiera('lma::collector::influxdb::root_password'),
address => hiera('lma::collector::influxdb::listen_address'),
port => hiera('lma::collector::influxdb::influxdb_port', 8086),
require => Class['lma_collector::collectd::base'],
}
}
# Elasticsearch
if $is_elasticsearch_node {
class { 'lma_collector::collectd::elasticsearch':
address => hiera('lma::collector::elasticsearch::listen_address'),
port => hiera('lma::collector::elasticsearch::rest_port', 9200),
require => Class['lma_collector::collectd::base'],
}
}
if $is_influxdb_node or $is_elasticsearch_node {
class { 'lma_collector::collectd::haproxy':
socket => $haproxy_socket,
require => Class['lma_collector::collectd::base'],
}
}
}

View File

@ -1,58 +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.
notice('fuel-plugin-lma-collector: compute.pp')
$ceilometer = hiera_hash('ceilometer', {})
if hiera('lma::collector::elasticsearch::server', false) {
lma_collector::logs::openstack { 'nova': }
lma_collector::logs::openstack { 'neutron': }
class { 'lma_collector::logs::libvirt': }
}
if hiera('lma::collector::influxdb::server', false) {
class { 'lma_collector::logs::counter':
hostname => $::hostname,
}
}
if $ceilometer['enabled'] {
$notification_topics = ['notifications', 'lma_notifications']
}
else {
$notification_topics = ['lma_notifications']
}
# OpenStack notifcations are always useful for indexation and metrics collection
include nova::params
$compute_service = $::nova::params::compute_service_name
nova_config { 'DEFAULT/notification_topics':
value => join($notification_topics, ','),
notify => Service[$compute_service],
}
nova_config { 'DEFAULT/notification_driver':
value => 'messaging',
notify => Service[$compute_service],
}
nova_config { 'DEFAULT/notify_on_state_change':
value => 'vm_and_task_state',
notify => Service[$compute_service],
}
service { $compute_service:
hasstatus => true,
hasrestart => true,
}

View File

@ -1,72 +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.
notice('fuel-plugin-lma-collector: configure_afd_filters.pp')
$lma = hiera_hash('lma_collector', {})
$node_profiles = hiera_hash('lma::collector::node_profiles')
$is_controller = $node_profiles['controller']
$is_mysql_server = $node_profiles['mysql']
$is_rabbitmq = $node_profiles['rabbitmq']
$alarms_definitions = $lma['alarms']
if $alarms_definitions == undef {
fail('Alarms definitions not found. Check files in /etc/hiera/override.')
}
if $is_controller or $is_rabbitmq or $is_mysql_server {
# On nodes where pacemaker is deployed, make sure the LMA service is
# configured with the "pacemaker" provider
Service<| title == 'log_collector' |> {
provider => 'pacemaker'
}
Service<| title == 'metric_collector' |> {
provider => 'pacemaker'
}
}
class { 'fuel_lma_collector::afds':
roles => hiera('roles'),
node_profiles => $lma['node_profiles'],
node_cluster_alarms => $lma['node_cluster_alarms'],
service_cluster_alarms => $lma['service_cluster_alarms'],
metrics => $lma['metrics'],
alarms => $alarms_definitions,
}
# Forward AFD status to Nagios if deployed
if hiera('lma::collector::infrastructure_alerting::server', false) {
lma_collector::afd_nagios { 'nodes':
ensure => present,
hostname => $::hostname,
server => hiera('lma::collector::infrastructure_alerting::server'),
http_port => hiera('lma::collector::infrastructure_alerting::http_port'),
http_path => hiera('lma::collector::infrastructure_alerting::http_path'),
user => hiera('lma::collector::infrastructure_alerting::user'),
password => hiera('lma::collector::infrastructure_alerting::password'),
service_template => '%{node_role}.%{source}',
message_type => 'afd_node_metric',
}
lma_collector::afd_nagios { 'services':
ensure => present,
hostname => $::hostname,
server => hiera('lma::collector::infrastructure_alerting::server'),
http_port => hiera('lma::collector::infrastructure_alerting::http_port'),
http_path => hiera('lma::collector::infrastructure_alerting::http_path'),
user => hiera('lma::collector::infrastructure_alerting::user'),
password => hiera('lma::collector::infrastructure_alerting::password'),
service_template => '%{service}.%{source}',
message_type => 'afd_service_metric',
}
}

View File

@ -1,31 +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.
notice('fuel-plugin-lma-collector: configure_apt.pp')
$str = 'APT::Install-Suggests "0";
APT::Install-Recommends "0";
'
case $::osfamily {
'Debian': {
file { '/etc/apt/apt.conf.d/99norecommends':
ensure => file,
content => $str,
}
}
default: {
# Currently only Debian like distributions need specific configuration.
}
}

View File

@ -1,329 +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.
notice('fuel-plugin-lma-collector: controller.pp')
$ceilometer = hiera_hash('ceilometer', {})
$lma_collector = hiera_hash('lma_collector')
$rabbit = hiera_hash('rabbit')
$storage_options = hiera_hash('storage', {})
$murano = hiera_hash('murano')
$sahara = hiera_hash('sahara')
if $ceilometer['enabled'] {
$notification_topics = ['notifications', 'lma_notifications']
}
else {
$notification_topics = ['lma_notifications']
}
# Make sure the Log and Metric collector services are configured with the
# "pacemaker" provider
Service<| title == 'log_collector' |> {
provider => 'pacemaker'
}
Service<| title == 'metric_collector' |> {
provider => 'pacemaker'
}
# OpenStack logs and notifications are useful for deriving metrics, so we enable
# them even if Elasticsearch is disabled.
if hiera('lma::collector::elasticsearch::server', false) or hiera('lma::collector::influxdb::server', false){
# Sahara notifications
if $sahara['enabled'] {
include sahara::params
$sahara_api_service = $::sahara::params::api_service_name
$sahara_engine_service = $::sahara::params::engine_service_name
sahara_config { 'DEFAULT/enable_notifications':
value => true,
notify => Service[$sahara_api_service, $sahara_engine_service],
}
sahara_config { 'DEFAULT/notification_topics':
value => $notification_topics,
notify => Service[$sahara_api_service, $sahara_engine_service],
}
sahara_config { 'DEFAULT/notification_driver':
value => 'messaging',
notify => Service[$sahara_api_service, $sahara_engine_service],
}
service { [$sahara_api_service, $sahara_engine_service]:
hasstatus => true,
hasrestart => true,
}
}
# Nova notifications
include nova::params
$nova_api_service = $::nova::params::api_service_name
$nova_conductor_service = $::nova::params::conductor_service_name
$nova_scheduler_service = $::nova::params::scheduler_service_name
nova_config { 'DEFAULT/notification_topics':
value => $notification_topics,
notify => Service[$nova_api_service, $nova_conductor_service, $nova_scheduler_service],
}
nova_config { 'DEFAULT/notification_driver':
value => 'messaging',
notify => Service[$nova_api_service, $nova_conductor_service, $nova_scheduler_service],
}
nova_config { 'DEFAULT/notify_on_state_change':
value => 'vm_and_task_state',
notify => Service[$nova_api_service, $nova_conductor_service, $nova_scheduler_service],
}
service { [$nova_api_service, $nova_conductor_service, $nova_scheduler_service]:
hasstatus => true,
hasrestart => true,
}
# Cinder notifications
include cinder::params
$cinder_api_service = $::cinder::params::api_service
$cinder_scheduler_service = $::cinder::params::scheduler_service
$cinder_volume_service = $::cinder::params::volume_service
if $storage_options['volumes_ceph'] {
# In this case, cinder-volume runs on controller node
$cinder_services = [$cinder_api_service, $cinder_scheduler_service, $cinder_volume_service]
} else {
$cinder_services = [$cinder_api_service, $cinder_scheduler_service]
}
cinder_config { 'DEFAULT/notification_topics':
value => $notification_topics,
notify => Service[$cinder_services],
}
cinder_config { 'DEFAULT/notification_driver':
value => 'messaging',
notify => Service[$cinder_services],
}
service { $cinder_services:
hasstatus => true,
hasrestart => true,
}
# Keystone notifications
# Keystone is executed as a WSGI application inside Apache so the Apache
# service needs to be restarted if necessary
include apache::params
include apache::service
keystone_config { 'DEFAULT/notification_topics':
value => $notification_topics,
notify => Class['apache::service'],
}
keystone_config { 'DEFAULT/notification_driver':
value => 'messaging',
notify => Class['apache::service'],
}
# Neutron notifications
include neutron::params
neutron_config { 'DEFAULT/notification_topics':
value => $notification_topics,
notify => Service[$::neutron::params::server_service],
}
neutron_config { 'DEFAULT/notification_driver':
value => 'messaging',
notify => Service[$::neutron::params::server_service],
}
# Enable pagination for Neutron
neutron_config { 'DEFAULT/allow_pagination':
value => true,
notify => Service[$::neutron::params::server_service],
}
neutron_config { 'DEFAULT/pagination_max_limit':
value => '100',
notify => Service[$::neutron::params::server_service],
}
service { $::neutron::params::server_service:
hasstatus => true,
hasrestart => true,
}
# Glance notifications
include glance::params
$glance_api_service = $::glance::params::api_service_name
$glance_registry_service = $::glance::params::registry_service_name
# Default value is 'image.localhost' for Glance
$glance_publisher_id = "image.${::hostname}"
glance_api_config { 'DEFAULT/notification_topics':
value => $notification_topics,
notify => Service[$glance_api_service],
}
glance_api_config { 'DEFAULT/notification_driver':
value => 'messaging',
notify => Service[$glance_api_service],
}
glance_api_config { 'DEFAULT/default_publisher_id':
value => $glance_publisher_id,
notify => Service[$glance_api_service],
}
glance_registry_config { 'DEFAULT/notification_topics':
value => $notification_topics,
notify => Service[$glance_registry_service],
}
glance_registry_config { 'DEFAULT/notification_driver':
value => 'messaging',
notify => Service[$glance_registry_service],
}
glance_registry_config { 'DEFAULT/default_publisher_id':
value => $glance_publisher_id,
notify => Service[$glance_registry_service],
}
service { [$glance_api_service, $glance_registry_service]:
hasstatus => true,
hasrestart => true,
}
# Heat notifications
include heat::params
$heat_api_service = $::heat::params::api_service_name
$heat_engine_service = $::heat::params::engine_service_name
heat_config { 'DEFAULT/notification_topics':
value => $notification_topics,
notify => Service[$heat_api_service, $heat_engine_service],
}
heat_config { 'DEFAULT/notification_driver':
value => 'messaging',
notify => Service[$heat_api_service, $heat_engine_service],
}
service { $heat_api_service:
hasstatus => true,
hasrestart => true,
}
# The heat-engine service is managed by Pacemaker.
service { $heat_engine_service:
hasstatus => true,
hasrestart => true,
provider => 'pacemaker',
}
lma_collector::logs::openstack { 'nova': }
# For every virtual network that exists, Neutron spawns one metadata proxy
# service that will log to a separate file in the Neutron log directory.
# Eventually it may be hundreds of these files and Heka will have trouble
# coping with the situation. See bug #1547402 for details.
lma_collector::logs::openstack { 'neutron':
service_match => '(dhcp-agent|l3-agent|metadata-agent|neutron-netns-cleanup|openvswitch-agent|server)',
}
lma_collector::logs::openstack { 'cinder': }
lma_collector::logs::openstack { 'glance': }
lma_collector::logs::openstack { 'heat': }
lma_collector::logs::openstack { 'keystone': }
class {'lma_collector::logs::keystone_wsgi': }
lma_collector::logs::openstack { 'horizon': }
if $murano['enabled'] {
lma_collector::logs::openstack { 'murano': }
}
if $sahara['enabled'] {
lma_collector::logs::openstack { 'sahara': }
}
if ! $storage_options['objects_ceph'] {
class { 'lma_collector::logs::swift':
file_match => 'swift-all\.log\.?(?P<Seq>\d*)$',
priority => '["^Seq"]',
}
}
class { 'lma_collector::logs::pacemaker': }
}
# Metrics
if hiera('lma::collector::influxdb::server', false) {
class { 'lma_collector::logs::counter':
hostname => $::hostname,
}
# TODO(all): This class is still called to ensure the sandbox deletion
# when upgrading the plugin. Can be removed for next release after 0.10.0.
class { 'lma_collector::logs::http_metrics': }
class { 'lma_collector::logs::aggregated_http_metrics': }
}
if hiera('lma::collector::infrastructure_alerting::server', false) {
$deployment_id = hiera('deployment_id')
lma_collector::gse_nagios { 'global':
openstack_deployment_name => $deployment_id,
server => hiera('lma::collector::infrastructure_alerting::server'),
http_port => hiera('lma::collector::infrastructure_alerting::http_port'),
http_path => hiera('lma::collector::infrastructure_alerting::http_path'),
user => hiera('lma::collector::infrastructure_alerting::user'),
password => hiera('lma::collector::infrastructure_alerting::password'),
message_type => $lma_collector['gse_cluster_global']['output_message_type'],
# Following parameter must match the lma_infrastructure_alerting::params::nagios_global_vhostname_prefix
virtual_hostname => '00-global-clusters',
}
lma_collector::gse_nagios { 'nodes':
openstack_deployment_name => $deployment_id,
server => hiera('lma::collector::infrastructure_alerting::server'),
http_port => hiera('lma::collector::infrastructure_alerting::http_port'),
http_path => hiera('lma::collector::infrastructure_alerting::http_path'),
user => hiera('lma::collector::infrastructure_alerting::user'),
password => hiera('lma::collector::infrastructure_alerting::password'),
message_type => $lma_collector['gse_cluster_node']['output_message_type'],
# Following parameter must match the lma_infrastructure_alerting::params::nagios_node_vhostname_prefix
virtual_hostname => '00-node-clusters',
}
# Purge remaining files from previous 0.10.x version
$toml_metric_collector_to_purge = prefix([
'filter-afd_api_backends.toml', 'filter-afd_api_endpoints.toml',
'filter-afd_service_rabbitmq_disk.toml',
'filter-afd_service_rabbitmq_memory.toml',
'filter-afd_service_rabbitmq_queue.toml',
'filter-afd_workers.toml',
'filter-service_heartbeat.toml',
'encoder-nagios_gse_global_clusters.toml',
'encoder-nagios_gse_node_clusters.toml',
'output-nagios_gse_global_clusters.toml',
'output-nagios_gse_node_clusters.toml',
], '/etc/metric_collector/')
file { $toml_metric_collector_to_purge:
ensure => absent,
} ->
lma_collector::gse_nagios { 'services':
openstack_deployment_name => $deployment_id,
server => hiera('lma::collector::infrastructure_alerting::server'),
http_port => hiera('lma::collector::infrastructure_alerting::http_port'),
http_path => hiera('lma::collector::infrastructure_alerting::http_path'),
user => hiera('lma::collector::infrastructure_alerting::user'),
password => hiera('lma::collector::infrastructure_alerting::password'),
message_type => $lma_collector['gse_cluster_service']['output_message_type'],
# Following parameter must match the lma_infrastructure_alerting::params::nagios_node_vhostname_prefix
virtual_hostname => '00-service-clusters',
}
}

View File

@ -1,253 +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.
notice('fuel-plugin-lma-collector: hiera_override.pp')
prepare_network_config(hiera_hash('network_scheme', {}))
$plugin_data = hiera_hash('lma_collector', undef)
if ($plugin_data) {
$network_metadata = hiera_hash('network_metadata')
$is_controller_node = roles_include(['controller', 'primary-controller'])
$is_base_os_node = roles_include('base-os')
$is_compute = roles_include('compute')
$is_ceph_osd = roles_include('ceph-osd')
$has_controller = count(get_nodes_hash_by_roles($network_metadata, ['primary-controller'])) > 0
# The detached RabbitMQ plugin has no primary role in 8.0
$has_detached_rabbitmq = count(get_nodes_hash_by_roles($network_metadata, ['primary-standalone-rabbitmq', 'standalone-rabbitmq'])) > 0
$has_detached_database = count(get_nodes_hash_by_roles($network_metadata, ['primary-standalone-database'])) > 0
if roles_include(['standalone-database', 'primary-standalone-database']) {
$is_mysql_node = true
} else {
$is_mysql_node = $is_controller_node and ! $has_detached_database
}
if roles_include(['standalone-rabbitmq', 'primary-standalone-rabbitmq']) {
$is_rabbitmq_node = true
} else {
$is_rabbitmq_node = $is_controller_node and ! $has_detached_rabbitmq
}
# Elasticsearch
$is_elasticsearch_node = roles_include(['elasticsearch_kibana', 'primary-elasticsearch_kibana'])
$es_listen_address = get_network_role_property('elasticsearch', 'ipaddr')
$elasticsearch_mode = $plugin_data['elasticsearch_mode']
$es_nodes = get_nodes_hash_by_roles($network_metadata, ['elasticsearch_kibana', 'primary-elasticsearch_kibana'])
$es_nodes_count = count($es_nodes)
case $elasticsearch_mode {
'remote': {
$es_server = $plugin_data['elasticsearch_address']
$monitor_elasticsearch = false
}
'local': {
$es_vip_name = 'es_vip_mgmt'
if $network_metadata['vips'][$es_vip_name] {
$es_server = $network_metadata['vips'][$es_vip_name]['ipaddr']
$monitor_elasticsearch = true
} elsif $es_nodes_count > 0 {
$es_server = $es_nodes[0]['internal_address']
$monitor_elasticsearch = true
} else {
$es_server = undef
$monitor_elasticsearch = false
}
}
default: {
fail("'${elasticsearch_mode}' mode not supported for Elasticsearch")
}
}
if $es_nodes_count > 0 or $es_server {
$es_is_deployed = true
} else {
$es_is_deployed = false
}
$es_flush_interval = 5
if $is_controller_node or hiera('debug', false) {
# Increase the flush count when debug level log is enabled or for
# controllers because OpenStack APIs + Pacemaker can generate many log
# messages.
$es_flush_count = 100
} else {
$es_flush_count = 10
}
# InfluxDB
$is_influxdb_node = roles_include(['influxdb_grafana', 'primary-influxdb_grafana'])
$influxdb_listen_address = get_network_role_property('influxdb_vip', 'ipaddr')
$influxdb_mode = $plugin_data['influxdb_mode']
$influxdb_nodes = get_nodes_hash_by_roles($network_metadata, ['influxdb_grafana', 'primary-influxdb_grafana'])
$influxdb_nodes_count = count($influxdb_nodes)
$influxdb_grafana = hiera_hash('influxdb_grafana', {})
case $influxdb_mode {
'remote': {
$influxdb_server = $plugin_data['influxdb_address']
$influxdb_database = $plugin_data['influxdb_database']
$influxdb_user = $plugin_data['influxdb_user']
$influxdb_password = $plugin_data['influxdb_password']
$monitor_influxdb = false
}
'local': {
$influxdb_vip_name = 'influxdb'
if $network_metadata['vips'][$influxdb_vip_name] {
$influxdb_server = $network_metadata['vips'][$influxdb_vip_name]['ipaddr']
$monitor_influxdb = true
} elsif $influxdb_nodes_count > 0 {
$influxdb_server = $influxdb_nodes[0]['internal_address']
$monitor_influxdb = true
} else {
$monitor_influxdb = false
$influxdb_server = undef
}
$influxdb_database = $influxdb_grafana['influxdb_dbname']
$influxdb_user = $influxdb_grafana['influxdb_username']
$influxdb_password = $influxdb_grafana['influxdb_userpass']
$influxdb_root_password = $influxdb_grafana['influxdb_rootpass']
}
default: {
fail("'${influxdb_mode}' mode not supported for InfluxDB")
}
}
if $influxdb_nodes_count > 0 or $influxdb_server {
$influxdb_is_deployed = true
} else {
$influxdb_is_deployed = false
}
if $has_controller {
$nova = hiera_hash('nova', {})
$mysql_username = 'nova'
$mysql_password = $nova['db_password']
$mysql_db = 'nova'
} elsif $is_mysql_node {
$influxdb_plugin = hiera_hash('influxdb_grafana', {})
if $influxdb_plugin['mysql_mode'] == 'local' {
# Use the Grafana credentials when the MySQL server is deployed in the
# same environment but without controller (eg dedicated environment scenario)
$mysql_username = $influxdb_plugin['mysql_username']
$mysql_password = $influxdb_plugin['mysql_password']
$mysql_db = $influxdb_plugin['mysql_dbname']
}
}
# Infrastructure Alerting
$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)
$infra_vip_name = 'infrastructure_alerting_mgmt_vip'
if $network_metadata['vips'][$infra_vip_name] {
$nagios_server = $network_metadata['vips'][$infra_vip_name]['ipaddr']
$nagios_password = $lma_infra_alerting['nagios_password']
} else {
$nagios_server = undef
}
if $infra_alerting_nodes_count > 0 and $nagios_server {
$nagios_is_deployed = true
} else {
$nagios_is_deployed = false
}
$hiera_file = '/etc/hiera/plugins/lma_collector.yaml'
$calculated_content = inline_template('
---
lma::collector::node_profiles:
controller: <%= @is_controller_node %>
influxdb: <%= @is_influxdb_node %>
elasticsearch: <%= @is_elasticsearch_node %>
rabbitmq: <%= @is_rabbitmq_node %>
mysql: <%= @is_mysql_node %>
base_os: <%= @is_base_os_node %>
compute: <%= @is_compute %>
ceph_osd: <%= @is_ceph_osd %>
lma::collector::monitor::mysql_db: <%= @mysql_db %>
lma::collector::monitor::mysql_username: <%= @mysql_username %>
lma::collector::monitor::mysql_password: <%= @mysql_password %>
lma::collector::monitor::mysql_socket: /var/run/mysqld/mysqld.sock
<% if @es_is_deployed -%>
lma::collector::elasticsearch::server: <%= @es_server %>
lma::collector::elasticsearch::rest_port: 9200
lma::collector::elasticsearch::flush_interval: <%= @es_flush_interval %>
lma::collector::elasticsearch::flush_count: <%= @es_flush_count %>
<% if @is_elasticsearch_node -%>
lma::collector::elasticsearch::listen_address: <%= @es_listen_address %>
<% end -%>
<% end -%>
<% if @influxdb_is_deployed -%>
lma::collector::influxdb::server: <%= @influxdb_server %>
lma::collector::influxdb::port: 8086
lma::collector::influxdb::database: <%= @influxdb_database %>
lma::collector::influxdb::user: <%= @influxdb_user %>
lma::collector::influxdb::password: <%= @influxdb_password %>
lma::collector::influxdb::root_password: <%= @influxdb_root_password %>
<% if @is_influxdb_node -%>
lma::collector::influxdb::listen_address: <%= @influxdb_listen_address %>
<% end -%>
<% end -%>
<% if @nagios_is_deployed -%>
lma::collector::infrastructure_alerting::server: <%= @nagios_server %>
lma::collector::infrastructure_alerting::http_port: 80
lma::collector::infrastructure_alerting::http_path: status
lma::collector::infrastructure_alerting::user: nagiosadmin
lma::collector::infrastructure_alerting::password: <%= @nagios_password %>
<% end -%>
')
file { $hiera_file:
ensure => file,
content => $calculated_content,
}
$storage_options = hiera_hash('storage', {})
$public_ssl = hiera('public_ssl', {})
$tls_enabled = $public_ssl['horizon'] or false
$ceilometer = hiera_hash('ceilometer', {})
$ceilometer_enabled = pick($ceilometer['enabled'], false)
$contrail_plugin = hiera('contrail', false)
# detach_rabbitmq_enabled is used in templates
$detach_rabbitmq = hiera('detach-rabbitmq', {})
$detach_rabbitmq_enabled = $detach_rabbitmq['metadata'] and $detach_rabbitmq['metadata']['enabled']
# detach_database_enabled is used in templates
$detach_database = hiera('detach-database', {})
$detach_database_enabled = $detach_database['metadata'] and $detach_database['metadata']['enabled']
fuel_lma_collector::hiera_data { 'clusters':
content => template('fuel_lma_collector/clusters.yaml.erb')
}
fuel_lma_collector::hiera_data { 'alarming':
content => template('fuel_lma_collector/alarming.yaml.erb')
}
fuel_lma_collector::hiera_data { 'node_profiles':
content => template('fuel_lma_collector/node_profiles.yaml.erb')
}
fuel_lma_collector::hiera_data { 'metrics':
content => template('fuel_lma_collector/metrics.yaml.erb')
}
# This file has been renamed 'clusters.yaml' and need to be removed
# for rolling upgrade
file { '/etc/hiera/override/gse_filters.yaml':
ensure => absent,
}
}

View File

@ -1,24 +0,0 @@
# Copyright 2016 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.
notice('fuel-plugin-lma-collector: install_ocf_scripts.pp')
file { 'ocf-lma_collector':
ensure => present,
source => 'puppet:///modules/lma_collector/ocf-lma_collector',
path => '/usr/lib/ocf/resource.d/fuel/ocf-lma_collector',
mode => '0755',
owner => 'root',
group => 'root',
}

View File

@ -1,9 +0,0 @@
fixtures:
repositories:
stdlib:
repo: "git://github.com/puppetlabs/puppetlabs-stdlib"
ref: "4.7.0"
symlinks:
fuel_lma_collector: "#{source_dir}"
lma_collector: "#{source_dir}/../lma_collector"
heka: "#{source_dir}/../heka"

View File

@ -1,8 +0,0 @@
spec/fixtures/modules/*
spec/fixtures/manifests/*
Gemfile.lock
tests/lua/mocks/date_time.lua
.bundle
tests/lua/mocks/inspect.lua
tests/lua/mocks/anomaly.lua
tests/lua/mocks/annotation.lua

View File

@ -1,27 +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.
source 'https://rubygems.org'
group :development, :test do
gem 'rake'
gem "puppet", ENV['PUPPET_VERSION'] || '~> 3.4.0'
gem 'rspec'
gem 'rspec-puppet'
gem 'rspec-puppet-facts'
# Newer puppetlabs_spec_helper depends on rubocop-rspec that requires ruby >= 2.2.0
gem 'puppetlabs_spec_helper', '~> 1.1.1'
# puppet-lint >= 2.2.0 don't support Puppet 3.x anymore
gem 'puppet-lint', '~> 2.1.0'
gem 'metadata-json-lint'
end

View File

@ -1,202 +0,0 @@
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.
"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:
(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.
You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS
APPENDIX: How to apply the Apache License to your work.
To apply the Apache License to your work, attach the following
boilerplate notice, with the fields enclosed by brackets "{}"
replaced with your own identifying information. (Don't include
the brackets!) The text should be enclosed in the appropriate
comment syntax for the file format. We also recommend that a
file or class name and description of purpose be included on the
same "printed page" as the copyright notice for easier
identification within third-party archives.
Copyright {yyyy} {name of copyright owner}
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.

View File

@ -1,29 +0,0 @@
# fuel_lma_collector
## Overview
The `fuel_lma_collector` module provides classes and defines to ease the
deployment of the LMA collectors in a Fuel environment.
## Usage
TBD
Limitations
-----------
License
-------
Licensed under the terms of the Apache License, version 2.0.
Contact
-------
Simon Pasquier, <spasquier@mirantis.com>
Support
-------
See the Contact section.

View File

@ -1,28 +0,0 @@
require 'puppetlabs_spec_helper/rake_tasks'
require 'puppet-lint/tasks/puppet-lint'
require 'puppet-syntax/tasks/puppet-syntax'
require 'metadata-json-lint/rake_task'
PuppetLint.configuration.fail_on_warnings = true
PuppetLint.configuration.send('disable_80chars')
PuppetLint.configuration.send('disable_class_inherits_from_params_class')
PuppetLint.configuration.send('disable_class_parameter_defaults')
exclude_paths = [
"pkg/**/*",
"vendor/**/*",
"spec/**/*",
]
Rake::Task[:lint].clear
PuppetLint::RakeTask.new :lint do |config|
config.ignore_paths = exclude_paths
end
PuppetSyntax.exclude_paths = exclude_paths
desc "Run metadata_lint, lint, syntax, and spec tests."
task :test => [
:metadata_lint,
:lint,
:syntax,
:spec,
]

View File

@ -1,467 +0,0 @@
#!/bin/bash
# Copyright 2016 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.
DIAG_DIR=/var/lma_diagnostics
rm -rf "$DIAG_DIR"
mkdir -p "$DIAG_DIR" || exit 1
ES_PORT=9200
INFLUXDB_PORT=8086
NUM_COLLECTORS=1
DIAG_LOG_FILENAME="$DIAG_DIR/diagnostics.log"
function log_info {
echo "$(date +%Y-%m-%d-%H-%M-%S) INFO $@" | tee -a $DIAG_LOG_FILENAME
}
function log_err {
echo "$(date +%Y-%m-%d-%H-%M-%S) ERROR $@" | tee -a $DIAG_LOG_FILENAME
}
log_info $(hostname) role $(hiera roles)
function has_collector {
if [ -d /etc/log_collector ]; then
NUM_COLLECTORS=2
return 0
fi
if [ -d /etc/lma_collector ]; then
return 0
fi
return 1
}
function has_collectd {
if [ -d /etc/collectd ]; then
return 0
fi
return 1
}
function has_influxdb {
if [ -d /etc/influxdb ]; then
return 0
fi
return 1
}
function has_elasticsearch {
if [ -d /etc/elasticsearch ]; then
return 0
fi
return 1
}
function has_nagios {
if [ -d /etc/nagios3 ]; then
return 0
fi
return 1
}
function has_pacemaker {
if which crm > /dev/null 2>&1; then
return 0
fi
return 1
}
function check_net_listen {
process=$1
out=$2
expect=${3:-1}
port=$4
if [ -n "$port" ]; then
netstat -apn | grep LISTEN | grep "$process"|grep -E ":$port" > "$out"
else
netstat -apn | grep LISTEN | grep "$process" > "$out"
port='any'
fi
cnt=$(cat "$out" | wc -l)
if [ "$cnt" -eq 0 ]; then
log_err "'$process' process does not LISTEN on port: $port"
elif [ "$cnt" -ne "$expect" ]; then
log_err "$cnt LISTEN ports for process $process, $expect expected on port: $port!"
else
log_info "$expect process(es) $process is/are listening on port $port"
fi
return $cnt
}
function check_process {
process=$1
out=$2
expect=${3:-1}
ps auxf | grep -v grep | grep -E -- "$process" > $out
cnt=$(ps auxf | grep -v grep | grep -E -- "$process" | wc -l)
if [ "$cnt" -eq 0 ]; then
log_err "'$process' process not found"
elif [ "$expect" != "any" ] && [ "$cnt" -ne "$expect" ]; then
log_err "$cnt '$process' processes found, $expect expected!"
else
log_info "$cnt process(es) '$process' found"
fi
return $cnt
}
function tail_file {
file="$1"
base_dir=${2:-$DIAG_DIR}
path=$(dirname "$file")
filename=$(basename "$file")
out="${base_dir}${path}/${filename}"
mkdir -p $(dirname "$out")
num=${3:-10000}
if [ -f "$file" ]; then
tail -n $num "$file" >> "$out" 2>&1
log_info "tail -n $num $file -> $out"
else
log_err "$file doesn't exist"
fi
return $?
}
function copy_file {
src="$1"
base_dir=${2:-$DIAG_DIR}
path=$(dirname "$src")
out_dir="${base_dir}${path}"
mkdir -p "$out_dir"
if [ -d "$src" ]; then
log_info "Copy directory $src -> $out_dir"
cp -rfL "$src" "$out_dir" 2>/dev/null || log_err "Failed to copy $src into $out_dir/"
elif [ -f "$src" ]; then
log_info "Copy file $src -> $out_dir/"
cp -fL "$src" "$out_dir" 2>/dev/null || log_err "Failed to copy $src into $out_dir/"
else
log_err "Fail to copy .. '$src' doesn't exist"
fi
}
function run_cmd {
cmd=$1
output_file=$2
to=${3:-11}
log_info "Running command: '$cmd' -> $output_file"
eval "timeout $to $cmd" > "$output_file" 2>&1
if [ $? -ne 0 ]; then
log_err "command failed: '$cmd', check $output_file"
return 1
fi
return 0
}
function diag_collectd {
log_info "** Collectd"
copy_file /etc/collectd
find "/usr/lib/collectd/" -name '*.py' | while read f; do
copy_file "$f"
done
diag_output="${DIAG_DIR}/diag.collectd"
mkdir -p "${diag_output}"
tail_file /var/log/collectd.log
check_process "collectd -C" "${diag_output}/processes"
check_process collectdmon "${diag_output}/processes"
}
function diag_influxdb {
log_info "** InfluxDB"
GRAFANA_PORT=8000
if grep lma::grafana::tls::enabled /etc/hiera/plugins/influxdb_grafana.yaml|grep false 2>&1 >/dev/null; then
FRONTEND_GRAFANA_PORT=80
else
FRONTEND_GRAFANA_PORT=443
fi
copy_file /etc/influxdb
tail_file /var/log/influxdb/influxd.log
diag_output="${DIAG_DIR}/diag.influxdb"
mkdir -p "${diag_output}"
check_process "/usr/bin/influxd" "${diag_output}/processes"
check_net_listen influxd "${diag_output}/netstat" 1 $INFLUXDB_PORT
listening=$?
if [ $listening -gt 0 ]; then
local_address=$(netstat -apn | grep LISTEN | grep ":$INFLUXDB_PORT" | awk '{print $4}')
run_cmd "curl -S -i $local_address/ping" "${diag_output}/test_ping" 5
if [ $? -ne 0 ]; then
log_err "Fail to reach Influxdb ($local_address)"
fi
fi
address=$(hiera lma::influxdb::vip)
if [ "$address" != "nil" ]; then
run_cmd "curl -S -i ${address}:${INFLUXDB_PORT}/ping" "${diag_output}/test_ping.vip" 5
if [ $? -ne 0 ]; then
log_err "Fail to reach Influxdb (${address}:${INFLUXDB_PORT})"
fi
fi
copy_file /etc/grafana
tail_file /var/log/grafana/grafana.log
diag_output="${DIAG_DIR}/diag.grafana"
mkdir -p "${diag_output}"
check_process grafana-server "${diag_output}/processes"
check_net_listen grafana "${diag_output}/netstat" 1 $GRAFANA_PORT
address=$(hiera lma::grafana::vip)
if [ $FRONTEND_GRAFANA_PORT == "443" ]; then
run_cmd "curl -S -k -i https://${address}:${FRONTEND_GRAFANA_PORT}/login" "${diag_output}/vip_test" 5
else
run_cmd "curl -S -i http://${address}:${FRONTEND_GRAFANA_PORT}/login" "${diag_output}/vip_test" 5
fi
if [ $? -ne 0 ]; then
log_err "Fail to reach Grafana ($address:$FRONTEND_GRAFANA_PORT)"
fi
}
function diag_elasticsearch {
log_info "** Elasticsearch"
copy_file /etc/elasticsearch
for l in $(ls /var/log/elasticsearch/es-01/*.log); do
tail_file "$l"
done
# Get previous logs
es_previous_logs=$(ls /var/log/elasticsearch/es-01/*.log.2* 2>/dev/null | tail -n 2 )
if [ -n "$es_previous_logs" ]; then
for l in ; do
tail_file "$l"
done
fi
diag_output="${DIAG_DIR}/diag.elasticsearch"
mkdir -p "${diag_output}"
check_process "-cp.*elasticsearch-.*\.jar" "${diag_output}/processes"
check_net_listen java "${diag_output}/netstat.$ES_PORT" 1 $ES_PORT
listening=$?
local_address=$(netstat -apn | grep LISTEN | grep ":$ES_PORT" | awk '{print $4}')
if [ $listening -gt 0 ]; then
run_cmd "curl -S -i $local_address/_cat/indices?v" "${diag_output}/indices" 5
run_cmd "curl -S -i $local_address/_cluster/health?pretty" "${diag_output}/cluster_health" 5
if [ $? -ne 0 ]; then
log_err "Fail to reach local Elasticsearch ($address)"
fi
fi
address=$(hiera lma::elasticsearch::vip)
if [ "$address" != "nil" ]; then
address="${address}:${ES_PORT}"
run_cmd "curl -S -i ${address}/_cluster/health?pretty" "${diag_output}/cluster_health.vip" 5
if [ $? -ne 0 ]; then
log_err "Fail to reach Elasticsearch through the VIP ($address)"
fi
fi
log_info "** Kibana"
KIBANA_PORT=5601
copy_file /opt/kibana/config
diag_output="${DIAG_DIR}/diag.kibana"
mkdir -p "$diag_output"
check_net_listen node "${diag_output}/netstat.${KIBANA_PORT}" 1 $KIBANA_PORT
}
function diag_collector {
log_info "** LMA Collector"
diag_output="${DIAG_DIR}/diag.collector"
mkdir -p "$diag_output"
check_process "hekad -config" "${diag_output}/processes" $NUM_COLLECTORS
# Dashboard
check_net_listen hekad "${diag_output}/netstat.4352" 1 4352
# HTTP input
check_net_listen hekad "${diag_output}/netstat.8325" 1 8325
if [ $NUM_COLLECTORS -eq 2 ]; then
# TCP metric input
check_net_listen hekad "${diag_output}/netstat.5567" 1 5567
# Dashboard
check_net_listen hekad "${diag_output}/netstat.4353" 1 4353
fi
etc_dir="/etc/lma_collector /etc/log_collector /etc/metric_collector"
for d in $etc_dir; do
if [ -d "$d" ]; then
copy_file "$d"
fi
done
for d in /usr/share/lma_collector /usr/share/lma_collector_modules; do
copy_file "$d"
done
cache_dir="/var/cache/lma_collector /var/cache/log_collector /var/cache/metric_collector"
for d in $cache_dir; do
if [ ! -d "$d" ]; then
continue
fi
collector_name=$(basename $d)
out="${diag_output}/${collector_name}.cache"
find "$d" -ls |grep -v "dashboard/" > "$out"
find "$d" -name checkpoint.txt | while read f; do
echo $f >> "$out"
cat $f >> "$out"
echo >> "$out"
done
done
log_file="/var/log/lma_collector.log /var/log/log_collector.log /var/log/metric_collector.log"
log_file="${log_file} /var/log/upstart/lma_collector.log /var/log/upstart/log_collector.log /var/log/upstart/metric_collector.log"
for l in $log_file; do
if [ -f "$l" ]; then
tail_file "$l"
fi
done
}
function diag_nagios {
log_info "** Nagios"
diag_output="${DIAG_DIR}/diag.nagios"
mkdir -p "$diag_output"
if grep tls_enabled /etc/hiera/plugins/lma_infrastructure_alerting.yaml|grep false 2>&1 >/dev/null; then
NAGIOS_PORT=80
else
NAGIOS_PORT=443
fi
copy_file /etc/nagios3/
copy_file /etc/apache2-nagios/
run_cmd "nagios3 -v /etc/nagios3/nagios.cfg" "$diag_output/configuration_validation"
if [ $? -ne 0 ]; then
log_err "Nagios configuration error"
fi
# Nagios/Apache2 are running only on one node at a time
if crm resource status nagios3 2>&1 |grep $(hostname)|grep "is running" >/dev/null; then
log_info "Nagios is running on this node"
check_process "nagios3 -d" "$diag_output/processes.nagios3"
check_process "apache2 -k" "$diag_output/processes.apache2" any
else
log_info "Nagios is running elsewhere"
fi
tail_file /var/nagios/nagios.log
tail_file /var/log/apache2/nagios_error.log
tail_file /var/log/apache2/nagios_access.log
tail_file /var/log/apache2/nagios_wsgi_error.log
tail_file /var/log/apache2/nagios_wsgi_access.log
wsgi_address=$(hiera lma::infrastructure_alerting::vip)
run_cmd "curl -S -i $wsgi_address:80/status" "${diag_output}/nagios_wsgi_test"
if [ $? -ne 0 ]; then
log_err "Fail to reach Apache/Nagios ($wsgi_address:80)"
fi
# NOTE: It is easier to get UI address from Apache configuration than
# from hiera, because hiera key lma::infrastructure_alerting::nagios_ui is a
# hash which was a bad idea.
ui_address=$(grep -v $wsgi_address /etc/apache2-nagios/port.confs|grep ':'|grep -v -E '^#'|awk '{print $2}')
if [ $NAGIOS_PORT == "443" ]; then
run_cmd "curl -S -k -i https://${ui_address}" "${diag_output}/nagios_ui_test"
else
run_cmd "curl -S -i http://${ui_address}" "${diag_output}/nagios_ui_test"
fi
if [ $? -ne 0 ]; then
log_err "Fail to reach Nagios UI ($ui_address)"
fi
}
function diag_pacemaker {
log_info "** Pacemaker"
diag_output="${DIAG_DIR}/diag.pacemaker"
mkdir -p "$diag_output"
run_cmd "crm status" "${diag_output}/status"
run_cmd "crm configure show" "${diag_output}/configuration"
tail_file /var/log/pacemaker.log
}
function diag_system {
log_info "** System"
seconds=10
diag_output="${DIAG_DIR}/diag.system"
mkdir -p "$diag_output"
run_cmd hostname "${diag_output}/hostname"
run_cmd uptime $diag_output/uptime
run_cmd "dmesg | tail -n 100" $diag_output/dmesg
run_cmd "vmstat 1 $seconds" $diag_output/vmstat
run_cmd "mpstat -P ALL 1 $seconds" $diag_output/mpstat
run_cmd "pidstat 1 $seconds" $diag_output/pidstat
run_cmd "iostat -xz 1 $seconds" $diag_output/iostat
run_cmd lshw $diag_output/lshw
run_cmd "df -h" $diag_output/df
run_cmd "crontab -l" $diag_output/crontab
copy_file /proc/cpuinfo
if which "iptables-save" >/dev/null; then
run_cmd iptables-save $diag_output/iptables
fi
find "/etc/hiera" -name '*.yaml' | while read f; do
copy_file "$f"
done
copy_file /etc/hiera.yaml
ls -l /etc/fuel/plugins > "${DIAG_DIR}/fuel_plugins"
tail_file /var/log/puppet.log
run_cmd 'grep -E "MODULAR|fuel-plugin-" /var/log/puppet.log' $diag_output/puppet_tasks.list
run_cmd "netstat -nalp" $diag_output/netstat
run_cmd "ip route" $diag_output/ip_route
run_cmd "ip link" $diag_output/ip_link
run_cmd "ip address" $diag_output/ip_address
run_cmd "ip netns" $diag_output/ip_netns
for netns in $(ip netns 2>/dev/null); do
run_cmd "ip netns exec $netns ip route" "$diag_output/netns_${netns}_ip_route"
run_cmd "ip netns exec $netns ip link" "$diag_output/netns_${netns}_ip_link"
run_cmd "ip netns exec $netns ip address" "$diag_output/netns_${netns}_ip_address"
done
if which "brctl" >/dev/null; then
run_cmd "brctl show" $diag_output/brctl_show
fi
}
if has_collector; then
diag_collector
fi
if has_pacemaker; then
diag_pacemaker
fi
if has_collectd; then
diag_collectd
fi
if has_influxdb; then
diag_influxdb
fi
if has_elasticsearch; then
diag_elasticsearch
fi
if has_nagios; then
diag_nagios
fi
if [ -d /etc/haproxy ]; then
copy_file /etc/haproxy
fi
diag_system
exit 0

View File

@ -1,170 +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.
#
#
# Returns a hash describing the AFD filter resources for the given inputs.
#
# ARG0: Hash table mapping AFD profiles to alarms
# ARG1: Array of alarm definitions
# ARG2: Array of AFD profiles
# ARG3: Type of AFD (either 'node' or 'service')
# ARG4: Hash table mapping metric names to the place where there are collected.
#
# Ex:
#
# ARG0:
# {"rabbitmq"=>{"apply_to_node" => "controller", "members" => {"queue"=> {"alarms" => ["rabbitmq-queue-warning"]}}},
# "apache"=>{"apply_to_node" => "controller", "members" => {"worker"=> {"alarms" => ["apache-warning"]}}},
# "memcached"=>{"apply_to_node"=>"controller", "members" => {"all"=> {"alarms" => ["memcached-warning"]}}},
# "haproxy"=>{"apply_to_node" => "controller", "members" => {"alive"=> {"alarms" => ["haproxy-warning"]}}}}
#
# ARG1:
#
# [
# {"name"=>"rabbitmq-queue-warning",
# "description"=>"Number of message in queues too high",
# "severity"=>"warning",
# "trigger"=>
# {"logical_operator"=>"or",
# "rules"=>
# [{"metric"=>"rabbitmq_messages",
# "relational_operator"=>">=",
# "threshold"=>200,
# "window"=>120,
# "periods"=>0,
# "function"=>"avg"}]}},
# {"name"=>"apache-warning",
# "description"=>"",
# "severity"=>"warning",
# "trigger"=>
# {"logical_operator"=>"or",
# "rules"=>
# [{"metric"=>"apache_idle_workers",
# "relational_operator"=>"=",
# "threshold"=>0,
# "window"=>60,
# "periods"=>0,
# "function"=>"min"},
# {"metric"=>"apache_status",
# "relational_operator"=>"=",
# "threshold"=>0,
# "window"=>60,
# "periods"=>0,
# "function"=>"min"}]}}
# ]
#
# ARG2: ["controller", "compute"]
#
# ARG3: type (node|service)
#
# ARG4: {"openstack_nova_total_free_vcpus" => {"collected_on": "aggregator"}}
#
# Results -> {
# 'rabbitmq_queue' => {
# 'type' => 'service',
# 'cluster_name' => 'rabbitmq',
# 'logical_name' => 'queue',
# 'alarms' => ['rabbitmq-queue-warning'],
# 'alarms_definitions' => {...},
# 'message_matcher' => "Fields[name] == 'rabbitmq_messages'"
# 'enable_notification' => true,
# 'activate_alerting' => true,
# },
# 'apache_worker' => {
# 'type' => 'service',
# 'cluster_name' => 'apache',
# 'logical_name' => 'worker',
# 'alarms' => ['apache-warning'],
# 'alarms_definitions' => {...},
# 'message_matcher' => "Fields[name] == 'apache_idle_workers' || Fields[name] == 'apache_status'"
# 'enable_notification' => true,
# 'activate_alerting' => true,
# }
# }
module Puppet::Parser::Functions
newfunction(:get_afd_filters, :type => :rvalue) do |args|
afd_alarms = args[0]
alarm_definitions = args[1]
afd_profiles = args[2]
type = args[3]
if not args[4]
metric_defs = {}
else
metric_defs = args[4]
end
afd_filters = {}
afd_alarms.each do |cluster_name , afds|
if afds.has_key?('apply_to_node')
default_profile = afds['apply_to_node']
else
default_profile = false
end
default_activate_alerting=true
default_enable_notification=false
if afds.has_key?('alerting')
if afds['alerting'] == 'disabled'
default_activate_alerting=false
elsif afds['alerting'] == 'enabled_with_notification'
default_enable_notification = true
end
end
afds['members'].each do |afd_name, alarms|
metrics = Set.new([])
matches = false
activate_alerting = default_activate_alerting
enable_notification = default_enable_notification
if alarms.has_key?('alerting')
if alarms['alerting'] == 'disabled'
activate_alerting=false
elsif alarms['alerting'] == 'enabled_with_notification'
enable_notification = true
end
end
alarms['alarms'].each do |a_name|
afd = alarm_definitions.select {|defi| defi['name'] == a_name}
next if afd.empty? # user mention an unknown alarm for this AFD
afd[0]['trigger']['rules'].each do |r|
if metric_defs.has_key?(r['metric']) and metric_defs[r['metric']].has_key?('collected_on') and afd_profiles.include? metric_defs[r['metric']]['collected_on']
matches = true
elsif afd_profiles.include?(default_profile)
matches = true
end
if matches
metrics << r['metric']
end
end
end
if matches
message_matcher = metrics.collect{|x| "Fields[name] == \'#{x}\'" }.join(' || ')
afd_filters["#{cluster_name}_#{afd_name}"] = {
'type' => type,
'cluster_name' => cluster_name,
'logical_name' => afd_name,
'alarms' => alarms['alarms'],
'alarms_definitions' => alarm_definitions,
'message_matcher' => message_matcher,
'activate_alerting' => activate_alerting,
'enable_notification' => enable_notification,
}
end
end
end
return afd_filters
end
end

View File

@ -1,53 +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.
#
#
# Returns an array containing the AFD profiles associated to a MOS role.
#
# ARG0: Hash of arrays that contains relation between AFD profile and node's roles.
# ARG1: Array of node's roles
#
# Ex:
#
# ARG0:
# {"controller"=>["primary-controller", "controller"],
# "compute"=>["compute"],
# "storage"=>["cinder", "ceph-osd"],
# "influxdb"=>["influxdb-grafana"]}
#
# ARG1: ['primary-controller']
#
# Results -> ['controller']
#
module Puppet::Parser::Functions
newfunction(:get_cluster_names, :type => :rvalue) do |args|
data = args[0]
roles = args[1]
raise Puppet::ParseError, "arg[0] isn't a hash" unless data.is_a?(Hash)
raise Puppet::ParseError, "arg[1] isn't an array" unless roles.is_a?(Array)
cluster_names = Set.new([])
roles.each do |role|
data.each do |k,v|
cluster_names << k if v['roles'].include?(role)
end
end
return cluster_names.to_a()
end
end

View File

@ -1,61 +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.
require 'yaml'
HIERA_CONFIG = '/etc/hiera.yaml'
Puppet::Type.type(:hiera_custom_source).provide(:ruby) do
desc "Support for Hiera source configuration"
defaultfor :kernel => 'Linux'
def sources
if @hiera.has_key?(:hierarchy)
return @hiera[:hierarchy]
elsif @hiera.has_key?('hierarchy')
return @hiera['hierarchy']
else
raise Puppet::Error, "No 'hierarchy' key in the Hiera configuration"
end
end
# Load the Hiera configuration
def load_hiera
@hiera = YAML.load_file(HIERA_CONFIG)
end
# Save the current Hiera configuration
def save_hiera
File.open(HIERA_CONFIG, 'w') do |file|
file.puts @hiera.to_yaml
end
end
def create
self.load_hiera
self.sources.insert(0, resource[:name])
self.save_hiera
end
def destroy
self.load_hiera
self.sources.select!{|x| x != resource[:name] }
self.save_hiera
end
def exists?
self.load_hiera
return self.sources.any?{|x| x == resource[:name] }
end
end

View File

@ -1,25 +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.
Puppet::Type.newtype(:hiera_custom_source) do
desc 'Manage Hiera sources'
ensurable
newparam(:name) do
desc 'The path to the Hiera source'
isnamevar
end
end

View File

@ -1,53 +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 fuel_lma_collector::afds (
$roles = undef,
$node_profiles = undef,
$node_cluster_alarms = undef,
$service_cluster_alarms = undef,
$alarms = undef,
$metrics = {},
){
validate_array($roles)
validate_hash($node_profiles)
validate_hash($node_cluster_alarms)
validate_hash($service_cluster_alarms)
validate_hash($metrics)
validate_array($alarms)
$clusters_tmp = get_cluster_names($node_profiles, $roles)
if size($clusters_tmp) == 0 {
$clusters = ['default']
} else {
$clusters = $clusters_tmp
}
$node_afd_filters = get_afd_filters($node_cluster_alarms,
$alarms,
$clusters,
'node',
$metrics)
$service_afd_filters = get_afd_filters($service_cluster_alarms,
$alarms,
$clusters,
'service',
$metrics)
create_resources(lma_collector::afd_filter, $node_afd_filters)
create_resources(lma_collector::afd_filter, $service_afd_filters)
}

View File

@ -1,54 +0,0 @@
# Copyright 2016 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 fuel_lma_collector::hiera_data (
$content,
$ensure = present,
) {
$hiera_directory = '/etc/hiera/override'
if $ensure == present {
$parsed_yaml = parseyaml($content)
if ! $parsed_yaml {
# With stlib <= 4.9, parseyaml() will raise an exception if the generated
# YAML is invalid so the Puppet parse will never get to the fail()
# instruction.
fail('Invalid YAML content!')
}
validate_hash($parsed_yaml)
validate_hash($parsed_yaml['lma_collector'])
}
if !defined(Package['ruby-deep-merge']){
package {'ruby-deep-merge':
ensure => 'installed',
}
}
if !defined(File[$hiera_directory]){
file { $hiera_directory:
ensure => directory,
}
}
file { "${hiera_directory}/${name}.yaml":
ensure => $ensure,
content => $content,
require => File[$hiera_directory],
}
hiera_custom_source { "override/${name}":
ensure => $ensure
}
}

View File

@ -1,64 +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: fuel_lma_collector::mod_status
#
# We don't use apache::mod_status because it requires to include the apache
# base class. And by doing this we would overwrite the Horizon configuration.
class fuel_lma_collector::mod_status (
$allow_from = $fuel_lma_collector::params::apache_allow_from,
) inherits fuel_lma_collector::params {
include apache::params
include apache::service
validate_array($allow_from)
$lib_path = $::apache::params::lib_path
$status_conf = "${::apache::params::mod_dir}/status.conf"
$status_load = "${::apache::params::mod_dir}/status.load"
if $::osfamily == 'debian' {
$status_conf_link = "${::apache::params::mod_enable_dir}/status.conf"
$status_load_link = "${::apache::params::mod_enable_dir}/status.load"
file { $status_conf_link:
ensure => link,
target => $status_conf,
require => File[$status_conf],
}
file { $status_load_link:
ensure => link,
target => $status_load,
require => File[$status_load],
notify => Class['apache::service'],
}
}
# This template uses $allow_from and $lib_path
file { $status_conf:
ensure => file,
content => template('fuel_lma_collector/apache/status.conf.erb'),
require => File[$status_load],
notify => Class['apache::service'],
}
file { $status_load:
ensure => file,
content => template('fuel_lma_collector/apache/status.load.erb'),
}
}

View File

@ -1,17 +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 fuel_lma_collector::params {
$apache_allow_from = ['127.0.0.1','::1']
}

View File

@ -1,28 +0,0 @@
# Copyright 2016 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 fuel_lma_collector::tools {
file { '/usr/local/bin/lma_diagnostics':
ensure => present,
source => 'puppet:///modules/fuel_lma_collector/diagnostics.sh',
mode => '0755',
owner => 'root',
group => 'root',
require => Package['sysstat'],
}
package {'sysstat':
ensure => installed,
}
}

View File

@ -1,24 +0,0 @@
{
"name": "mirantis-fuel_lma_collector",
"version": "1.0.0",
"author": "Simon Pasquier <spasquier@mirantis.com>",
"summary": "Puppet Fuel LMA Collector Module",
"license": "Apache-2.0",
"source": "https://git.openstack.org/cgit/openstack/fuel-plugin-lma-collector.git",
"project_page": "none",
"issues_url": "none",
"operatingsystem_support": [
{
"operatingsystem": "Ubuntu",
"operatingsystemrelease": ["14.04"]
}
],
"requirements": [
{"name": "puppet", "version_requirement": "3.x"}
],
"description": "Puppet module for configuring the LMA collector service in a Fuel deployment",
"dependencies": [
{"name": "mirantis/lma_collector", "version_requirement": "1.x"},
{"name": "puppetlabs/stdlib", "version_requirement": "4.x"}
]
}

View File

@ -1,153 +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.
require 'spec_helper'
describe 'fuel_lma_collector::afds' do
let(:facts) do
{:kernel => 'Linux', :operatingsystem => 'Ubuntu',
:osfamily => 'Debian'}
end
describe 'with defaults' do
let(:params) do
{:roles => ['primary-controller'],
:node_profiles => {'controller' => {'roles' => ['primary-controller']}},
:node_cluster_alarms => {
'controller' =>
{
'apply_to_node' => 'controller',
'members' => {
'cpu' => {
"alarms" => ['cpu_warning']
}
}
}
},
:service_cluster_alarms=> {
'mysql' => {
'apply_to_node' => 'controller',
'members' => {
'all' => {
"alarms" => ['db_warning']
}
}
}
},
:alarms => [
{"name"=>"cpu_warning",
"description"=>"Fake alarm",
"severity"=>"warning",
"trigger"=>
{"logical_operator"=>"or",
"rules"=>
[{"metric"=>"fake_cpu",
"relational_operator"=>">=",
"threshold"=>200,
"window"=>120,
"periods"=>0,
"function"=>"avg"}]}},
{"name"=>"db_warning",
"description"=>"Fake alarm",
"severity"=>"warning",
"trigger"=>
{"logical_operator"=>"or",
"rules"=>
[{"metric"=>"db-warning",
"relational_operator"=>">=",
"threshold"=>200,
"window"=>120,
"periods"=>0,
"function"=>"avg"}]}}]}
end
it { is_expected.to contain_heka__filter__sandbox('afd_node_controller_cpu') }
it { is_expected.to contain_file('/usr/share/lma_collector_modules/lma_alarms_controller_cpu.lua') }
it { is_expected.to contain_heka__filter__sandbox('afd_service_mysql_all') }
it { is_expected.to contain_file('/usr/share/lma_collector_modules/lma_alarms_mysql_all.lua') }
end
describe 'with enabled false' do
let(:params) do
{:roles => ['primary-controller'],
:node_profiles => {'controller' => {'roles' => ['primary-controller']}},
:node_cluster_alarms => {
'controller' => {
'apply_to_node' => 'controller',
'members' => {
'cpu' => {
"alarms" => ['cpu_warning']
}
}
}
},
:service_cluster_alarms => {},
:alarms => [
{"name"=>"cpu_warning",
"description"=>"Fake alarm",
"severity"=>"warning",
"enabled"=>"false",
"trigger"=>
{"logical_operator"=>"or",
"rules"=>
[{"metric"=>"fake_cpu",
"relational_operator"=>">=",
"threshold"=>200,
"window"=>120,
"periods"=>0,
"function"=>"avg"}]}}]}
end
it { is_expected.to contain_file('/usr/share/lma_collector_modules/lma_alarms_controller_cpu.lua').with_content(/local alarms = {\n}/) }
end
describe 'with profile per default' do
let(:params) do
{:roles => ['foo-role'],
:node_profiles => {'controller' => {'roles' => ['primary-controller']}},
:node_cluster_alarms => {
'others' =>
{
'apply_to_node' => 'default',
'members' => {
'cpu' => {
"alarms" => ['cpu_warning']
}
}
}
},
:service_cluster_alarms => {
},
:alarms => [
{"name"=>"cpu_warning",
"description"=>"Fake alarm",
"severity"=>"warning",
"trigger"=>
{"logical_operator"=>"or",
"rules"=>
[{"metric"=>"fake_cpu",
"relational_operator"=>">=",
"threshold"=>200,
"window"=>120,
"periods"=>0,
"function"=>"avg"}]}},
]}
end
it { is_expected.to contain_heka__filter__sandbox('afd_node_others_cpu') }
it { is_expected.to contain_file('/usr/share/lma_collector_modules/lma_alarms_others_cpu.lua') }
end
end

View File

@ -1,69 +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.
require 'spec_helper'
require 'yaml'
describe 'fuel_lma_collector::hiera_data' do
let(:title) { :foo }
let(:facts) do
{:kernel => 'Linux', :operatingsystem => 'Ubuntu',
:osfamily => 'Debian'}
end
describe 'with valid YAML' do
yaml =<<EOF
lma_collector:
some_parameter: 42
EOF
let(:params) do
{:content => yaml}
end
it { is_expected.to contain_file('/etc/hiera/override/foo.yaml') }
end
describe 'with invalid YAML' do
yaml =<<EOF
lma_collector:
some_parameter: "ee
EOF
let(:params) do
{:content => yaml}
end
it do
skip('needs stdlib >= 4.9.0')
is_expected.to raise_error(Psych::SyntaxError)
end
end
describe 'with data which is not a hash' do
yaml =<<EOF
lma_collector
EOF
let(:params) do
{:content => yaml}
end
it { is_expected.to raise_error(Puppet::Error) }
end
describe 'with missing key in YAML' do
yaml =<<EOF
not_lma_collector:
some_parameter: 42
EOF
let(:params) do
{:content => yaml}
end
it { is_expected.to raise_error(Puppet::Error) }
end
end

View File

@ -1,450 +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.
#
require 'spec_helper'
describe 'get_afd_filters' do
alarms_nodes = [
{"name"=>"cpu-critical-controller",
"description"=>"The CPU usage is too high (controller node)",
"severity"=>"critical",
"trigger"=>
{"logical_operator"=>"or",
"rules"=>
[
{"metric"=>"cpu_idle",
"relational_operator"=>"<=",
"threshold"=>5,
"window"=>120,
"periods"=>0,
"function"=>"avg"},
{"metric"=>"cpu_wait",
"relational_operator"=>">=",
"threshold"=>35,
"window"=>120,
"periods"=>0,
"function"=>"avg"},
]}},
{"name"=>"cpu-warning-controller",
"description"=>"The CPU usage is high (controller node)",
"severity"=>"warning",
"trigger"=>
{"logical_operator"=>"or",
"rules"=>
[
{"metric"=>"cpu_idle",
"relational_operator"=>"<=",
"threshold"=>15,
"window"=>120,
"periods"=>0,
"function"=>"avg"},
{"metric"=>"cpu_wait",
"relational_operator"=>">=",
"threshold"=>25,
"window"=>120,
"periods"=>0,
"function"=>"avg"},
]}},
{"name"=>"cpu-critical-compute",
"description"=>"The CPU usage is high (critical node)",
"severity"=>"critical",
"trigger"=>
{"logical_operator"=>"or",
"rules"=>
[
{"metric"=>"cpu_idle",
"relational_operator"=>"<=",
"threshold"=>30,
"window"=>120,
"periods"=>0,
"function"=>"avg"},
]}},
{"name"=>"cpu-warning-compute",
"description"=>"The CPU usage is high (compute node)",
"severity"=>"warning",
"trigger"=>
{"logical_operator"=>"or",
"rules"=>
[
{"metric"=>"cpu_idle",
"relational_operator"=>"<=",
"threshold"=>20,
"window"=>120,
"periods"=>0,
"function"=>"avg"},
]}},
{"name"=>"fs-critical",
"description"=>"The FS usage is critical",
"severity"=>"critical",
"trigger"=>
{"logical_operator"=>"or",
"rules"=>
[
{"metric"=>"fs_percent_free",
"relational_operator"=>"<=",
"threshold"=>8,
"window"=>120,
"periods"=>0,
"function"=>"avg"},
]}},
]
afds_nodes = {
"controller" => {
"apply_to_node" => "controller",
"alerting" => 'enabled',
"members" => {
"system" => {
"alerting" => 'enabled_with_notification',
"alarms" => ["cpu-critical-controller", "cpu-warning-controller"],
},
"foo" => {
"alarms" => ["cpu-critical-controller", "cpu-warning-controller"],
}
},
},
"compute" => {
"apply_to_node" => "compute",
"alerting" => 'enabled_with_notification',
"members" => {
"system" => {
"alarms" => ["cpu-critical-compute", "cpu-warning-compute"],
},
"fs" => {
"alarms" => ["fs-critical"],
}
},
}
}
describe 'For controller nodes' do
it { should run.with_params(afds_nodes, alarms_nodes, ['controller'], 'node')
.and_return(
{"controller_system"=>
{"type"=>"node",
"cluster_name"=>"controller",
"logical_name"=>"system",
"alarms"=>["cpu-critical-controller", "cpu-warning-controller"],
"alarms_definitions"=> alarms_nodes,
"message_matcher"=>"Fields[name] == 'cpu_idle' || Fields[name] == 'cpu_wait'",
"enable_notification" => true,
"activate_alerting" => true,
},
"controller_foo"=>
{"type"=>"node",
"cluster_name"=>"controller",
"logical_name"=>"foo",
"alarms"=>["cpu-critical-controller", "cpu-warning-controller"],
"alarms_definitions"=> alarms_nodes,
"message_matcher"=>"Fields[name] == 'cpu_idle' || Fields[name] == 'cpu_wait'",
"enable_notification" => false,
"activate_alerting" => true,
}
})
}
end
describe 'For compute nodes' do
it { should run.with_params(afds_nodes, alarms_nodes, ['compute'], 'node')
.and_return(
{"compute_system"=>
{"type"=>"node",
"cluster_name"=>"compute",
"logical_name"=>"system",
"alarms"=>["cpu-critical-compute", "cpu-warning-compute"],
"alarms_definitions"=> alarms_nodes,
"message_matcher"=>"Fields[name] == 'cpu_idle'",
"activate_alerting" => true,
"enable_notification" => true,
},
"compute_fs"=>
{"type"=>"node",
"cluster_name"=>"compute",
"logical_name"=>"fs",
"alarms"=>["fs-critical"],
"alarms_definitions"=> alarms_nodes,
"message_matcher"=>"Fields[name] == 'fs_percent_free'",
"activate_alerting" => true,
"enable_notification" => true,
}
})
}
end
describe 'For compute and controller nodes' do
it { should run.with_params(afds_nodes, alarms_nodes, ['compute', 'controller'], 'node')
.and_return(
{"compute_system"=>
{"type"=>"node",
"cluster_name"=>"compute",
"logical_name"=>"system",
"alarms"=>["cpu-critical-compute", "cpu-warning-compute"],
"alarms_definitions"=> alarms_nodes,
"message_matcher"=>"Fields[name] == 'cpu_idle'",
"activate_alerting" => true,
"enable_notification" => true,
},
"compute_fs"=>
{"type"=>"node",
"cluster_name"=>"compute",
"logical_name"=>"fs",
"alarms"=>["fs-critical"],
"alarms_definitions"=> alarms_nodes,
"message_matcher"=>"Fields[name] == 'fs_percent_free'",
"activate_alerting" => true,
"enable_notification" => true,
},
"controller_system"=>
{"type"=>"node",
"cluster_name"=>"controller",
"logical_name"=>"system",
"alarms"=>["cpu-critical-controller", "cpu-warning-controller"],
"alarms_definitions"=> alarms_nodes,
"message_matcher"=>"Fields[name] == 'cpu_idle' || Fields[name] == 'cpu_wait'",
"activate_alerting" => true,
"enable_notification" => true,
},
"controller_foo"=>
{"type"=>"node",
"cluster_name"=>"controller",
"logical_name"=>"foo",
"alarms"=>["cpu-critical-controller", "cpu-warning-controller"],
"alarms_definitions"=> alarms_nodes,
"message_matcher"=>"Fields[name] == 'cpu_idle' || Fields[name] == 'cpu_wait'",
"enable_notification" => false,
"activate_alerting" => true,
}
})
}
end
alarms_services = [
{"name"=>"rabbitmq-queue-warning",
"description"=>"Number of message in queues too high",
"severity"=>"warning",
"trigger"=>
{"logical_operator"=>"or",
"rules"=>
[{"metric"=>"rabbitmq_messages",
"relational_operator"=>">=",
"threshold"=>200,
"window"=>120,
"periods"=>0,
"function"=>"avg"}]}},
{"name"=>"apache-warning",
"description"=>"",
"severity"=>"warning",
"trigger"=>
{"logical_operator"=>"or",
"rules"=>
[{"metric"=>"apache_idle_workers",
"relational_operator"=>"=",
"threshold"=>0,
"window"=>60,
"periods"=>0,
"function"=>"min"},
{"metric"=>"apache_status",
"relational_operator"=>"=",
"threshold"=>0,
"window"=>60,
"periods"=>0,
"function"=>"min"}]}}
]
afds_services = {
"rabbitmq" => {
"apply_to_node" => "controller",
"alerting" => 'enabled',
"members" => {
"queue" => {
"alarms" => ["rabbitmq-queue-warning"]
}
},
},
"apache" => {
"apply_to_node" => "controller",
"alerting" => 'enabled',
"members" => {
"worker" => {
"alarms" => ['apache-warning'],
}
},
},
}
describe 'For services' do
it { should run.with_params(afds_services, alarms_services, ['controller'], 'service')
.and_return(
{
"rabbitmq_queue"=>
{
"type"=>"service",
"cluster_name"=>"rabbitmq",
"logical_name"=>"queue",
"alarms_definitions"=> alarms_services,
"alarms"=>["rabbitmq-queue-warning"],
"message_matcher"=>"Fields[name] == 'rabbitmq_messages'",
"activate_alerting" => true,
"enable_notification" => false,
},
"apache_worker"=>
{
"type"=>"service",
"cluster_name"=>"apache",
"logical_name"=>"worker",
"alarms_definitions"=> alarms_services,
"alarms"=>["apache-warning"],
"message_matcher"=>"Fields[name] == 'apache_idle_workers' || Fields[name] == 'apache_status'",
"activate_alerting" => true,
"enable_notification" => false,
}}
)
}
end
describe 'For services with apply_to_node overriden by metric collected_on' do
alarms_services_o = [
{"name"=>"free_vcpu_warning",
"description"=>"",
"severity"=>"warning",
"trigger"=>
{"logical_operator"=>"or",
"rules"=>
[{"metric"=>"free_vcpu",
"relational_operator"=>"<=",
"threshold"=>1,
"window"=>60,
"periods"=>0,
"function"=>"min"},
]}},
{"name"=>"total_free_vcpu_warning",
"description"=>"",
"severity"=>"warning",
"trigger"=>
{"logical_operator"=>"or",
"rules"=>
[{"metric"=>"total_free_vcpu",
"relational_operator"=>"<=",
"threshold"=>10,
"window"=>60,
"periods"=>0,
"function"=>"min"},
]}},
{"name"=>"cpu-critical-controller",
"description"=>"The CPU usage is high (critical node)",
"severity"=>"critical",
"trigger"=>
{"logical_operator"=>"or",
"rules"=>
[
{"metric"=>"cpu_idle",
"relational_operator"=>"<=",
"threshold"=>30,
"window"=>120,
"periods"=>0,
"function"=>"avg"},
]}},
{"name"=>"cpu-warning-controller",
"description"=>"The CPU usage is high (controller node)",
"severity"=>"warning",
"trigger"=>
{"logical_operator"=>"or",
"rules"=>
[
{"metric"=>"cpu_idle",
"relational_operator"=>"<=",
"threshold"=>20,
"window"=>120,
"periods"=>0,
"function"=>"avg"},
]}},
]
afds_services_overriden = {
"nova-free-resources" => {
"apply_to_node" => "compute",
"alerting" => 'enabled',
"members" => {
"free-vcpu" => {
"alerting" => 'disabled',
"alarms" => ['free_vcpu_warning'],
}
},
},
"nova-total-free-resources" => {
"alerting" => 'enabled',
"members" => {
"total-free-vcpu" => {
"alarms" => ['total_free_vcpu_warning'],
}
},
},
"controller" => {
"apply_to_node" => "controller",
"alerting" => 'enabled_with_notification',
"members" => {
"system" => {
"alarms" => ["cpu-critical-controller", "cpu-warning-controller"],
}
},
},
}
metrics = {
"free_vcpu" => {
"collected_on" => "controller"
},
"total_free_vcpu" => {
"collected_on" => "controller"
}
}
it { should run.with_params(afds_services_overriden, alarms_services_o, ['controller'], 'service', metrics)
.and_return(
{
"nova-free-resources_free-vcpu"=>
{
"type"=>"service",
"cluster_name"=>"nova-free-resources",
"logical_name"=>"free-vcpu",
"alarms_definitions"=> alarms_services_o,
"alarms"=>["free_vcpu_warning"],
"message_matcher"=>"Fields[name] == 'free_vcpu'",
"activate_alerting" => false,
"enable_notification" => false,
},
"nova-total-free-resources_total-free-vcpu"=>
{
"type"=>"service",
"cluster_name"=>"nova-total-free-resources",
"logical_name"=>"total-free-vcpu",
"alarms_definitions"=> alarms_services_o,
"alarms"=>["total_free_vcpu_warning"],
"message_matcher"=>"Fields[name] == 'total_free_vcpu'",
"activate_alerting" => true,
"enable_notification" => false,
},
"controller_system"=>
{
"type"=>"service",
"cluster_name"=>"controller",
"logical_name"=>"system",
"alarms"=>["cpu-critical-controller", "cpu-warning-controller"],
"alarms_definitions"=> alarms_services_o,
"message_matcher"=>"Fields[name] == 'cpu_idle'",
"enable_notification" => true,
"activate_alerting" => true,
}
}
)
}
end
end

View File

@ -1,6 +0,0 @@
--format
s
--colour
--loadby
mtime
--backtrace

View File

@ -1,22 +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.
require 'rspec-puppet'
fixture_path = File.expand_path(File.join(__FILE__, '..', 'fixtures'))
RSpec.configure do |c|
c.module_path = File.join(fixture_path, 'modules')
c.manifest_dir = File.join(fixture_path, 'manifests')
c.environmentpath = File.join(Dir.pwd, 'spec')
end

View File

@ -1,13 +0,0 @@
<Location /server-status>
SetHandler server-status
Order deny,allow
Deny from all
Allow from <%= @allow_from.join(" ") %>
</Location>
ExtendedStatus On
<IfModule mod_proxy.c>
# Show Proxy LoadBalancer status in mod_status
ProxyStatus On
</IfModule>

View File

@ -1 +0,0 @@
LoadModule status_module <%= @lib_path %>/mod_status.so

View File

@ -1,976 +0,0 @@
---
lma_collector:
# The GSE policies are applied to clusters and describe how the the GSE
# cluster filter computes the cluster's status. The LMA toolchain is
# pre-configured with a few set of policies but everything can be customized:
# thresholds can be modified, new policies can be defined, and so on.
#
# A policy consists of a list of rules which are evaluated against the
# current status of the cluster's members. When one of the rules matches, the
# cluster's status gets the value associated with the rule and the evaluation
# stops here. The last rule of the list is usually a catch-all rule that
# defines the default status in case no other rule matched.
#
# The declaration of a policy rule is similar to an alarm rule except that:
# - there are no 'metric', 'window' and 'period' parameters.
# - there are only 2 supported functions:
# - 'count' which returns the number of members that match the passed value(s)
# - 'percent' which returns the percentage of members that match the passed value(s)
#
# The following rule definition reads as "the cluster's status is critical if
# more than 50% of its members are either down or critical":
#
# - status: critical
# trigger:
# logical_operator: or
# rules:
# - function: percent
# arguments: [ down, critical ]
# relational_operator: '>'
# threshold: 50
#
gse_policies:
# A policy defining that the cluster's status depends on the member with the
# highest severity, typically used for a cluster of services.
highest_severity:
- status: down
trigger:
logical_operator: or
rules:
- function: count
arguments: [ down ]
relational_operator: '>'
threshold: 0
- status: critical
trigger:
logical_operator: or
rules:
- function: count
arguments: [ critical ]
relational_operator: '>'
threshold: 0
- status: warning
trigger:
logical_operator: or
rules:
- function: count
arguments: [ warning ]
relational_operator: '>'
threshold: 0
- status: okay
trigger:
logical_operator: or
rules:
- function: count
arguments: [ okay ]
relational_operator: '>'
threshold: 0
- status: unknown
# A policy which is typically used for clusters managed by Pacemaker
# with the no-quorum-policy set to 'stop'.
majority_of_members:
- status: down
trigger:
logical_operator: or
rules:
- function: percent
arguments: [ down ]
relational_operator: '>'
threshold: 50
- status: critical
trigger:
logical_operator: and
rules:
- function: percent
arguments: [ down, critical ]
relational_operator: '>'
threshold: 20
- function: percent
arguments: [ okay ]
relational_operator: '<'
threshold: 50
function: percent
- status: warning
trigger:
logical_operator: or
rules:
- function: percent
arguments: [ okay ]
relational_operator: '<'
threshold: 50
function: percent
- status: okay
# A policy that is used to derive a cluster status based
# on the status okay or down status for its members.
availability_of_members:
- status: down
trigger:
logical_operator: or
rules:
- function: count
arguments: [ okay ]
relational_operator: '=='
threshold: 0
- status: critical
trigger:
logical_operator: and
rules:
- function: count
arguments: [ okay ]
relational_operator: '=='
threshold: 1
- function: count
arguments: [ critical, down ]
relational_operator: '>'
threshold: 1
- status: warning
trigger:
logical_operator: or
rules:
- function: percent
arguments: [ okay ]
relational_operator: '<'
threshold: 100
- status: okay
trigger:
logical_operator: or
rules:
- function: percent
arguments: [ okay ]
relational_operator: '=='
threshold: 100
- status: unknown
# A policy that is used to derive a cluster status based
# on the health status of its members.
status_of_members:
- status: down
trigger:
logical_operator: or
rules:
- function: percent
arguments: [ down ]
relational_operator: '=='
threshold: 100
- status: critical
trigger:
logical_operator: and
rules:
- function: count
arguments: [ okay, warning ]
relational_operator: '<='
threshold: 1
- function: count
arguments: [ critical, down, unknown ]
relational_operator: '>'
threshold: 0
- status: warning
trigger:
logical_operator: or
rules:
- function: percent
arguments: [ okay ]
relational_operator: '!='
threshold: 100
- status: okay
trigger:
logical_operator: or
rules:
- function: percent
arguments: [ okay ]
relational_operator: '=='
threshold: 100
- status: unknown
# A policy that is typically used for storage or compute clusters
majority_of_node_members:
- status: down
trigger:
logical_operator: or
rules:
- function: percent
arguments: [ down ]
relational_operator: '=='
threshold: 100
- status: critical
trigger:
logical_operator: and
rules:
- function: percent
arguments: [ down, critical ]
relational_operator: '>='
threshold: 50
- status: warning
trigger:
logical_operator: or
rules:
- function: percent
arguments: [ down, critical, warning, unknown ]
relational_operator: '>'
threshold: 0
function: percent
- status: okay
gse_cluster_service:
input_message_types:
- afd_service_metric
aggregator_flag: true
# the field in the input messages to identify the cluster
cluster_field: service
# the field in the input messages to identify the cluster's member
member_field: source
output_message_type: gse_service_cluster_metric
output_metric_name: cluster_service_status
interval: 10
warm_up_period: 20
alerting: enabled
clusters:
nova-logs:
policy: highest_severity
group_by: hostname
members:
- error
nova-logs-compute:
policy: highest_severity
group_by: hostname
members:
- error
heat-logs:
policy: highest_severity
group_by: hostname
members:
- error
cinder-logs:
policy: highest_severity
group_by: hostname
members:
- error
glance-logs:
policy: highest_severity
group_by: hostname
members:
- error
neutron-logs:
policy: highest_severity
group_by: hostname
members:
- error
neutron-logs-compute:
policy: highest_severity
group_by: hostname
members:
- error
keystone-logs:
policy: highest_severity
group_by: hostname
members:
- error
mysqld-tcp:
policy: highest_severity
group_by: member
members:
- backends
mysql:
policy: majority_of_members
group_by: hostname
members:
- node-status
- check
haproxy-openstack:
policy: availability_of_members
group_by: hostname
members:
- check
apache:
policy: availability_of_members
group_by: hostname
members:
- worker
- check
memcached-service:
policy: availability_of_members
group_by: hostname
members:
- check
rabbitmq-cluster:
policy: highest_severity
group_by: member
members:
- memory
- disk
- queue
- pacemaker
rabbitmq-service:
# A check failure on a single node doesn't mean that the whole cluster
# is down, this is why a 'hostname' group_by and 'majority_of_members'
# policy are used here.
policy: majority_of_members
group_by: hostname
members:
- check
nova-api:
policy: highest_severity
group_by: member
members:
- backends
- http_errors
nova-api-check:
policy: highest_severity
group_by: member
members:
- vip
nova-api-endpoint:
policy: availability_of_members
group_by: hostname
members:
- endpoint
nova-novncproxy-websocket:
policy: highest_severity
group_by: member
members:
- backends
nova-metadata-api:
policy: highest_severity
group_by: member
members:
- backends
nova-scheduler:
policy: highest_severity
group_by: member
members:
- workers
nova-cert:
policy: highest_severity
group_by: member
members:
- workers
nova-consoleauth:
policy: highest_severity
group_by: member
members:
- workers
nova-compute:
policy: highest_severity
group_by: member
members:
- workers
nova-conductor:
policy: highest_severity
group_by: member
members:
- workers
# The AFDs are emitted by all the controller nodes because all of them
# collect the openstack_nova_instance_creation_time metric. Hence the
# service is considered not okay when a majority of controllers report
# not okay.
nova-instances:
policy: majority_of_members
group_by: hostname
members:
- creation-time
cinder-api:
policy: highest_severity
group_by: member
members:
- backends
- http_errors
cinder-api-check:
policy: highest_severity
group_by: member
members:
- vip
cinder-v2-api-check:
policy: highest_severity
group_by: member
members:
# Cinder V2 backends are in fact the same as the Cinder backends
- vip
cinder-api-endpoint:
policy: availability_of_members
group_by: hostname
members:
- endpoint
cinder-scheduler:
policy: highest_severity
group_by: member
members:
- workers
cinder-volume:
policy: highest_severity
group_by: member
members:
- workers
neutron-api:
policy: highest_severity
group_by: member
members:
- backends
- http_errors
neutron-api-check:
policy: highest_severity
group_by: member
members:
- vip
neutron-api-endpoint:
policy: availability_of_members
group_by: hostname
members:
- endpoint
neutron-l3:
policy: highest_severity
group_by: member
members:
- workers
neutron-dhcp:
policy: highest_severity
group_by: member
members:
- workers
neutron-metadata:
policy: highest_severity
group_by: member
members:
- workers
<% if not @contrail_plugin then -%>
neutron-openvswitch:
policy: highest_severity
group_by: member
members:
- workers
<% end -%>
keystone-response-time:
policy: highest_severity
group_by: member
members:
- duration
keystone-public-api:
policy: highest_severity
group_by: member
members:
- backends
- http_errors
keystone-public-api-check:
policy: highest_severity
group_by: member
members:
- vip
keystone-public-api-endpoint:
policy: availability_of_members
group_by: hostname
members:
- endpoint
keystone-admin-api:
policy: highest_severity
group_by: member
members:
# TODO(pasquier-s): add a metric reporting the status of the keystone-admin-api vip
- backends
- http_errors
glance-api:
policy: highest_severity
group_by: member
members:
- backends
- http_errors
glance-api-check:
policy: highest_severity
group_by: member
members:
- vip
glance-api-endpoint:
policy: availability_of_members
group_by: hostname
members:
- endpoint
glance-registry-api:
policy: highest_severity
group_by: member
members:
- backends
heat-api:
policy: highest_severity
group_by: member
members:
- backends
- http_errors
heat-api-check:
policy: highest_severity
group_by: member
members:
- vip
heat-api-endpoint:
policy: availability_of_members
group_by: hostname
members:
- endpoint
heat-cfn-api:
policy: highest_severity
group_by: member
members:
- backends
heat-cfn-api-check:
policy: highest_severity
group_by: member
members:
- vip
heat-cfn-api-endpoint:
policy: availability_of_members
group_by: hostname
members:
- endpoint
heat-cloudwatch-api:
policy: highest_severity
group_by: member
members:
- backends
<% if @tls_enabled then -%>
horizon-https:
<% else -%>
horizon-web:
<% end -%>
policy: highest_severity
group_by: member
members:
- backends
- http_errors
<% if not @storage_options["objects_ceph"] then -%>
swift-api:
policy: highest_severity
group_by: member
members:
- backends
- http_errors
swift-api-check:
policy: highest_severity
group_by: member
members:
- vip
swift-s3-api-check:
policy: highest_severity
group_by: member
members:
# Swift S3 backends are in fact the same as the Swift backends
- vip
swift-api-endpoint:
policy: availability_of_members
group_by: hostname
members:
- endpoint
<% end -%>
<% if @ceilometer_enabled -%>
ceilometer-api:
policy: highest_severity
group_by: member
members:
- backends
ceilometer-api-check:
policy: highest_severity
group_by: member
members:
- vip
<% end -%>
<% if @storage_options["volumes_ceph"] then -%>
ceph-mon-cluster:
policy: highest_severity
group_by: member
members:
- health
- capacity
ceph-mon-service:
policy: availability_of_members
group_by: hostname
members:
- check
ceph-osd-service:
policy: availability_of_members
group_by: hostname
members:
- check
<% end -%>
<% if @monitor_elasticsearch -%>
elasticsearch-cluster:
policy: highest_severity
group_by: member
members:
- health
elasticsearch-service:
policy: availability_of_members
group_by: hostname
members:
- check
<% end -%>
<% if @monitor_influxdb -%>
influxdb-api-check:
policy: highest_severity
group_by: member
members:
- vip
influxdb-service:
policy: availability_of_members
group_by: hostname
members:
- check
<% end -%>
pacemaker-service:
policy: availability_of_members
group_by: hostname
members:
- check
libvirt-service:
policy: majority_of_node_members
group_by: hostname
members:
- check
nova-free-vcpu:
policy: highest_severity
group_by: member
members:
- nova-free-vcpu
nova-free-memory:
policy: highest_severity
group_by: member
members:
- nova-free-memory
- nova-aggregates-free-memory
gse_cluster_node:
input_message_types:
- afd_node_metric
aggregator_flag: true
# the field in the input messages to identify the cluster
cluster_field: node_role
# the field in the input messages to identify the cluster's member
member_field: source
output_message_type: gse_node_cluster_metric
output_metric_name: cluster_node_status
interval: 10
warm_up_period: 80
alerting: enabled_with_notification
clusters:
controller:
policy: status_of_members
group_by: hostname
members:
- cpu
- network-rx
- network-tx
- root-fs
- log-fs
- other-fs
- swap
- hdd-errors
<% if @detach_rabbitmq_enabled -%>
rabbitmq-nodes:
policy: status_of_members
group_by: hostname
members:
- cpu
- network-rx
- network-tx
- root-fs
- other-fs
- swap
- hdd-errors
<% end -%>
mysql-nodes:
policy: status_of_members
group_by: hostname
members:
<% if @detach_database_enabled -%>
- cpu
- network-rx
- network-tx
- root-fs
- other-fs
- swap
- hdd-errors
<% end -%>
- mysql-fs
compute:
policy: majority_of_node_members
group_by: hostname
members:
- cpu
- network-rx
- network-tx
- root-fs
- nova-fs
- other-fs
- swap
- hdd-errors
storage:
policy: majority_of_node_members
group_by: hostname
members:
- cpu
- network-rx
- network-tx
- root-fs
- other-fs
- swap
- hdd-errors
<% if @storage_options["volumes_ceph"] then -%>
- osd-disk
<% end -%>
<% if @monitor_elasticsearch -%>
elasticsearch-nodes:
policy: status_of_members
group_by: hostname
members:
- data-fs
- root-fs
- cpu
- network-rx
- network-tx
- swap
- hdd-errors
<% end -%>
<% if @monitor_influxdb -%>
influxdb-nodes:
policy: status_of_members
group_by: hostname
members:
- data-fs
- root-fs
- cpu
- network-rx
- network-tx
- swap
- hdd-errors
<% end -%>
gse_cluster_global:
input_message_types:
- gse_service_cluster_metric
- gse_node_cluster_metric
aggregator_flag: false
# the field in the input messages to identify the cluster's member
member_field: cluster_name
output_message_type: gse_cluster_metric
output_metric_name: cluster_status
interval: 10
warm_up_period: 30
alerting: enabled_with_notification
clusters:
mysql:
policy: highest_severity
group_by: member
members:
- mysqld-tcp
- mysql
haproxy-openstack:
policy: highest_severity
group_by: member
members:
- haproxy-openstack
apache:
policy: highest_severity
group_by: member
members:
- apache
memcached:
policy: highest_severity
group_by: member
members:
- memcached-service
rabbitmq:
policy: highest_severity
group_by: member
members:
- rabbitmq-cluster
- rabbitmq-service
nova-control-plane:
policy: highest_severity
group_by: member
members:
- nova-logs
- nova-api # backends and http errors
- nova-api-check # vip check
- nova-api-endpoint # local check
- nova-metadata-api # worker
- nova-scheduler # worker
- nova-conductor # worker
- nova-cert # worker
- nova-consoleauth # worker
- nova-novncproxy-websocket # worker
hints:
- cinder-control-plane
- glance
- keystone
- neutron-control-plane
- mysql
- rabbitmq
nova-data-plane:
policy: highest_severity
group_by: member
members:
- nova-logs-compute
- nova-compute
- nova-instances
- libvirt-service
- nova-free-vcpu
- nova-free-memory
- nova-aggregates-free-memory
hints:
- neutron-data-plane
cinder-control-plane:
policy: highest_severity
group_by: member
members:
- cinder-logs
- cinder-api
- cinder-api-check
- cinder-v2-api-check
- cinder-api-endpoint
- cinder-scheduler
hints:
- keystone
- mysql
- rabbitmq
<% if not @storage_options["volumes_ceph"] then -%>
cinder-data-plane:
policy: highest_severity
group_by: member
members:
- cinder-volume-logs
- cinder-volume
<% end -%>
neutron-control-plane:
policy: highest_severity
group_by: member
members:
- neutron-logs
- neutron-api
- neutron-api-check
- neutron-api-endpoint
<% if not @contrail_plugin then -%>
- neutron-l3
- neutron-dhcp
- neutron-metadata
- neutron-openvswitch
<% end -%>
hints:
- keystone
- mysql
- rabbitmq
neutron-data-plane:
policy: highest_severity
group_by: member
members:
- neutron-logs-compute
<% if not @contrail_plugin then -%>
- neutron-openvswitch
<% end -%>
keystone:
policy: highest_severity
group_by: member
members:
- keystone-logs
- keystone-response-time
- keystone-public-api
- keystone-public-api-check
- keystone-public-api-endpoint
- keystone-admin-api
hints:
- mysql
- apache
glance:
policy: highest_severity
group_by: member
members:
- glance-logs
- glance-api
- glance-api-check
- glance-api-endpoint
- glance-registry-api
hints:
- keystone
- mysql
heat:
policy: highest_severity
group_by: member
members:
- heat-logs
- heat-api
- heat-api-check
- heat-api-endpoint
- heat-cfn-api
- heat-cfn-api-check
- heat-cfn-api-endpoint
- heat-cloudwatch-api
hints:
- cinder-control-plane
- glance
- keystone
- neutron-control-plane
- nova-control-plane
- mysql
- rabbitmq
horizon:
policy: highest_severity
group_by: member
members:
<% if @tls_enabled then -%>
- horizon-https
<% else -%>
- horizon-web
<% end -%>
hints:
- keystone
- apache
<% if not @storage_options["objects_ceph"] then -%>
swift:
policy: highest_severity
group_by: member
members:
- swift-api
- swift-api-check
- swift-s3-api-check
- swift-api-endpoint
hints:
- keystone
<% end -%>
<% if @ceilometer_enabled -%>
ceilometer:
policy: highest_severity
group_by: member
members:
- ceilometer-api
- ceilometer-api-check
hints:
- keystone
- rabbitmq
<% end -%>
<% if @storage_options["volumes_ceph"] then -%>
ceph:
policy: highest_severity
group_by: member
members:
- ceph-mon-cluster
- ceph-mon-service
- ceph-osd-service
<% end -%>
<% if @monitor_elasticsearch -%>
elasticsearch:
policy: highest_severity
group_by: member
members:
- elasticsearch-cluster
- elasticsearch-service
<% end -%>
<% if @monitor_influxdb -%>
influxdb:
policy: highest_severity
group_by: member
members:
- influxdb-api-check
- influxdb-service
<% end -%>
pacemaker:
policy: highest_severity
group_by: member
members:
- pacemaker-service

View File

@ -1,21 +0,0 @@
---
lma_collector:
metrics:
openstack_nova_total_free_vcpus:
collected_on: aggregator
openstack_nova_total_free_ram:
collected_on: aggregator
openstack_nova_aggregate_free_ram_percent:
collected_on: aggregator
http_check:
collected_on: aggregator
openstack_check_api:
collected_on: aggregator
openstack_nova_services:
collected_on: aggregator
openstack_cinder_services:
collected_on: aggregator
openstack_neutron_agents:
collected_on: aggregator
pacemaker_resource_percent:
collected_on: aggregator

View File

@ -1,45 +0,0 @@
---
lma_collector:
# Fuel roles mapping to alarm evaluator key.
node_profiles:
controller:
roles: ['primary-controller', 'controller']
description: 'The Controller nodes'
mysql-nodes:
<% if @detach_database_enabled -%>
roles: ['primary-standalone-database', 'standalone-database']
<% else -%>
roles: ['primary-controller', 'controller']
<% end -%>
description: 'The MySQL nodes'
rabbitmq-nodes:
<% if @detach_rabbitmq_enabled -%>
roles: ['primary-standalone-rabbitmq', 'standalone-rabbitmq']
<% else -%>
roles: ['primary-controller', 'controller']
<% end -%>
description: 'The RabbitMQ nodes'
<% if @storage_options["volumes_ceph"] then -%>
ceph-mon:
roles: ['primary-controller', 'controller']
description: 'The Ceph monitor nodes'
<% end -%>
compute:
roles: ['compute']
description: 'The Compute nodes'
storage:
roles: ['cinder', 'ceph-osd']
description: 'The Storage nodes (either Cinder of Ceph-OSD)'
elasticsearch-nodes:
roles: ['primary-elasticsearch_kibana', 'elasticsearch_kibana']
description: 'The Elasticsearch and Kibana nodes'
influxdb-nodes:
roles: ['primary-influxdb_grafana', 'influxdb_grafana']
description: 'The InfluxDB and Grafana nodes'
aggregator:
roles: ['primary-controller', 'controller']
description: 'The Aggregator nodes'
default:
roles: []
description: 'The default profile includes all nodes which are not falling into a definied profile'

View File

@ -1,7 +0,0 @@
fixtures:
repositories:
stdlib:
repo: "git://github.com/puppetlabs/puppetlabs-stdlib"
ref: "4.7.0"
symlinks:
heka: "#{source_dir}"

View File

@ -1,4 +0,0 @@
spec/fixtures/modules/*
spec/fixtures/manifests/*
Gemfile.lock
.bundle

View File

@ -1,27 +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.
source 'https://rubygems.org'
group :development, :test do
gem 'rake'
gem "puppet", ENV['PUPPET_VERSION'] || '~> 3.4.0'
gem 'rspec'
gem 'rspec-puppet'
gem 'rspec-puppet-facts'
# Newer puppetlabs_spec_helper depends on rubocop-rspec that requires ruby >= 2.2.0
gem 'puppetlabs_spec_helper', '~> 1.1.1'
# puppet-lint >= 2.2.0 don't support Puppet 3.x anymore
gem 'puppet-lint', '~> 2.1.0'
gem 'metadata-json-lint'
end

View File

@ -1,202 +0,0 @@
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.
"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:
(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.
You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS
APPENDIX: How to apply the Apache License to your work.
To apply the Apache License to your work, attach the following
boilerplate notice, with the fields enclosed by brackets "{}"
replaced with your own identifying information. (Don't include
the brackets!) The text should be enclosed in the appropriate
comment syntax for the file format. We also recommend that a
file or class name and description of purpose be included on the
same "printed page" as the copyright notice for easier
identification within third-party archives.
Copyright {yyyy} {name of copyright owner}
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.

View File

@ -1,49 +0,0 @@
Heka module for Puppet
======================
Description
-----------
Puppet module for configuring Heka.
Usage
-----
To deploy the Heka service on a host.
```puppet
# Configure the base heka service
class {'heka':
}
```
Limitations
-----------
This module supports only Fuel-based deployments using Neutron.
License
-------
Licensed under the terms of the Apache License, version 2.0.
Limitations
-----------
None
License
-------
Licensed under the terms of the Apache License, version 2.0.
Contact
-------
Simon Pasquier, <spasquier@mirantis.com>
Support
-------
See the Contact section.

View File

@ -1,28 +0,0 @@
require 'puppetlabs_spec_helper/rake_tasks'
require 'puppet-lint/tasks/puppet-lint'
require 'puppet-syntax/tasks/puppet-syntax'
require 'metadata-json-lint/rake_task'
PuppetLint.configuration.fail_on_warnings = true
PuppetLint.configuration.send('disable_80chars')
PuppetLint.configuration.send('disable_class_inherits_from_params_class')
PuppetLint.configuration.send('disable_class_parameter_defaults')
exclude_paths = [
"pkg/**/*",
"vendor/**/*",
"spec/**/*",
]
Rake::Task[:lint].clear
PuppetLint::RakeTask.new :lint do |config|
config.ignore_paths = exclude_paths
end
PuppetSyntax.exclude_paths = exclude_paths
desc "Run metadata_lint, lint, syntax, and spec tests."
task :test => [
:metadata_lint,
:lint,
:syntax,
:spec,
]

View File

@ -1,71 +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.
#
module Puppet::Parser::Functions
newfunction(:validate_buffering, :doc => <<-'ENDHEREDOC') do |args|
Validate that the parameters used for buffering are consistent.
The function takes 3 arguments:
- max_buffer_size
- max_file_size
- full_action
In practice, max_buffer_size must be greater than max_file_size.
The following values will pass:
$max_buffer_size = 2048
$max_file_size = 1024
validate_buffering($max_buffer_size, $max_file_size, 'drop')
The following values will fail:
$max_buffer_size = 1024
$max_file_size = 2048
validate_buffering($max_buffer_size, $max_file_size, 'drop')
$max_buffer_size = 2048
$max_file_size = 1024
validate_buffering($max_buffer_size, $max_file_size, 'foo')
ENDHEREDOC
unless args.length == 3 then
raise Puppet::ParseError, ("validate_buffering(): wrong number of arguments (#{args.length}; must be 3)")
end
unless args[0].to_s =~ /^\d+$/ then
raise Puppet::ParseError, ("validate_buffering(): bad argument (#{args[0]}}; must be integer)")
end
max_buffer_size = args[0].to_i
# When passing undef as args[1], it will be seen as the empty string and
# evaluated as 0 which means no limit
unless args[1].to_s =~ /^\d*$/ then
raise Puppet::ParseError, ("validate_buffering(): bad argument (#{args[0]}}; must be integer)")
end
max_file_size = args[1].to_i
max_file_size = 512 * 1024 * 1024 if max_file_size == 0
if max_buffer_size > 0 and max_buffer_size < max_file_size then
raise(Puppet::ParseError, "validate_buffering(): max_buffer_size (" +
"#{max_buffer_size}) should be greater than max_file_size (#{max_file_size})")
end
unless ["drop", "shutdown", "block"].include?(args[2]) then
raise(Puppet::ParseError, "validate_buffering(): full_action (" +
"#{args[2]}) should be either drop, shutdown or block")
end
end
end

View File

@ -1,43 +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::decoder::multidecoder (
$config_dir,
$subs = [],
$log_sub_errors = true,
$cascade_strategy = 'all',
$ensure = present,
) {
include heka::params
validate_array($subs)
validate_string($cascade_strategy)
validate_bool($log_sub_errors)
if size($subs) < 1 {
fail('subs parameter must be greater than 0')
}
if $cascade_strategy != 'all' and $cascade_strategy != 'first-wins' {
fail('cascade_strategy parameter must be either \'all\' or \'first-wins\'')
}
file { "${config_dir}/multidecoder-${title}.toml":
ensure => $ensure,
content => template('heka/decoder/multidecoder.toml.erb'),
mode => '0600',
owner => $heka::params::user,
group => $heka::params::user,
}
}

View File

@ -1,34 +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::decoder::sandbox (
$config_dir,
$filename,
$config = {},
$module_directory = undef,
$ensure = present,
) {
include heka::params
validate_hash($config)
file { "${config_dir}/decoder-${title}.toml":
ensure => $ensure,
content => template('heka/decoder/sandbox.toml.erb'),
mode => '0600',
owner => $heka::params::user,
group => $heka::params::user,
}
}

View File

@ -1,33 +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::decoder::scribbler (
$config_dir,
$config = {},
$ensure = present,
) {
include heka::params
validate_hash($config)
file { "${config_dir}/scribbler-${title}.toml":
ensure => $ensure,
content => template('heka/decoder/scribbler.toml.erb'),
mode => '0600',
owner => $heka::params::user,
group => $heka::params::user,
}
}

View File

@ -1,37 +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::encoder::es_json (
$config_dir,
$es_index_from_timestamp = false,
$index = undef,
$ensure = present,
$fields = undef,
$timestamp = '%Y-%m-%dT%H:%M:%S',
) {
include heka::params
if $fields != undef {
validate_array($fields)
}
file { "${config_dir}/encoder-${title}.toml":
ensure => $ensure,
content => template('heka/encoder/es_json.toml.erb'),
mode => '0600',
owner => $heka::params::user,
group => $heka::params::user,
}
}

View File

@ -1,32 +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::encoder::payload (
$config_dir,
$append_newlines = false,
$prefix_ts = false,
$ensure = present,
) {
include heka::params
file { "${config_dir}/encoder-${title}.toml":
ensure => $ensure,
content => template('heka/encoder/payload.toml.erb'),
mode => '0600',
owner => $heka::params::user,
group => $heka::params::user,
}
}

View File

@ -1,35 +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::encoder::sandbox (
$config_dir,
$filename,
$config = {},
$module_directory = undef,
$ensure = present,
) {
include heka::params
validate_hash($config)
file { "${config_dir}/encoder-${title}.toml":
ensure => $ensure,
content => template('heka/encoder/sandbox.toml.erb'),
mode => '0600',
owner => $heka::params::user,
group => $heka::params::user,
}
}

View File

@ -1,37 +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::filter::sandbox (
$config_dir,
$filename,
$preserve_data = false,
$message_matcher = 'FALSE',
$ticker_interval = undef,
$config = {},
$module_directory = undef,
$ensure = present,
) {
include heka::params
validate_hash($config)
file { "${config_dir}/filter-${title}.toml":
ensure => $ensure,
content => template('heka/filter/sandbox.toml.erb'),
mode => '0600',
owner => $heka::params::user,
group => $heka::params::user,
}
}

View File

@ -1,311 +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
#
# Install and configure the core of the Heka service.
#
# === Parameters
#
# [*config_dir*]
# The directory where to store the configuration (default: '/etc/hekad').
#
# [*user*]
# The user to run the Heka service as (default: 'heka'). You may have to use
# 'root' on some systems for the Heka service to be able to access log files,
# run additional commands, ...
#
# [*additional_groups*]
# Additional groups to which the heka user should be added.
#
# [*hostname*]
# Hostname reported by the service in the messages (default: the host's FQDN).
#
# [*maxprocs*]
# The number of CPU cores (default: $processorcount).
#
# [*max_message_size*]
# The maxium Heka message size in bytes (default: undef to use default Heka value).
#
# [*max_process_inject*]
# The maximum number of messages that a sandbox filter's ProcessMessage
# function can inject in a single call (default: undef to use default Heka
# value).
#
# [*max_timer_inject*]
# The maximum number of messages that a sandbox filter's TimerEvent function
# can inject in a single call (default: undef to use default Heka value).
#
# [*poolsize*]
# The pool size of maximum messages that can exist (default: 100).
#
# [*internal_statistics*]
# Whether or not to dump Heka internal statistics to stdout at a regular
# interval (currently every hour).
#
# [*install_init_script*]
# Whether or not install the init script (Upstart or Systemd). This is typically
# used when the service is managed by Pacemaker for example.
# (default: true).
#
# [*version*]
# The package version to install. (default: 'latest').
#
# === Examples
#
# class { 'heka':
# hostname => 'foobar'
# }
#
# === Authors
#
# Simon Pasquier <spasquier@mirantis.com>
#
# === Copyright
#
# Copyright 2015 Mirantis Inc, unless otherwise noted.
#
define heka (
$config_dir = undef,
$user = undef,
$additional_groups = undef,
$hostname = undef,
$maxprocs = undef,
$max_message_size = undef,
$max_process_inject = undef,
$max_timer_inject = undef,
$poolsize = undef,
$pre_script = undef,
$internal_statistics = undef,
$install_init_script = true,
$version = 'latest',
) {
include heka::params
if $poolsize {
validate_integer($poolsize)
}
$service_name = $title
if $user {
$heka_user = $user
} else {
$heka_user = $heka::params::user
}
if $config_dir {
$_config_dir = $config_dir
} else {
$_config_dir = $heka::params::config_dir
}
$run_as_root = $heka_user == 'root'
if $run_as_root {
$_run_as_root = $run_as_root
} else {
$_run_as_root = $heka::params::run_as_root
}
if $additional_groups {
$_additional_groups = $additional_groups
} else {
$_additional_groups = $heka::params::additional_groups
}
if $hostname {
$_hostname = $hostname
} else {
$_hostname = $heka::params::hostname
}
if $maxprocs {
$_maxprocs = $maxprocs
} else {
$_maxprocs = $heka::params::maxprocs
}
if $max_message_size {
$_max_message_size = $max_message_size
} else {
$_max_message_size = $heka::params::max_message_size
}
if $max_process_inject {
$_max_process_inject = $max_process_inject
} else {
$_max_process_inject = $heka::params::max_process_inject
}
if $max_timer_inject {
$_max_timer_inject = $max_timer_inject
} else {
$_max_timer_inject = $heka::params::max_timer_inject
}
$hekad_wrapper = "/usr/local/bin/${service_name}_wrapper"
$base_dir = "/var/cache/${service_name}"
$log_file = "/var/log/${service_name}.log"
if ! defined(Package[$heka::params::package_name]) {
package { $heka::params::package_name:
ensure => $version,
alias => 'heka',
}
if $::osfamily == 'Debian' {
# Starting from Heka 0.10.0, the Debian package provides a SysV init
# script so we need to stop the service and remove the init script.
# If this script isn't removed, the user may accidentally stop *all* the
# running hekad processes by invoking '/etc/init.d/heka stop'.
exec { 'stop_heka_daemon':
command => '/etc/init.d/heka stop',
onlyif => '/usr/bin/test -f /etc/init.d/heka',
require => Package['heka'],
notify => Exec['disable_heka_daemon']
}
exec { 'disable_heka_daemon':
command => '/usr/sbin/update-rc.d heka disable',
refreshonly => true,
notify => Exec['remove_heka_service'],
}
exec { 'remove_heka_service':
command => '/bin/rm -f /etc/init.d/heka',
refreshonly => true,
}
}
}
# This Puppet User resource is used by other manifests even if the hekad
# process runs as 'root'.
if ! defined(User[$heka_user]) {
user { $heka_user:
shell => $heka::params::nologin_bin,
home => $base_dir,
system => true,
groups => $_additional_groups,
alias => 'heka',
before => Package['heka'],
}
}
file { $base_dir:
ensure => directory,
owner => $heka_user,
group => $heka_user,
mode => '0750',
require => [User[$heka_user], Package['heka']],
}
file { $_config_dir:
ensure => directory,
owner => $heka_user,
group => $heka_user,
mode => '0750',
require => [User[$heka_user], Package['heka']],
}
file { $log_file:
ensure => present,
owner => $heka_user,
group => $heka_user,
mode => '0660',
require => [User[$heka_user], Package['heka']],
}
$logrotate_conf = "/etc/logrotate_${service_name}.conf"
file { $logrotate_conf:
ensure => present,
content => template('heka/logrotate.conf.erb'),
owner => 'root',
group => 'root',
mode => '0644',
require => Package['heka'],
}
$logrotate_bin = "/usr/local/bin/logrotate_${service_name}"
file { $logrotate_bin:
ensure => present,
owner => 'root',
group => 'root',
mode => '0755',
content => template('heka/logrotate.cron.erb'),
require => File[$logrotate_conf],
}
cron { "${service_name} logrotate":
ensure => present,
command => $logrotate_bin,
minute => '*/30',
hour => '*',
month => '*',
monthday => '*',
require => File[$logrotate_bin],
}
if $install_init_script {
file { $hekad_wrapper:
ensure => present,
owner => 'root',
group => 'root',
mode => '0755',
content => template('heka/hekad_wrapper.erb'),
require => Package['heka'],
}
case $::osfamily {
'Debian': {
file {"/etc/init/${service_name}.conf":
ensure => present,
content => template('heka/hekad.upstart.conf.erb'),
notify => Service[$service_name],
alias => "${service_name}_heka_init_script",
require => File[$hekad_wrapper],
}
}
'RedHat': {
file { "/etc/init.d/${service_name}":
ensure => present,
content => template('heka/hekad.initd.erb'),
mode => '0755',
notify => Service[$service_name],
alias => "${service_name}_heka_init_script",
require => File[$hekad_wrapper],
}
}
default: {
fail("${::osfamily} not supported")
}
}
}
file { "${_config_dir}/global.toml":
ensure => present,
content => template('heka/global.toml.erb'),
mode => '0600',
owner => $heka_user,
group => $heka_user,
require => File[$_config_dir],
notify => Service[$service_name],
}
if $internal_statistics {
cron { 'heka-internal-statistics':
ensure => present,
command => '/usr/bin/killall -SIGUSR1 hekad',
minute => '0',
hour => '*',
month => '*',
monthday => '*',
}
}
}

View File

@ -1,42 +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::input::amqp (
$config_dir,
$decoder,
$user,
$password,
$host,
$port,
$exchange,
$queue,
$exchange_durability = false,
$exchange_auto_delete = false,
$queue_auto_delete = true,
$exchange_type = 'topic',
$routing_key = '*',
$can_exit = false,
$ensure = present,
) {
include heka::params
file { "${config_dir}/amqp-${title}.toml":
ensure => $ensure,
content => template('heka/input/amqp.toml.erb'),
mode => '0600',
owner => $heka::params::user,
group => $heka::params::user,
}
}

View File

@ -1,32 +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::input::httplisten (
$config_dir,
$decoder,
$address = '127.0.0.1',
$port = '80',
$ensure = present,
) {
include heka::params
file { "${config_dir}/httplisten-${title}.toml":
ensure => $ensure,
content => template('heka/input/httplisten.toml.erb'),
mode => '0600',
owner => $heka::params::user,
group => $heka::params::user,
}
}

View File

@ -1,39 +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::input::logstreamer(
$config_dir,
$decoder,
$splitter = undef,
$log_directory = '/var/log',
$file_match = undef,
$differentiator = undef,
$priority = undef,
$ensure = present,
) {
include heka::params
if $differentiator and ('/' in $differentiator) {
fail('differentiator contains a slash character')
}
file { "${config_dir}/logstreamer-${title}.toml":
ensure => $ensure,
content => template('heka/input/logstreamer.toml.erb'),
mode => '0600',
owner => $heka::params::user,
group => $heka::params::user,
}
}

View File

@ -1,35 +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::input::process (
$config_dir,
$decoder,
$commands,
$splitter = false,
$ticker_interval = '60',
$stdout = true,
$stderr = false,
$ensure = present,
) {
include heka::params
file { "${config_dir}/process-${title}.toml":
ensure => $ensure,
content => template('heka/input/process.toml.erb'),
mode => '0600',
owner => $heka::params::user,
group => $heka::params::user,
}
}

View File

@ -1,38 +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::input::tcp (
$config_dir,
$address = '127.0.0.1',
$port = 5565,
$decoder = 'ProtobufDecoder',
$ensure = present,
) {
include heka::params
if $decoder == 'ProtobufDecoder' {
$decoder_instance = $decoder
} else {
$decoder_instance = "${decoder}_decoder"
}
file { "${config_dir}/input-${title}.toml":
ensure => $ensure,
content => template('heka/input/tcp.toml.erb'),
mode => '0600',
owner => $heka::params::user,
group => $heka::params::user,
}
}

View File

@ -1,33 +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::dashboard (
$config_dir,
$dashboard_address = '0.0.0.0',
$dashboard_port = '4352',
$ticker_interval = '30',
$ensure = present,
) {
include heka::params
file { "${config_dir}/output-${title}.toml":
ensure => $ensure,
content => template('heka/output/dashboard.toml.erb'),
mode => '0600',
owner => $heka::params::user,
group => $heka::params::user,
}
}

View File

@ -1,43 +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::elasticsearch (
$config_dir,
$server = undef,
$port = undef,
$encoder = $title,
$message_matcher = 'FALSE',
$flush_interval = 5,
$flush_count = 10,
$use_buffering = true,
$max_buffer_size = 1024 * 1024 * 1024, # 1GiB
$queue_full_action = 'block',
$max_file_size = undef,
$ensure = present,
) {
include heka::params
if $use_buffering {
validate_buffering($max_buffer_size, $max_file_size, $queue_full_action)
}
file { "${config_dir}/output-${title}.toml":
ensure => $ensure,
content => template('heka/output/elasticsearch.toml.erb'),
mode => '0600',
owner => $heka::params::user,
group => $heka::params::user,
}
}

View File

@ -1,46 +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::http (
$config_dir,
$url,
$encoder = $title,
$message_matcher = 'FALSE',
$username = undef,
$password = undef,
$timeout = undef,
$method = 'POST',
$headers = {},
$use_buffering = true,
$max_buffer_size = 1024 * 1024 * 1024, # 1GiB
$queue_full_action = 'drop',
$max_file_size = undef,
$ensure = present,
) {
include heka::params
validate_hash($headers)
if $use_buffering {
validate_buffering($max_buffer_size, $max_file_size, $queue_full_action)
}
file { "${config_dir}/output-${title}.toml":
ensure => $ensure,
content => template('heka/output/http.toml.erb'),
mode => '0600',
owner => $heka::params::user,
group => $heka::params::user,
}
}

View File

@ -1,35 +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::sandbox (
$config_dir,
$filename,
$message_matcher = 'FALSE',
$config = {},
$module_directory = undef,
$ensure = present,
) {
include heka::params
validate_hash($config)
file { "${config_dir}/output-${title}.toml":
ensure => $ensure,
content => template('heka/output/sandbox.toml.erb'),
mode => '0600',
owner => $heka::params::user,
group => $heka::params::user,
}
}

View File

@ -1,40 +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::tcp (
$config_dir,
$address = '127.0.0.1',
$port = 5565,
$message_matcher = 'FALSE',
$use_buffering = true,
$max_buffer_size = 1024 * 1024 * 1024, # 1GiB
$queue_full_action = 'drop',
$max_file_size = undef,
$ensure = present,
) {
include heka::params
if $use_buffering {
validate_buffering($max_buffer_size, $max_file_size, $queue_full_action)
}
file { "${config_dir}/output-${title}.toml":
ensure => $ensure,
content => template('heka/output/tcp.toml.erb'),
mode => '0600',
owner => $heka::params::user,
group => $heka::params::user,
}
}

View File

@ -1,45 +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 heka::params {
$package_name = 'heka'
$user = 'heka'
$additional_groups = []
$hostname = undef
$maxprocs = $::processorcount
$max_message_size = undef
$max_process_inject = undef
$max_timer_inject = undef
$internal_statistics = false
$config_dir = '/etc/hekad'
$share_dir = '/usr/share/heka'
$lua_modules_dir = '/usr/share/heka/lua_modules'
# required to read the log files
case $::osfamily {
'Debian': {
$groups = ['syslog', 'adm']
$nologin_bin = '/usr/sbin/nologin'
}
'RedHat': {
$groups = ['adm']
$nologin_bin = '/sbin/nologin'
}
default: {
fail("${::osfamily} not supported")
}
}
}

View File

@ -1,31 +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::splitter::regex (
$config_dir,
$delimiter,
$delimiter_eol = undef,
$ensure = present,
) {
include heka::params
file { "${config_dir}/splitter-${title}.toml":
ensure => $ensure,
content => template('heka/splitter/regex.toml.erb'),
mode => '0600',
owner => $heka::params::user,
group => $heka::params::user,
}
}

View File

@ -1,31 +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::splitter::token (
$config_dir,
$delimiter,
$ensure = present,
) {
include heka::params
file { "${config_dir}/splitter-${title}.toml":
ensure => $ensure,
content => template('heka/splitter/token.toml.erb'),
mode => '0600',
owner => $heka::params::user,
group => $heka::params::user,
}
}

View File

@ -1,23 +0,0 @@
{
"name": "mirantis-heka",
"version": "1.0.0",
"author": "Simon Pasquier <spasquier@mirantis.com>",
"summary": "Puppet Heka Module",
"license": "Apache-2.0",
"source": "https://git.openstack.org/cgit/openstack/fuel-plugin-lma-collector.git",
"project_page": "none",
"issues_url": "none",
"operatingsystem_support": [
{
"operatingsystem": "Ubuntu",
"operatingsystemrelease": ["14.04"]
}
],
"requirements": [
{"name": "puppet", "version_requirement": "3.x"}
],
"description": "Puppet module for configuring Heka",
"dependencies": [
{"name": "puppetlabs/stdlib", "version_requirement": "4.x"}
]
}

View File

@ -1,33 +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.
require 'spec_helper'
describe 'heka::decoder::sandbox' do
let(:title) { :foo }
let(:facts) do
{:kernel => 'Linux', :operatingsystem => 'Ubuntu',
:osfamily => 'Debian'}
end
describe 'with title = foo' do
let(:params) {{:config_dir => '/etc/hekad', :filename => 'foo.lua'}}
it { is_expected.to contain_file('/etc/hekad/decoder-foo.toml').without_content(/module_directory/) }
end
describe 'with title = foo and module_directory' do
let(:params) {{:config_dir => '/etc/hekad', :filename => 'foo.lua', :module_directory => '/tmp'}}
it { is_expected.to contain_file('/etc/hekad/decoder-foo.toml').with_content(/module_directory = "\/tmp;/) }
end
end

View File

@ -1,32 +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.
require 'spec_helper'
describe 'heka::encoder::es_json' do
let(:title) { :es }
let(:facts) do
{:kernel => 'Linux', :operatingsystem => 'Ubuntu',
:osfamily => 'Debian'}
end
describe 'with title = es' do
let(:params) {{:config_dir => '/etc/hekad', :index => 'bar'}}
it { is_expected.to contain_file('/etc/hekad/encoder-es.toml') }
end
describe 'with fields list' do
let(:params) {{:config_dir => '/etc/hekad', :index => 'bar', :fields => ['foo', 'bar']}}
it { is_expected.to contain_file('/etc/hekad/encoder-es.toml').with_content(/fields = \[ "bar", "foo" \]/) }
end
end

View File

@ -1,33 +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.
require 'spec_helper'
describe 'heka::encoder::sandbox' do
let(:title) { :foo }
let(:facts) do
{:kernel => 'Linux', :operatingsystem => 'Ubuntu',
:osfamily => 'Debian'}
end
describe 'with title = foo' do
let(:params) {{:config_dir => '/etc/hekad', :filename => 'foo.lua'}}
it { is_expected.to contain_file('/etc/hekad/encoder-foo.toml').without_content(/module_directory/) }
end
describe 'with title = foo and module_directory' do
let(:params) {{:config_dir => '/etc/hekad', :filename => 'foo.lua', :module_directory => '/tmp'}}
it { is_expected.to contain_file('/etc/hekad/encoder-foo.toml').with_content(/module_directory = "\/tmp;/) }
end
end

View File

@ -1,33 +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.
require 'spec_helper'
describe 'heka::filter::sandbox' do
let(:title) { :foo }
let(:facts) do
{:kernel => 'Linux', :operatingsystem => 'Ubuntu',
:osfamily => 'Debian'}
end
describe 'with title = foo' do
let(:params) {{:config_dir => '/etc/hekad', :filename => 'foo.lua'}}
it { is_expected.to contain_file('/etc/hekad/filter-foo.toml').without_content(/module_directory/) }
end
describe 'with title = foo and module_directory' do
let(:params) {{:config_dir => '/etc/hekad', :filename => 'foo.lua', :module_directory => '/tmp'}}
it { is_expected.to contain_file('/etc/hekad/filter-foo.toml').with_content(/module_directory = "\/tmp;/) }
end
end

View File

@ -1,39 +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.
require 'spec_helper'
describe 'heka::input::logstreamer' do
let(:facts) do
{:kernel => 'Linux', :operatingsystem => 'Ubuntu',
:osfamily => 'Debian'}
end
describe 'with required params' do
let(:title) { :foo }
let(:params) do
{:config_dir => '/etc/heka',
:decoder => 'decoder'}
end
it { is_expected.to contain_file('/etc/heka/logstreamer-foo.toml') }
end
describe 'differentiator including a slash' do
let(:title) { :foo }
let(:params) do
{:config_dir => '/etc/heka',
:decoder => 'decoder', :differentiator => '["test", "/"]'}
end
it { is_expected.to raise_error(Puppet::Error, /slash/) }
end
end

View File

@ -1,38 +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.
require 'spec_helper'
describe 'heka::output::http' do
let(:title) { :foo }
let(:facts) do
{:kernel => 'Linux', :operatingsystem => 'Ubuntu',
:osfamily => 'Debian'}
end
describe 'with title = foo' do
let(:params) {{:config_dir => '/etc/hekad', :url => 'http://example.com/'}}
it { is_expected.to contain_file('/etc/hekad/output-foo.toml') }
end
describe 'with title = foo and buffering' do
let(:params) {{:config_dir => '/etc/hekad',
:url => 'http://example.com/',
:use_buffering => true,
:max_file_size => 50000,
:max_buffer_size => 100000,
:queue_full_action => 'shutdown'
}}
it { is_expected.to contain_file('/etc/hekad/output-foo.toml') }
end
end

View File

@ -1,33 +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.
require 'spec_helper'
describe 'heka::output::sandbox' do
let(:title) { :foo }
let(:facts) do
{:kernel => 'Linux', :operatingsystem => 'Ubuntu',
:osfamily => 'Debian'}
end
describe 'with title = foo' do
let(:params) {{:config_dir => '/etc/hekad', :filename => 'foo.lua'}}
it { is_expected.to contain_file('/etc/hekad/output-foo.toml').without_content(/module_directory/) }
end
describe 'with title = foo and module_directory' do
let(:params) {{:config_dir => '/etc/hekad', :filename => 'foo.lua', :module_directory => '/tmp'}}
it { is_expected.to contain_file('/etc/hekad/output-foo.toml').with_content(/module_directory = "\/tmp;/) }
end
end

View File

@ -1,40 +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.
require 'spec_helper'
describe 'heka' do
let(:facts) do
{:kernel => 'Linux', :operatingsystem => 'Ubuntu',
:osfamily => 'Debian'}
end
describe 'with defaults' do
let(:title) { :log}
it { is_expected.to contain_user('heka') }
it { is_expected.to contain_file('/etc/init/log.conf') \
.with_content(/--chuid heka/) }
end
describe 'with user => "root"' do
let(:params) do
{:user => 'root'}
end
let(:title) { :foo}
it { is_expected.to contain_user('root') }
it { is_expected.to contain_file('/etc/init/foo.conf') }
it { is_expected.not_to contain_file('/etc/init/foo.conf') \
.with_content(/--chuid/) }
end
end

View File

@ -1,24 +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.
require 'spec_helper'
describe 'validate_buffering' do
it { is_expected.to run.with_params().and_raise_error(Puppet::ParseError, /wrong number of arguments/i) }
it { is_expected.to run.with_params('foo', 'bar', 'drop').and_raise_error(Puppet::ParseError, /bad argument/i) }
it { is_expected.to run.with_params(1024, 2048, 'drop').and_raise_error(Puppet::ParseError, /should be greater/i) }
it { is_expected.to run.with_params(2048, 1024, 'foo').and_raise_error(Puppet::ParseError, /should be either/i) }
it { is_expected.to run.with_params(0, '', 'shutdown') }
it { is_expected.to run.with_params(2048, 1024, 'shutdown') }
it { is_expected.to run.with_params(1024*1024*1024, 0, 'block') }
end

View File

@ -1,6 +0,0 @@
--format
s
--colour
--loadby
mtime
--backtrace

View File

@ -1,22 +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.
require 'rspec-puppet'
fixture_path = File.expand_path(File.join(__FILE__, '..', 'fixtures'))
RSpec.configure do |c|
c.module_path = File.join(fixture_path, 'modules')
c.manifest_dir = File.join(fixture_path, 'manifests')
c.environmentpath = File.join(Dir.pwd, 'spec')
end

View File

@ -1,5 +0,0 @@
[<%= @title %>_decoder]
type = "MultiDecoder"
subs = [<%= @subs.sort.collect{|x| '"' + x + '"'}.join(',') %>]
cascade_strategy = "<%= @cascade_strategy %>"
log_sub_errors = <%= @log_sub_errors %>

View File

@ -1,14 +0,0 @@
[<%= @title %>_decoder]
type = "SandboxDecoder"
filename = "<%= @filename %>"
<% if @module_directory -%>
module_directory = "<%= @module_directory %>;/usr/share/heka/lua_modules"
<% end -%>
<% if @config.size() > 0 %>
[<%= @title %>_decoder.config]
<% @config.each do |k,v| %>
<% next if v.nil? or v == :undef -%>
<%= k %> = <%= v.is_a?(String) ? "'#{v}'" : v %>
<% end %>
<% end %>

View File

@ -1,8 +0,0 @@
[<%= @title %>_decoder]
type = "ScribbleDecoder"
[<%= @title %>_decoder.message_fields]
<% @config.sort.each do |k,v| %>
<% next if v.nil? or v == :undef -%>
<%= k %> = "<%= v %>"
<% end %>

View File

@ -1,8 +0,0 @@
[<%= @title %>_encoder]
type = "ESJsonEncoder"
index = "<%= @index %>"
es_index_from_timestamp = <%= @es_index_from_timestamp %>
timestamp = "<%= @timestamp %>"
<% if @fields -%>
fields = [ <%= @fields.sort.collect{ |x| '"%s"' % x }.join(", ") %> ]
<% end -%>

View File

@ -1,4 +0,0 @@
[<%= @title %>_encoder]
type = "PayloadEncoder"
append_newlines = <%= @append_newlines %>
prefix_ts = <%= @prefix_ts %>

View File

@ -1,13 +0,0 @@
[<%= @title %>_encoder]
type = "SandboxEncoder"
filename = "<%= @filename %>"
<% if @module_directory -%>
module_directory = "<%= @module_directory %>;/usr/share/heka/lua_modules"
<% end -%>
<% if @config.size() > 0 %>
[<%= @title %>_encoder.config]
<% @config.each do |k,v| -%>
<%- next if v.nil? or v == :undef -%>
<%= k %> = <%= v.is_a?(String) ? "'#{v}'" : v %>
<% end %>
<% end %>

View File

@ -1,19 +0,0 @@
[<%= @title %>_filter]
type = "SandboxFilter"
filename = "<%= @filename %>"
preserve_data = <%= @preserve_data %>
message_matcher = "<%= @message_matcher %>"
<% if @module_directory -%>
module_directory = "<%= @module_directory %>;/usr/share/heka/lua_modules"
<% end -%>
<% if @ticker_interval %>
ticker_interval = <%= @ticker_interval %>
<% end %>
<% if @config.size() > 0 %>
[<%= @title %>_filter.config]
<% @config.each do |k,v| %>
<% next if v.nil? or v == :undef -%>
<%= k %> = <%= v.is_a?(String) ? "'#{v}'" : v %>
<% end %>
<% end %>

View File

@ -1,18 +0,0 @@
[hekad]
maxprocs=<%= @_maxprocs %>
base_dir="<%= @base_dir %>"
<% if @_hostname %>
hostname="<%= @_hostname %>"
<% end %>
<% if @_max_message_size -%>
max_message_size = <%= @_max_message_size %>
<% end -%>
<% if @_max_process_inject -%>
max_process_inject = <%= @_max_process_inject %>
<% end -%>
<% if @_max_timer_inject -%>
max_timer_inject = <%= @_max_timer_inject %>
<% end -%>
<% if @poolsize -%>
poolsize = <%= @poolsize %>
<% end -%>

Some files were not shown because too many files have changed in this diff Show More