fuel-plugin-lma-collector/deployment_scripts/puppet/manifests/check_environment_configuration.pp
Swann Croiset baeca5ef6f Try to configure Nagios by default
The LMA collector uses by default the "infrastructure alerting" plugin
to send statuses if it is deployed within the environnement.
Previously, the user had to select explicitly the good option but
in practice the user forgot to select this option which leads to UNKNOWN
status for all service in the Nagios UI

Change-Id: Ia08f7e7f6763aeb3710ba26f88bfce6130a218bd
Fixes-bug: #1541462
2016-02-05 13:42:39 +01:00

57 lines
2.6 KiB
Puppet

# 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.
#
# This manifest is only executed on the primrary-controller to verify that the
# plugin's configuration matches with the environment.
$lma_collector = hiera_hash('lma_collector')
$network_metadata = hiera('network_metadata')
$elasticsearch_mode = $lma_collector['elasticsearch_mode']
if $elasticsearch_mode == 'local' {
# Check that the Elasticsearch-Kibana plugin is enabled for that environment
# and that the node names match
$elasticsearch_kibana = hiera_hash('elasticsearch_kibana', false)
if ! $elasticsearch_kibana {
fail('Could not get the Elasticsearch parameters. The Elasticsearch-Kibana plugin is probably not installed.')
}
elsif ! $elasticsearch_kibana['metadata']['enabled'] {
fail('Could not get the Elasticsearch parameters. The Elasticsearch-Kibana plugin is probably not enabled for this environment.')
}
# Check that the Elasticsearch-Kibana node exists in the environment
$es_nodes = get_nodes_hash_by_roles($network_metadata, ['elasticsearch_kibana', 'primary-elasticsearch_kibana'])
if size(keys($es_nodes)) < 1 {
fail("Could not find node with role 'elasticsearch_kibana' in the environment")
}
}
$influxdb_mode = $lma_collector['influxdb_mode']
if $influxdb_mode == 'local' {
# Check that the InfluxDB-Grafana plugin is enabled for that environment
# and that the node names match
$influxdb_grafana = hiera_hash('influxdb_grafana', false)
if ! $influxdb_grafana {
fail('Could not get the InfluxDB parameters. The InfluxDB-Grafana plugin is probably not installed.')
}
elsif ! $influxdb_grafana['metadata']['enabled'] {
fail('Could not get the InfluxDB parameters. The InfluxDB-Grafana plugin is probably not enabled for this environment.')
}
# Check that the InfluxDB-Grafana node exists in the environment
$influxdb_nodes = get_nodes_hash_by_roles($network_metadata, ['influxdb_grafana', 'primary-influxdb_grafana'])
if size(keys($influxdb_nodes)) < 1 {
fail("Could not find node with role 'influxdb_grafana' in the environment")
}
}