Enable HA on monitoring infrastructure

This commit aims to allow the loadbalancing for both
the Sensu API and the Sensu dashboard(Uchiwa).

Change-Id: I1b047919552c7e248d785acaad7154b75d7bde38
This commit is contained in:
Yanis Guenane 2015-02-04 03:49:30 -05:00
parent 06d33d63da
commit b591e78553
2 changed files with 118 additions and 10 deletions

View File

@ -199,6 +199,20 @@
# If set to false, no binding will be configure. # If set to false, no binding will be configure.
# Defaults to false # Defaults to false
# #
# [*sensu_dashboard*]
# (optional) Enable or not sensu_dashboard binding.
# If true, both public and internal will attempt to be created except if vip_internal_ip is set to false.
# If set to ['10.0.0.1'], only IP in the array (or in the string) will be configured in the pool. They must be part of keepalived_ip options.
# If set to false, no binding will be configure.
# Defaults to true
#
# [*sensu_api*]
# (optional) Enable or not sensu_api binding.
# If true, both public and internal will attempt to be created except if vip_internal_ip is set to false.
# If set to ['10.0.0.1'], only IP in the array (or in the string) will be configured in the pool. They must be part of keepalived_ip options.
# If set to false, no binding will be configure.
# Defaults to true
#
# [*keystone_api_admin*] # [*keystone_api_admin*]
# (optional) Enable or not Keystone admin binding. # (optional) Enable or not Keystone admin binding.
# If true, both public and internal will attempt to be created except if vip_internal_ip is set to false. # If true, both public and internal will attempt to be created except if vip_internal_ip is set to false.
@ -328,6 +342,16 @@
# service configuration block. # service configuration block.
# Defaults to [] # Defaults to []
# #
# [*sensu_dashboard_bind_options*]
# (optional) A hash of options that are inserted into the HAproxy listening
# service configuration block.
# Defaults to []
#
# [*sensu_api_bind_options*]
# (optional) A hash of options that are inserted into the HAproxy listening
# service configuration block.
# Defaults to []
#
# [*galera_bind_options*] # [*galera_bind_options*]
# (optional) A hash of options that are inserted into the HAproxy listening # (optional) A hash of options that are inserted into the HAproxy listening
# service configuration block. # service configuration block.
@ -420,6 +444,13 @@
# [*kibana_port*] # [*kibana_port*]
# (optional) Port of Kibana service. # (optional) Port of Kibana service.
# Defaults to '8300' # Defaults to '8300'
# [*sensu_dashboard_port*]
# (optional) Port of Sensu Dashboard service.
# Defaults to '3000'
#
# [*sensu_api_port*]
# (optional) Port of Sensu API service.
# Defaults to '4567'
# #
# [*vip_public_ip*] # [*vip_public_ip*]
# (optional) Array or string for public VIP # (optional) Array or string for public VIP
@ -471,6 +502,8 @@ class cloud::loadbalancer(
$novnc = true, $novnc = true,
$elasticsearch = true, $elasticsearch = true,
$kibana = true, $kibana = true,
$sensu_dashboard = true,
$sensu_api = true,
$haproxy_auth = 'admin:changeme', $haproxy_auth = 'admin:changeme',
$keepalived_state = 'BACKUP', $keepalived_state = 'BACKUP',
$keepalived_priority = '50', $keepalived_priority = '50',
@ -504,6 +537,8 @@ class cloud::loadbalancer(
$galera_bind_options = [], $galera_bind_options = [],
$elasticsearch_bind_options = [], $elasticsearch_bind_options = [],
$kibana_bind_options = [], $kibana_bind_options = [],
$sensu_dashboard_bind_options = [],
$sensu_api_bind_options = [],
$ks_ceilometer_public_port = 8777, $ks_ceilometer_public_port = 8777,
$ks_cinder_public_port = 8776, $ks_cinder_public_port = 8776,
$ks_ec2_public_port = 8773, $ks_ec2_public_port = 8773,
@ -526,6 +561,8 @@ class cloud::loadbalancer(
$novnc_port = 6080, $novnc_port = 6080,
$elasticsearch_port = 9200, $elasticsearch_port = 9200,
$kibana_port = 8300, $kibana_port = 8300,
$sensu_dashboard_port = 3000,
$sensu_api_port = 4567,
$vip_public_ip = ['127.0.0.1'], $vip_public_ip = ['127.0.0.1'],
$vip_internal_ip = false, $vip_internal_ip = false,
$vip_monitor_ip = false, $vip_monitor_ip = false,
@ -664,6 +701,18 @@ class cloud::loadbalancer(
bind_options => $metadata_bind_options, bind_options => $metadata_bind_options,
firewall_settings => $firewall_settings, firewall_settings => $firewall_settings,
} }
cloud::loadbalancer::binding { 'sensu_dashboard':
ip => $sensu_dashboard,
port => $sensu_dashboard_port,
bind_options => $sensu_dashboard_bind_options,
firewall_settings => $firewall_settings,
}
cloud::loadbalancer::binding { 'sensu_api':
ip => $sensu_api,
port => $sensu_api_port,
bind_options => $sensu_api_bind_options,
firewall_settings => $firewall_settings,
}
cloud::loadbalancer::binding { 'spice_cluster': cloud::loadbalancer::binding { 'spice_cluster':
ip => $spice, ip => $spice,
port => $spice_port, port => $spice_port,

View File

@ -44,6 +44,11 @@
# } # }
# } # }
# #
# [*manage_rabbitmq_resources*]
# (optionnal) A boolean that determines if the RabbitMQ resources should be exported
# from this node
# Defaults to 'true'
#
# [*rabbitmq_user*] # [*rabbitmq_user*]
# (optionnal) Rabbitmq user # (optionnal) Rabbitmq user
# Defaults to 'sensu' # Defaults to 'sensu'
@ -56,21 +61,45 @@
# (optionnal) Rabbitmq vhost # (optionnal) Rabbitmq vhost
# Defaults to '/sensu' # Defaults to '/sensu'
# #
# [*sensu_api_ip*]
# (optionnal) IP address to bind the sensu_api to
# Defaults to '%{::ipaddress}'
#
# [*sensu_api_port*]
# (optionnal) Port to bind the sensu_api to
# Defaults to '4567'
#
# [*uchiwa_ip*] # [*uchiwa_ip*]
# (optionnal) IP address to bind uchiwa to # (optionnal) IP address to bind uchiwa to
# Defaults to '%{::ipaddress}' # Defaults to '%{::ipaddress}'
#
# [*uchiwa_port*]
# (optionnal) Port to bind uchiwa to
# Defaults to '3000'
#
# [*firewall_settings*]
# (optional) Allow to add custom parameters to firewall rules
# Should be an hash.
# Default to {}
#
class cloud::monitoring::server::sensu ( class cloud::monitoring::server::sensu (
$checks = {}, $checks = {},
$handlers = {}, $handlers = {},
$plugins = {}, $plugins = {},
$manage_rabbitmq_resources = true,
$rabbitmq_user = 'sensu', $rabbitmq_user = 'sensu',
$rabbitmq_password = 'rabbitpassword', $rabbitmq_password = 'rabbitpassword',
$rabbitmq_vhost = '/sensu', $rabbitmq_vhost = '/sensu',
$sensu_api_ip = $::ipaddress,
$sensu_api_port = '4567',
$uchiwa_ip = $::ipaddress, $uchiwa_ip = $::ipaddress,
$uchiwa_port = '3000',
$firewall_settings = {},
) { ) {
include cloud::params include cloud::params
if $manage_rabbitmq_resources {
@@rabbitmq_user { $rabbitmq_user : @@rabbitmq_user { $rabbitmq_user :
password => $rabbitmq_password, password => $rabbitmq_password,
} }
@ -82,6 +111,7 @@ class cloud::monitoring::server::sensu (
read_permission => '.*', read_permission => '.*',
write_permission => '.*', write_permission => '.*',
} }
}
$rabbitmq_user_realized = query_nodes("Rabbitmq_user['${rabbitmq_user}']") $rabbitmq_user_realized = query_nodes("Rabbitmq_user['${rabbitmq_user}']")
@ -100,6 +130,35 @@ class cloud::monitoring::server::sensu (
include ::uchiwa include ::uchiwa
uchiwa::api { 'OpenStack' : uchiwa::api { 'OpenStack' :
host => $uchiwa_ip, host => $uchiwa_ip,
port => $uchiwa_port,
}
if $::cloud::manage_firewall {
cloud::firewall::rule{ '100 allow sensu_dashboard access':
port => $uchiwa_port,
extras => $firewall_settings,
}
cloud::firewall::rule{ '100 allow sensu_api access':
port => $sensu_api_port,
extras => $firewall_settings,
}
}
@@haproxy::balancermember{"${::fqdn}-sensu_dashboard":
listening_service => 'sensu_dashoard',
server_names => $::hostname,
ipaddresses => $uchiwa_ip,
ports => $uchiwa_port,
options => 'check inter 2000 rise 2 fall 5'
}
@@haproxy::balancermember{"${::fqdn}-sensu_api":
listening_service => 'sensu_api',
server_names => $::hostname,
ipaddresses => $sensu_api_ip,
ports => $sensu_api_port,
options => 'check inter 2000 rise 2 fall 5'
} }
} }