Reserve an additional VIP for Zabbix and bind zabbix_server process to it

Change-Id: I0101e98f3854598150c2ff4e2c76ae28f2885cb5
This commit is contained in:
Piotr Misiak 2015-08-07 14:18:55 +02:00
parent beafce4718
commit 0e6883c58c
7 changed files with 63 additions and 45 deletions

View File

@ -72,7 +72,14 @@ class plugin_zabbix::controller {
enable => true,
provider => 'pacemaker',
}
service { "vip__${plugin_zabbix::params::server_service}-started":
ensure => running,
name => "vip__${plugin_zabbix::params::server_service}",
enable => true,
provider => 'pacemaker',
}
Service["vip__${plugin_zabbix::params::server_service}-started"] -> Service["${plugin_zabbix::params::server_service}-started"]
File['zabbix-server-ocf'] -> Service["${plugin_zabbix::params::server_service}-init-stopped"] -> Service["${plugin_zabbix::params::server_service}-started"]
cron { 'zabbix db_clean':
@ -98,12 +105,16 @@ class plugin_zabbix::controller {
include plugin_zabbix::ha::haproxy
$zabbix_server_port = $plugin_zabbix::params::zabbix_ports['backend_server'] ? { unset=>$plugin_zabbix::params::zabbix_ports['server'], default=>$plugin_zabbix::params::zabbix_ports['backend_server'] }
firewall { '998 zabbix agent vip':
proto => 'tcp',
action => 'accept',
port => $plugin_zabbix::params::zabbix_ports['agent'],
}
firewall { '997 zabbix server':
proto => 'tcp',
action => 'accept',
port => $zabbix_server_port,
firewall { '998 zabbix server vip':
proto => 'tcp',
action => 'accept',
port => $plugin_zabbix::params::zabbix_ports['server'],
}
}

View File

@ -17,9 +17,10 @@ class plugin_zabbix::ha::haproxy {
Haproxy::Service { use_include => true }
Haproxy::Balancermember { use_include => true }
Haproxy::Listen { use_include => true }
$public_vip = hiera('public_vip')
$management_vip = hiera('management_vip')
$zabbix_vip = $plugin_zabbix::params::server_ip
$nodes_hash = hiera('nodes')
$primary_controller_nodes = filter_nodes($nodes_hash,'role','primary-controller')
$controllers = concat($primary_controller_nodes, filter_nodes($nodes_hash,'role','controller'))
@ -28,7 +29,7 @@ class plugin_zabbix::ha::haproxy {
server_names => filter_hash($controllers, 'name'),
ipaddresses => filter_hash($controllers, 'internal_address'),
public_virtual_ip => $public_vip,
internal_virtual_ip => $management_vip,
internal_virtual_ip => $zabbix_vip,
}
plugin_zabbix::ha::haproxy_service { 'zabbix-agent':
@ -47,26 +48,10 @@ class plugin_zabbix::ha::haproxy {
balancermember_options => 'check inter 5000 rise 2 fall 3',
}
plugin_zabbix::ha::haproxy_service { 'zabbix-server':
order => '200',
listen_port => $plugin_zabbix::params::zabbix_ports['server'],
balancermember_port => $plugin_zabbix::params::zabbix_ports['backend_server'],
haproxy_config_options => {
'option' => ['tcpka'],
'timeout client' => '48h',
'timeout server' => '48h',
'balance' => 'roundrobin',
'mode' => 'tcp'
},
balancermember_options => 'check inter 5000 rise 2 fall 3',
}
file_line { 'add binding to management VIP for horizon and zabbix':
path => '/etc/haproxy/conf.d/015-horizon.cfg',
after => 'listen horizon',
line => " bind ${management_vip}:80",
line => " bind ${zabbix_vip}:80",
before => Exec['haproxy reload'],
}
@ -83,15 +68,4 @@ class plugin_zabbix::ha::haproxy {
Haproxy::Listen <||> -> Exec['haproxy reload']
Haproxy::Balancermember <||> -> Exec['haproxy reload']
firewall { '998 zabbix agent vip':
proto => 'tcp',
action => 'accept',
port => $plugin_zabbix::params::zabbix_ports['agent'],
}
firewall { '998 zabbix server vip':
proto => 'tcp',
action => 'accept',
port => $plugin_zabbix::params::zabbix_ports['server'],
}
}

View File

@ -18,10 +18,10 @@ class plugin_zabbix::params {
include plugin_zabbix::params::openstack
$zabbix_hash = hiera('zabbix_monitoring')
$network_metadata = hiera('network_metadata')
$zabbix_ports = {
server => '10051',
backend_server => '10052',
agent => '10049',
backend_agent => '10050',
api => '80',
@ -82,7 +82,7 @@ class plugin_zabbix::params {
$has_userparameters = true
#server parameters
$server_ip = hiera('management_vip')
$server_ip = $network_metadata['vips']['zabbix_vip_management']['ipaddr']
$server_config = '/etc/zabbix/zabbix_server.conf'
$server_scripts = '/etc/zabbix/externalscripts'
$server_config_template = 'plugin_zabbix/zabbix_server.conf.erb'

View File

@ -24,7 +24,28 @@ class plugin_zabbix::primary_controller {
before => [ Class['plugin_zabbix::frontend'], Cs_resource["p_${plugin_zabbix::params::server_service}"] ],
}
cs_resource { "vip__${plugin_zabbix::params::server_service}":
before => Cs_group["group__${plugin_zabbix::params::server_service}"],
primitive_class => 'ocf',
provided_by => 'heartbeat',
primitive_type => 'IPaddr2',
operations => {
'monitor' => { 'interval' => '3', 'timeout' => '30' },
'start' => { 'interval' => '0', 'timeout' => '30' },
'stop' => { 'interval' => '0', 'timeout' => '30' },
},
metadata => {
'migration-threshold' => '3',
'failure-timeout' => '60',
'resource-stickiness' => '1',
},
parameters => {
'ip' => $plugin_zabbix::params::server_ip,
},
}
cs_resource { "p_${plugin_zabbix::params::server_service}":
before => Cs_group["group__${plugin_zabbix::params::server_service}"],
primitive_class => 'ocf',
provided_by => $plugin_zabbix::params::ocf_scripts_provider,
primitive_type => $plugin_zabbix::params::server_service,
@ -38,8 +59,13 @@ class plugin_zabbix::primary_controller {
},
}
cs_group { "group__${plugin_zabbix::params::server_service}":
primitives => ["vip__${plugin_zabbix::params::server_service}", "p_${plugin_zabbix::params::server_service}"],
}
File[$plugin_zabbix::params::server_config] -> File['zabbix-server-ocf'] -> Cs_resource["p_${plugin_zabbix::params::server_service}"]
Service["${plugin_zabbix::params::server_service}-init-stopped"] -> Cs_resource["p_${plugin_zabbix::params::server_service}"]
Cs_resource["p_${plugin_zabbix::params::server_service}"] -> Service["${plugin_zabbix::params::server_service}-started"]
Cs_group["group__${plugin_zabbix::params::server_service}"] -> Service["${plugin_zabbix::params::server_service}-started"]
Cs_resource["vip__${plugin_zabbix::params::server_service}"] -> Cs_resource["p_${plugin_zabbix::params::server_service}"]
}

View File

@ -48,7 +48,7 @@ StartPollers=10
# Listen port for trapper. Default port number is 10051. This parameter
# must be between 1024 and 32767
ListenPort=<%= if scope.lookupvar('plugin_zabbix::params::zabbix_ports')['backend_server'].nil?; scope.lookupvar('plugin_zabbix::params::zabbix_ports')['server']; else scope.lookupvar('plugin_zabbix::params::zabbix_ports')['backend_server']; end %>
ListenPort=<%= scope.lookupvar('plugin_zabbix::params::zabbix_ports')['server'] %>
# Source IP address for outgouing connections
#SourceIP=
@ -56,7 +56,7 @@ ListenPort=<%= if scope.lookupvar('plugin_zabbix::params::zabbix_ports')['backen
# Listen interface for trapper. Trapper will listen all network interfaces
# if this parameter is missing.
#ListenIP=127.0.0.1
ListenIP=<%= scope.lookupvar('plugin_zabbix::params::server_ip') %>
# How often ZABBIX will perform housekeeping procedure
# (in hours)

View File

@ -2,11 +2,11 @@
name: zabbix_monitoring
title: Zabbix for Fuel
# Plugin version
version: 1.0.0
version: 2.0.0
# Description
description: Enables Zabbix Monitoring. For information how to access Zabbix UI refer to Zabbix plugin User Guide. Zabbix URL schema is http://<VIP>/zabbix
# Required fuel version
fuel_version: ['6.1']
fuel_version: ['7.0']
# Groups
groups: ['monitoring']
# Licenses
@ -19,15 +19,15 @@ authors: ['Dmitry Klenov <dklenov@mirantis.com>', 'Piotr Misiak <pmisiak@miranti
# The plugin is compatible with releases in the list
releases:
- os: ubuntu
version: 2014.2-6.1
version: 2015.1.0-7.0
mode: ['ha']
deployment_scripts_path: deployment_scripts/
repository_path: repositories/ubuntu
- os: centos
version: 2014.2-6.1
version: 2015.1.0-7.0
mode: ['ha']
deployment_scripts_path: deployment_scripts/
repository_path: repositories/centos
# Version of plugin package
package_version: '2.0.0'
package_version: '3.0.0'

7
network_roles.yaml Normal file
View File

@ -0,0 +1,7 @@
- id: "zabbix"
default_mapping: "management"
properties:
subnet: true
gateway: false
vip:
- name: "zabbix_vip_management"