Configure the AFD plugins

This change configures the Anomaly and Fault Detection (AFD) filter
plugins on the controller nodes.

The filters monitor the availability of:

  - the OpenStack API backends as reported by HAProxy.
  - the OpenStack API endpoints.
  - the OpenStack workers for Cinder, Neutron and Nova.

Change-Id: Ifa2a923b070383b79a104b93a33076cb13d74ab8
Implements: blueprint alerting-lma-collector
This commit is contained in:
Simon Pasquier 2015-09-02 15:09:40 +02:00
parent 2d1d6e6936
commit 84f82468bc
5 changed files with 116 additions and 0 deletions

View File

@ -174,6 +174,10 @@ if $lma_collector['influxdb_mode'] != 'disabled' {
# Service status metrics and annotations
class { 'lma_collector::metrics::service_status': }
# AFD filters
class { 'lma_collector::afd::api': }
class { 'lma_collector::afd::workers': }
}
$alerting_mode = $lma_collector['alerting_mode']

View File

@ -0,0 +1,31 @@
# 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 lma_collector::afd::api () {
include lma_collector::params
heka::filter::sandbox { 'afd_api_backends':
config_dir => $lma_collector::params::config_dir,
filename => "${lma_collector::params::plugins_dir}/filters/afd_api_backends.lua",
message_matcher => '(Type == \'metric\' || Type == \'heka.sandbox.metric\') && Fields[name] == \'haproxy_backend_servers\'',
notify => Class['lma_collector::service'],
}
heka::filter::sandbox { 'afd_api_endpoints':
config_dir => $lma_collector::params::config_dir,
filename => "${lma_collector::params::plugins_dir}/filters/afd_api_endpoints.lua",
message_matcher => '(Type == \'metric\' || Type == \'heka.sandbox.metric\') && Fields[name] =~ /^openstack.*check_api$/',
notify => Class['lma_collector::service'],
}
}

View File

@ -0,0 +1,29 @@
# 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 lma_collector::afd::workers () {
include lma_collector::params
$metrics_matcher = join([
'(Type == \'metric\' || Type == \'heka.sandbox.metric\')', ' && ',
'Fields[name] =~ /^openstack_(nova|cinder|neutron)_(services|agents)$/',
], '')
heka::filter::sandbox { 'afd_workers':
config_dir => $lma_collector::params::config_dir,
filename => "${lma_collector::params::plugins_dir}/filters/afd_workers.lua",
message_matcher => $metrics_matcher,
notify => Class['lma_collector::service'],
}
}

View File

@ -0,0 +1,26 @@
# 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 'lma_collector::afd::api' do
let(:facts) do
{:kernel => 'Linux', :operatingsystem => 'Ubuntu',
:osfamily => 'Debian'}
end
describe 'with defaults' do
it { is_expected.to contain_heka__filter__sandbox('afd_api_backends') }
it { is_expected.to contain_heka__filter__sandbox('afd_api_endpoints') }
end
end

View File

@ -0,0 +1,26 @@
# 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 'lma_collector::afd::workers' do
let(:facts) do
{:kernel => 'Linux', :operatingsystem => 'Ubuntu',
:osfamily => 'Debian'}
end
describe 'with defaults' do
it { is_expected.to contain_heka__filter__sandbox('afd_workers') }
end
end