diff --git a/deployment_scripts/puppet/manifests/controller.pp b/deployment_scripts/puppet/manifests/controller.pp index c7dfc81cc..ba4a794fc 100644 --- a/deployment_scripts/puppet/manifests/controller.pp +++ b/deployment_scripts/puppet/manifests/controller.pp @@ -84,4 +84,7 @@ if $fuel_settings['lma_collector']['influxdb_mode'] != 'disabled' { if $enable_notifications { class { 'lma_collector::notifications::metrics': } } + + # Enable Apache status module + class { 'lma_collector::mod_status': } } diff --git a/deployment_scripts/puppet/modules/lma_collector/files/apache/status.conf b/deployment_scripts/puppet/modules/lma_collector/files/apache/status.conf new file mode 100644 index 000000000..60cb602aa --- /dev/null +++ b/deployment_scripts/puppet/modules/lma_collector/files/apache/status.conf @@ -0,0 +1,8 @@ + + SetHandler server-status + Order deny,allow + Deny from all + Allow from localhost + + +ExtendedStatus On diff --git a/deployment_scripts/puppet/modules/lma_collector/files/apache/status.load b/deployment_scripts/puppet/modules/lma_collector/files/apache/status.load new file mode 100644 index 000000000..737b2171c --- /dev/null +++ b/deployment_scripts/puppet/modules/lma_collector/files/apache/status.load @@ -0,0 +1 @@ +LoadModule status_module modules/mod_status.so diff --git a/deployment_scripts/puppet/modules/lma_collector/files/plugins/decoders/collectd.lua b/deployment_scripts/puppet/modules/lma_collector/files/plugins/decoders/collectd.lua index a93b65c4a..f46c186e9 100644 --- a/deployment_scripts/puppet/modules/lma_collector/files/plugins/decoders/collectd.lua +++ b/deployment_scripts/puppet/modules/lma_collector/files/plugins/decoders/collectd.lua @@ -120,6 +120,9 @@ function process_message () msg['Fields']['name'] = 'memcached' .. sep .. string.gsub(metric_name, 'memcached_', '') elseif metric_source == 'haproxy' then msg['Fields']['name'] = 'haproxy' .. sep .. sample['type_instance'] + elseif metric_source == 'apache' then + metric_name = string.gsub(metric_name, 'apache_', '') + msg['Fields']['name'] = 'apache' .. sep .. string.gsub(metric_name, 'scoreboard', 'workers') else msg['Fields']['name'] = metric_name end diff --git a/deployment_scripts/puppet/modules/lma_collector/manifests/collectd/controller.pp b/deployment_scripts/puppet/modules/lma_collector/manifests/collectd/controller.pp index 59c50813c..9cac38cfa 100644 --- a/deployment_scripts/puppet/modules/lma_collector/manifests/collectd/controller.pp +++ b/deployment_scripts/puppet/modules/lma_collector/manifests/collectd/controller.pp @@ -107,4 +107,13 @@ class lma_collector::collectd::controller ( class { 'collectd::plugin::memcached': } + + class { 'collectd::plugin::apache': + instances => { + 'localhost' => { + 'url' => 'http://localhost/server-status?auto' + }, + } + } + } diff --git a/deployment_scripts/puppet/modules/lma_collector/manifests/mod_status.pp b/deployment_scripts/puppet/modules/lma_collector/manifests/mod_status.pp new file mode 100644 index 000000000..790faadc6 --- /dev/null +++ b/deployment_scripts/puppet/modules/lma_collector/manifests/mod_status.pp @@ -0,0 +1,48 @@ +# Class: lma_collector::mod_status +# +# We don't use apache::mod_status because it requires to include the apache +# base class. And by doing this we overwrite horizon configuration. + +class lma_collector::mod_status { + + include apache::params + include apache::service + + case $::osfamily { + 'redhat': { + $status_conf = '/etc/httpd/conf.d/status.conf' + $status_load = '/etc/httpd/conf.d/status.load' + + file { $status_load: + source => 'puppet:///modules/lma_collector/apache/status.load' + } + + file { $status_conf: + source => 'puppet:///modules/lma_collector/apache/status.conf', + require => File[$status_load], + notify => Class['apache::service'], + } + } + + 'debian': { + $status_conf = '/etc/apache2/mods-enabled/status.conf' + $status_load = '/etc/apache2/mods-enabled/status.load' + + file { $status_conf: + ensure => link, + target => '/etc/apache2/mods-available/status.conf', + } + + file { $status_load: + ensure => link, + target => '/etc/apache2/mods-available/status.load', + require => File[$status_conf], + notify => Class['apache::service'], + } + } + + default : { + notify {"Cannot enable apache status module on ${::operatingsystem}": } + } + } +} diff --git a/deployment_scripts/puppet/modules/lma_collector/metadata.json b/deployment_scripts/puppet/modules/lma_collector/metadata.json index 5a2ac05d2..c31c35ee6 100644 --- a/deployment_scripts/puppet/modules/lma_collector/metadata.json +++ b/deployment_scripts/puppet/modules/lma_collector/metadata.json @@ -19,6 +19,7 @@ ], "description": "Puppet module for configuring the LMA collector service", "dependencies": [ + {"name": "puppetlabs/apache", "version_requirement": ">= 1.4.0"}, {"name": "puppetlabs/stdlib", "version_requirement": "4.x"}, {"name": "pdxcat/collectd", "version_requirement": "3.x"}, {"name": "mirantis/heka", "version_requirement": "1.x"} diff --git a/doc/source/conf.py b/doc/source/conf.py index 0924cb8b0..cf09c5769 100644 --- a/doc/source/conf.py +++ b/doc/source/conf.py @@ -68,6 +68,7 @@ release = '1.0' # List of patterns, relative to source directory, that match files and # directories to ignore when looking for source files. exclude_patterns = [ + 'metrics/apache.rst', 'metrics/mysql.rst', 'metrics/openstack.rst', 'metrics/rabbitmq.rst', diff --git a/doc/source/metrics.rst b/doc/source/metrics.rst index 4b4927e29..a5d825e39 100644 --- a/doc/source/metrics.rst +++ b/doc/source/metrics.rst @@ -74,6 +74,11 @@ System .. include:: metrics/system.rst +Apache +------ + +.. include:: metrics/apache.rst + MySQL ----- diff --git a/doc/source/metrics/apache.rst b/doc/source/metrics/apache.rst new file mode 100644 index 000000000..a03155970 --- /dev/null +++ b/doc/source/metrics/apache.rst @@ -0,0 +1,9 @@ +.. _Apache_metrics: + +* ``apache.bytes``, the number of bytes per second transmitted by the server. +* ``apache.requests``, the number of requests processed per second. +* ``apache.connections``, the current number of active connections. +* ``apache.idle_workers``, the current number of idle workers. +* ``apache.workers.``, the current number of workers by state. + +```` is one of ``closing``, ``dnslookup``, ``finishing``, ``idle_cleanup``, ``keepalive``, ``logging``, ``open``, ``reading``, ``sending``, ``starting``, ``waiting``. diff --git a/pre_build_hook b/pre_build_hook index a368ef5d9..d592a49e8 100755 --- a/pre_build_hook +++ b/pre_build_hook @@ -9,6 +9,7 @@ HEKA_VERSION="0.9.0" FUEL_LIB_VERSION="6.0" FUEL_LIB_TARBALL_URL="https://github.com/stackforge/fuel-library/archive/${FUEL_LIB_VERSION}.tar.gz" COLLECTD_TARBALL_URL="https://forgeapi.puppetlabs.com/v3/files/pdxcat-collectd-3.2.0.tar.gz" +APACHE_TARBALL_URL="https://forgeapi.puppetlabs.com/v3/files/puppetlabs-apache-1.4.0.tar.gz" function download_packages { while [ $# -gt 0 ]; do @@ -60,3 +61,9 @@ wget -qO- "${FUEL_LIB_TARBALL_URL}" | \ rm -rf ${MODULES_DIR}/collectd mkdir -p ${MODULES_DIR}/collectd wget -qO- "${COLLECTD_TARBALL_URL}" | tar -C "${MODULES_DIR}/collectd" --strip-components=1 -xz + +# Apache is not available in Fuel 6.0. It will be available in 6.1. So until the switch to 6.1 +# we download it from puppetlabs. +rm -rf ${MODULES_DIR}/apache +mkdir -p ${MODULES_DIR}/apache +wget -qO- "${APACHE_TARBALL_URL}" | tar -C "${MODULES_DIR}/apache" --strip-components=1 -xz