Add backward compatibility for MOS7/LMA 0.8

This change makes sure that the Puppet manifests can be executed with
the 0.8 versions of the InfluxDB/Grafana, Elasticsearch-Kibana and
Nagios plugins.

Change-Id: Ib8bb0aff3497ff7b9e7a307ddb04d15798fbd070
This commit is contained in:
Simon Pasquier 2016-03-08 17:37:43 +01:00
parent 8d5622bf70
commit 65ff6607c1
3 changed files with 28 additions and 6 deletions

View File

@ -54,7 +54,13 @@ if $alerting_mode == 'remote' {
$infra_alerting_nodes = get_nodes_hash_by_roles($network_metadata, ['infrastructure_alerting', 'primary-infrastructure_alerting'])
if size(keys($infra_alerting_nodes)) > 0 {
$nagios_enabled = true
$nagios_server = $network_metadata['vips']['infrastructure_alerting_mgmt_vip']['ipaddr']
if $network_metadata['vips']['infrastructure_alerting_mgmt_vip'] {
$nagios_server = $network_metadata['vips']['infrastructure_alerting_mgmt_vip']['ipaddr']
} else {
# compatibility with the LMA Infrastructure Alerting plugin 0.8
$nagios_nodes = filter_nodes(hiera('nodes'), 'role', 'infrastructure_alerting')
$nagios_server = $nagios_nodes[0]['internal_address']
}
$nagios_user = $lma_infra_alerting['nagios_user']
$nagios_password = $lma_infra_alerting['nagios_password']
$http_port = $lma_collector::params::nagios_http_port

View File

@ -453,7 +453,14 @@ if $influxdb_mode != 'disabled' {
$use_local_influxdb = true
$use_remote_influxdb = false
$influxdb_vip_name = 'influxdb'
$influxdb_server = $network_metadata['vips'][$influxdb_vip_name]['ipaddr']
if $network_metadata['vips'][$influxdb_vip_name] {
$influxdb_server = $network_metadata['vips'][$influxdb_vip_name]['ipaddr']
} else {
# compatibility with the InfluxDB-Grafana plugin 0.8
$influxdb_grafana = hiera_hash('influxdb_grafana', {})
$influxdb_nodes = filter_nodes(hiera('nodes'), 'role', 'influxdb_grafana')
$influxdb_server = $influxdb_nodes[0]['internal_address']
}
} else {
$use_local_influxdb = false
$use_remote_influxdb = false
@ -491,7 +498,13 @@ if $alerting_mode == 'remote' {
if size(keys($infra_alerting_nodes)) > 0 {
$use_nagios = true
$lma_infra_alerting = hiera_hash('lma_infrastructure_alerting', false)
$nagios_server = $network_metadata['vips']['infrastructure_alerting_mgmt_vip']['ipaddr']
if $network_metadata['vips']['infrastructure_alerting_mgmt_vip'] {
$nagios_server = $network_metadata['vips']['infrastructure_alerting_mgmt_vip']['ipaddr']
} else {
# compatibility with the LMA Infrastructure Alerting plugin 0.8
$nagios_nodes = filter_nodes(hiera('nodes'), 'role', 'infrastructure_alerting')
$nagios_server = $nagios_nodes[0]['internal_address']
}
$nagios_user = $lma_infra_alerting['nagios_user']
$nagios_password = $lma_infra_alerting['nagios_password']

View File

@ -53,11 +53,14 @@ if $lma_collector_hash['influxdb_mode'] != 'disabled' {
if $is_elasticsearch_node {
class { 'lma_collector::collectd::elasticsearch':
address => hiera('lma::elasticsearch::vip'),
address => hiera('lma::elasticsearch::vip', $mgmt_address),
}
}
class { 'lma_collector::collectd::haproxy':
socket => '/var/lib/haproxy/stats',
if $network_metadata['vips']['influxdb'] or $network_metadata['vips']['es_vip_mgmt'] {
# Only when used with the version 0.9 (and higher) of the Elasticsearch-Kibana and InfluxDB-Grafana plugins
class { 'lma_collector::collectd::haproxy':
socket => '/var/lib/haproxy/stats',
}
}
}