From dd1734927442b8a124ffc15d7ff611d75f8f7327 Mon Sep 17 00:00:00 2001 From: Gilles Dubreuil Date: Fri, 13 Dec 2013 16:23:02 +1100 Subject: [PATCH] Added monitoring with nagios --- bin/seeds.rb | 8 ++++++- config/hostgroups.yaml | 2 ++ config/quickstack.yaml.erb | 4 ++++ .../quickstack/manifests/compute_common.pp | 15 ++++++++++-- .../quickstack/manifests/controller_common.pp | 11 ++++++++- .../quickstack/manifests/monitoring/client.pp | 21 +++++++++++++++++ .../quickstack/manifests/monitoring/server.pp | 23 +++++++++++++++++++ .../quickstack/manifests/neutron/compute.pp | 6 +++++ .../manifests/neutron/controller.pp | 6 +++++ .../quickstack/manifests/neutron/networker.pp | 11 +++++++++ .../manifests/nova_network/compute.pp | 7 +++++- .../manifests/nova_network/controller.pp | 7 ++++++ puppet/modules/quickstack/manifests/params.pp | 7 ++++++ 13 files changed, 123 insertions(+), 5 deletions(-) create mode 100644 puppet/modules/quickstack/manifests/monitoring/client.pp create mode 100644 puppet/modules/quickstack/manifests/monitoring/server.pp diff --git a/bin/seeds.rb b/bin/seeds.rb index 01b6f04e..dd990876 100644 --- a/bin/seeds.rb +++ b/bin/seeds.rb @@ -408,6 +408,10 @@ "wsrep_ssl" => true, "wsrep_ssl_key" => "/etc/pki/galera/galera.key", "wsrep_ssl_cert" => "/etc/pki/galera/galera.crt", + "monitoring" => 'nagios', + "monitoring_adm_passwd" => SecureRandom.hex, + "monitoring_host" => '172.16.0.1', + "monitoring_interface" => 'eth0', } hostgroups = [ @@ -452,7 +456,9 @@ "quickstack::gluster::server", ]}, {:name=>"Galera Server", - :class=>"quickstack::galera::server"} + :class=>"quickstack::galera::server"}, + {:name=>"Nagios Server", + :class=>"quickstack::monitoring::server"} ] def get_key_type(value) diff --git a/config/hostgroups.yaml b/config/hostgroups.yaml index c9482b24..f576cfe9 100644 --- a/config/hostgroups.yaml +++ b/config/hostgroups.yaml @@ -41,3 +41,5 @@ - quickstack::gluster::server - :name: Galera Server :class: quickstack::galera::server +- :name: Nagios Server + :class: quickstack::monitoring::server diff --git a/config/quickstack.yaml.erb b/config/quickstack.yaml.erb index b7ee13fe..8f947f40 100644 --- a/config/quickstack.yaml.erb +++ b/config/quickstack.yaml.erb @@ -177,3 +177,7 @@ wsrep_sst_password: <%= passwd_auto %> wsrep_ssl: true wsrep_ssl_key: /etc/pki/galera/galera.key wsrep_ssl_cert: /etc/pki/galera/galera.crt +monitoring: nagios +monitoring_adm_passwd: <%= passwd_auto %> +monitoring_host: 172.16.0.1 +monitoring_interface: eth0 diff --git a/puppet/modules/quickstack/manifests/compute_common.pp b/puppet/modules/quickstack/manifests/compute_common.pp index 7e02c947..f7d404aa 100644 --- a/puppet/modules/quickstack/manifests/compute_common.pp +++ b/puppet/modules/quickstack/manifests/compute_common.pp @@ -18,8 +18,8 @@ $ceilometer = 'true', $ceilometer_metering_secret = $quickstack::params::ceilometer_metering_secret, $ceilometer_user_password = $quickstack::params::ceilometer_user_password, - $ceph_cluster_network = '', - $ceph_public_network = '', + $ceph_cluster_network = '', + $ceph_public_network = '', $ceph_fsid = '', $ceph_images_key = '', $ceph_volumes_key = '', @@ -35,6 +35,9 @@ $libvirt_inject_password = 'false', $libvirt_inject_key = 'false', $libvirt_images_type = 'rbd', + $monitoring = $quickstack::params::monitoring, + $monitoring_host = $quickstack::params::monitoring_host, + $monitoring_interface = $quickstack::params::monitoring_interface, $mysql_ca = $quickstack::params::mysql_ca, $mysql_host = $quickstack::params::mysql_host, $nova_host = '127.0.0.1', @@ -220,4 +223,12 @@ dport => '5900-5999', action => 'accept', } + + if ($monitoring) { + class {'quickstack::monitoring::client': + monitoring => $monitoring, + monitoring_host => $monitoring_host, + monitoring_interface => $monitoring_interface, + } + } } diff --git a/puppet/modules/quickstack/manifests/controller_common.pp b/puppet/modules/quickstack/manifests/controller_common.pp index 0e36b8fa..3a94617b 100644 --- a/puppet/modules/quickstack/manifests/controller_common.pp +++ b/puppet/modules/quickstack/manifests/controller_common.pp @@ -61,6 +61,9 @@ $keystone_db_password = $quickstack::params::keystone_db_password, $keystonerc = false, $neutron_metadata_proxy_secret = $quickstack::params::neutron_metadata_proxy_secret, + $monitoring = $quickstack::params::monitoring, + $monitoring_host = $quickstack::params::monitoring_host, + $monitoring_interface = $quickstack::params::monitoring_interface, $mysql_host = $quickstack::params::mysql_host, $mysql_root_password = $quickstack::params::mysql_root_password, $neutron = $quickstack::params::neutron, @@ -92,7 +95,6 @@ $horizon_cert = $quickstack::params::horizon_cert, $horizon_key = $quickstack::params::horizon_key, $amqp_nssdb_password = $quickstack::params::amqp_nssdb_password, - ) inherits quickstack::params { class {'quickstack::openstack_common': } @@ -491,4 +493,11 @@ } } + if ($monitoring) { + class {'quickstack::monitoring::client': + monitoring => $monitoring, + monitoring_host => $monitoring_host, + monitoring_interface => $monitoring_interface, + } + } } diff --git a/puppet/modules/quickstack/manifests/monitoring/client.pp b/puppet/modules/quickstack/manifests/monitoring/client.pp new file mode 100644 index 00000000..06c7fe70 --- /dev/null +++ b/puppet/modules/quickstack/manifests/monitoring/client.pp @@ -0,0 +1,21 @@ +# Quickstack Monitoring client +class quickstack::monitoring::client ( + $monitoring, + $monitoring_host, + $monitoring_interface, +) { + case $monitoring { + 'nagios': { + class {'nagios::client': + monitored_ip => getvar("ipaddress_${monitoring_interface}"), + nagios_server_host => $monitoring_host, + } + + firewall {'001 Nagios NRPE incoming': + proto => 'tcp', + dport => '5666', + action => 'accept', + } + } + } +} diff --git a/puppet/modules/quickstack/manifests/monitoring/server.pp b/puppet/modules/quickstack/manifests/monitoring/server.pp new file mode 100644 index 00000000..11060182 --- /dev/null +++ b/puppet/modules/quickstack/manifests/monitoring/server.pp @@ -0,0 +1,23 @@ +# Quickstack Monitoring Server +class quickstack::monitoring::server ( + $admin_password, + $monitoring, + $monitoring_adm_passwd, + $controller_admin_host, +) { + case $monitoring { + 'nagios': { + class {'nagios::server': + admin_password => $monitoring_adm_passwd, + openstack_adm_passwd => $admin_password, + openstack_controller => $controller_admin_host, + } + + firewall {'001 Nagios Server incoming': + proto => 'tcp', + dport => ['80'], + action => 'accept', + } + } + } +} diff --git a/puppet/modules/quickstack/manifests/neutron/compute.pp b/puppet/modules/quickstack/manifests/neutron/compute.pp index 02c45114..c459cd7d 100644 --- a/puppet/modules/quickstack/manifests/neutron/compute.pp +++ b/puppet/modules/quickstack/manifests/neutron/compute.pp @@ -19,6 +19,9 @@ $glance_host = '127.0.0.1', $nova_host = '127.0.0.1', $enable_tunneling = $quickstack::params::enable_tunneling, + $monitoring = $quickstack::params::monitoring, + $monitoring_host = $quickstack::params::monitoring_host, + $monitoring_interface = $quickstack::params::monitoring_interface, $mysql_host = $quickstack::params::mysql_host, $neutron_db_password = $quickstack::params::neutron_db_password, $neutron_user_password = $quickstack::params::neutron_user_password, @@ -166,6 +169,9 @@ private_iface => $private_iface, private_ip => $private_ip, private_network => $private_network, + monitoring => $monitoring, + monitoring_host => $monitoring_host, + monitoring_interface => $monitoring_interface, } class {'quickstack::neutron::firewall::gre':} diff --git a/puppet/modules/quickstack/manifests/neutron/controller.pp b/puppet/modules/quickstack/manifests/neutron/controller.pp index 9a95ee65..0611a1c5 100644 --- a/puppet/modules/quickstack/manifests/neutron/controller.pp +++ b/puppet/modules/quickstack/manifests/neutron/controller.pp @@ -111,6 +111,9 @@ $horizon_cert = $quickstack::params::horizon_cert, $horizon_key = $quickstack::params::horizon_key, $amqp_nssdb_password = $quickstack::params::amqp_nssdb_password, + $monitoring = $quickstack::params::monitoring, + $monitoring_host = $quickstack::params::monitoring_host, + $monitoring_interface = $quickstack::params::monitoring_interface, ) inherits quickstack::params { if str2bool_i("$ssl") { @@ -215,6 +218,9 @@ horizon_cert => $horizon_cert, horizon_key => $horizon_key, amqp_nssdb_password => $amqp_nssdb_password, + monitoring => $monitoring, + monitoring_host => $monitoring_host, + monitoring_interface => $monitoring_interface, } -> class { '::neutron': diff --git a/puppet/modules/quickstack/manifests/neutron/networker.pp b/puppet/modules/quickstack/manifests/neutron/networker.pp index 3954ff42..b1802c86 100644 --- a/puppet/modules/quickstack/manifests/neutron/networker.pp +++ b/puppet/modules/quickstack/manifests/neutron/networker.pp @@ -27,6 +27,9 @@ $verbose = $quickstack::params::verbose, $ssl = $quickstack::params::ssl, $mysql_ca = $quickstack::params::mysql_ca, + $monitoring = $quickstack::params::monitoring, + $monitoring_host = $quickstack::params::monitoring_host, + $monitoring_interface = $quickstack::params::monitoring_interface, ) inherits quickstack::params { class {'quickstack::openstack_common': } @@ -106,4 +109,12 @@ class {'quickstack::neutron::firewall::vxlan': port => $ovs_vxlan_udp_port, } + + if ($monitoring) { + class {'quickstack::monitoring::client': + monitoring => $monitoring, + monitoring_host => $monitoring_host, + monitoring_interface => $monitoring_interface, + } + } } diff --git a/puppet/modules/quickstack/manifests/nova_network/compute.pp b/puppet/modules/quickstack/manifests/nova_network/compute.pp index eebeeb13..7def11fb 100644 --- a/puppet/modules/quickstack/manifests/nova_network/compute.pp +++ b/puppet/modules/quickstack/manifests/nova_network/compute.pp @@ -18,6 +18,9 @@ $glance_backend_rbd = 'false', $glance_host = '127.0.0.1', $nova_host = '127.0.0.1', + $monitoring = $quickstack::params::monitoring, + $monitoring_host = $quickstack::params::monitoring_host, + $monitoring_interface = $quickstack::params::monitoring_interface, $mysql_host = $quickstack::params::mysql_host, $auto_assign_floating_ip = 'True', $nova_multi_host = 'True', @@ -53,7 +56,6 @@ $private_iface = '', $private_ip = '', $private_network = '', - ) inherits quickstack::params { # Configure Nova @@ -129,5 +131,8 @@ private_iface => $private_iface, private_ip => $private_ip, private_network => $private_network, + monitoring => $monitoring, + monitoring_host => $monitoring_host, + monitoring_interface => $monitoring_interface, } } diff --git a/puppet/modules/quickstack/manifests/nova_network/controller.pp b/puppet/modules/quickstack/manifests/nova_network/controller.pp index 3beffe4a..fdfae2e5 100644 --- a/puppet/modules/quickstack/manifests/nova_network/controller.pp +++ b/puppet/modules/quickstack/manifests/nova_network/controller.pp @@ -87,6 +87,9 @@ $horizon_cert = $quickstack::params::horizon_cert, $horizon_key = $quickstack::params::horizon_key, $amqp_nssdb_password = $quickstack::params::amqp_nssdb_password, + $monitoring = $quickstack::params::monitoring, + $monitoring_host = $quickstack::params::monitoring_host, + $monitoring_interface = $quickstack::params::monitoring_interface, $auto_assign_floating_ip ) inherits quickstack::params { @@ -187,5 +190,9 @@ horizon_cert => $horizon_cert, horizon_key => $horizon_key, amqp_nssdb_password => $amqp_nssdb_password, + + monitoring => $monitoring, + monitoring_host => $monitoring_host, + monitoring_interface => $monitoring_interface, } } diff --git a/puppet/modules/quickstack/manifests/params.pp b/puppet/modules/quickstack/manifests/params.pp index e5af7ecd..715e5ba9 100644 --- a/puppet/modules/quickstack/manifests/params.pp +++ b/puppet/modules/quickstack/manifests/params.pp @@ -86,6 +86,13 @@ # Gluster $gluster_open_port_count = '10', + # Monitoring + # Options are none ('') or 'nagios' for now + $monitoring = '', + $monitoring_host = '172.16.0.1', + $monitoring_interface = 'eth0', + $monitoring_adm_passwd = 'CHANGEME', + # Networking $neutron = 'false', $controller_admin_host = '172.16.0.1',