Notify the Nagios URL to the Fuel API

Once the plugin deployment has completed, it uses the Fuel API to
register the Nagios URL. The end-users will get the information in
the Fuel UI.

This change also introduces the use of the primary role since only one
node should be responsible for notifying the Fuel API.

Change-Id: Ie5c2495b5bcbce4aec3d5dd2cae247884b231efe
This commit is contained in:
Simon Pasquier 2016-01-12 11:08:17 +01:00
parent e57f7261d2
commit 80e719a597
6 changed files with 59 additions and 10 deletions

View File

@ -21,6 +21,7 @@ $calculated_content = inline_template('
---
lma::corosync_roles:
- infrastructure_alerting
- primary-infrastructure_alerting
lma::infrastructure_alerting::vip: <%= @alerting_vip %>
lma::infrastructure_alerting::vip_ns: infrastructure_alerting
')

View File

@ -0,0 +1,29 @@
# 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.
$deployment_id = hiera('deployment_id')
$master_ip = hiera('master_ip')
$vip = hiera('lma::infrastructure_alerting::vip')
$nagios_link_data = "{\"title\":\"Nagios\",\
\"description\":\"Dashboard for visualizing alerts\",\
\"url\":\"http://${vip}:8001/\"}"
$nagios_link_created_file = '/var/cache/nagios_link_created'
exec { 'notify_nagios_url':
creates => $nagios_link_created_file,
command => "/usr/bin/curl -sL -w \"%{http_code}\" \
-H 'Content-Type: application/json' -X POST -d '${nagios_link_data}' \
http://${master_ip}:8000/api/clusters/${deployment_id}/plugin_links \
-o /dev/null | /bin/grep 201 && /usr/bin/touch ${nagios_link_created_file}",
}

View File

@ -1,7 +1,7 @@
- id: infrastructure_alerting
- id: primary-infrastructure_alerting
type: group
role: [infrastructure_alerting]
tasks:
role: [primary-infrastructure_alerting]
tasks: &common_tasks
- fuel_pkgs
- hiera
- globals
@ -15,9 +15,19 @@
strategy:
type: one_by_one
- id: infrastructure_alerting
type: group
role: [infrastructure_alerting]
tasks: *common_tasks
required_for: [deploy_end]
requires: [deploy_start, primary-infrastructure_alerting]
parameters:
strategy:
type: parallel
- id: lma-alerting-hiera
type: puppet
groups: [infrastructure_alerting]
groups: [primary-infrastructure_alerting, infrastructure_alerting]
requires: [globals]
required_for: [deploy_end]
parameters:
@ -27,7 +37,7 @@
- id: lma-alerting-firewall
type: puppet
groups: [infrastructure_alerting]
groups: [primary-infrastructure_alerting, infrastructure_alerting]
requires: [netconfig]
required_for: [deploy_end]
parameters:
@ -37,7 +47,7 @@
- id: lma-alerting-cluster
type: puppet
groups: [infrastructure_alerting]
groups: [primary-infrastructure_alerting, infrastructure_alerting]
requires: [lma-alerting-firewall, lma-alerting-hiera]
required_for: [deploy_end]
parameters:
@ -49,7 +59,7 @@
- id: lma-alerting-vip
type: puppet
groups: [infrastructure_alerting]
groups: [primary-infrastructure_alerting, infrastructure_alerting]
requires: [lma-alerting-cluster]
required_for: [deploy_end]
parameters:

View File

@ -8,4 +8,5 @@
namespace: "infrastructure_alerting"
alias: "infrastructure_alerting"
node_roles:
- "primary-infrastructure_alerting"
- "infrastructure_alerting"

View File

@ -1,7 +1,7 @@
infrastructure_alerting:
name: 'LMA Infrastructure Alerting'
description: 'Install services for the infrastructure alerting'
has_primary: false
has_primary: true
public_ip_required: false
weight: 100
limits:

View File

@ -1,7 +1,7 @@
# The following tasks are executed in the order they are declared
# Priorities are important, this ensure that this plugin is deployed after
# LMA Collector, InfluxDB and Elasticsearch.
- role: [infrastructure_alerting]
- role: [primary-infrastructure_alerting, infrastructure_alerting]
stage: post_deployment/8101
type: puppet
parameters:
@ -9,10 +9,18 @@
puppet_modules: puppet/modules
timeout: 600
- role: [infrastructure_alerting]
- role: [primary-infrastructure_alerting, infrastructure_alerting]
stage: post_deployment/8101
type: puppet
parameters:
puppet_manifest: puppet/manifests/ha_services.pp
puppet_modules: puppet/modules
timeout: 600
- role: [primary-infrastructure_alerting]
stage: post_deployment/8101
type: puppet
parameters:
puppet_manifest: puppet/manifests/nagios_dashboard_url.pp
puppet_modules: puppet/modules
timeout: 120