Updated Branches: refs/heads/trunk b356135d2 -> 1bee56a9b
AMBARI-3573. Configure Ganglia Web Server to use KeepAlive connections. (odiachenko) Project: http://git-wip-us.apache.org/repos/asf/incubator-ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-ambari/commit/1bee56a9 Tree: http://git-wip-us.apache.org/repos/asf/incubator-ambari/tree/1bee56a9 Diff: http://git-wip-us.apache.org/repos/asf/incubator-ambari/diff/1bee56a9 Branch: refs/heads/trunk Commit: 1bee56a9b870e7797fbf7449463e6dc43774dcd0 Parents: b356135 Author: Oleksandr Diachenko <[email protected]> Authored: Tue Oct 22 17:40:12 2013 +0300 Committer: Oleksandr Diachenko <[email protected]> Committed: Tue Oct 22 17:40:12 2013 +0300 ---------------------------------------------------------------------- .../hdp-monitor-webserver/manifests/init.pp | 46 ++++++++++++++++++-- .../main/puppet/modules/hdp/manifests/params.pp | 6 ++- 2 files changed, 47 insertions(+), 5 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-ambari/blob/1bee56a9/ambari-agent/src/main/puppet/modules/hdp-monitor-webserver/manifests/init.pp ---------------------------------------------------------------------- diff --git a/ambari-agent/src/main/puppet/modules/hdp-monitor-webserver/manifests/init.pp b/ambari-agent/src/main/puppet/modules/hdp-monitor-webserver/manifests/init.pp index 1c30e75..6c5cc1d 100644 --- a/ambari-agent/src/main/puppet/modules/hdp-monitor-webserver/manifests/init.pp +++ b/ambari-agent/src/main/puppet/modules/hdp-monitor-webserver/manifests/init.pp @@ -21,7 +21,7 @@ class hdp-monitor-webserver( $service_state = $hdp::params::cluster_service_state, $opts = {} -) inherits hdp::params +) inherits hdp::params { @@ -45,6 +45,27 @@ class hdp-monitor-webserver( $service_name = $service_name_by_os[$hdp::params::hdp_os_type] } + if hdp_is_empty($hdp::params::pathes[httpd_conf_dir]) { + hdp_fail("There is no config dir path for service httpd") + } + else { + $path_by_os = $hdp::params::pathes[httpd_conf_dir] + } + + if hdp_is_empty($path_by_os[$hdp::params::hdp_os_type]) { + + if hdp_is_empty($path_by_os['ALL']) { + hdp_fail("There is no config dir path for service httpd") + } + else { + $httpd_conf_dir = $path_by_os['ALL'] + } + } + else { + $httpd_conf_dir = $path_by_os[$hdp::params::hdp_os_type] + } + + if ($service_state == 'no_op') { } elsif ($service_state in ['running','stopped','installed_and_configured', 'restart']) { @@ -54,13 +75,19 @@ class hdp-monitor-webserver( hdp::exec { 'monitor webserver start': command => "/etc/init.d/$service_name start", unless => "/etc/init.d/$service_name status", - require => Hdp::Package['httpd'] - + require => Hdp::Exec['enabling keepalive for httpd'] + } hdp::package { 'httpd' : size => 64 } + hdp::exec {'enabling keepalive for httpd': + command => "grep -E 'KeepAlive (On|Off)' ${httpd_conf_dir}/httpd.conf && sed -i 's/KeepAlive Off/KeepAlive On/' ${httpd_conf_dir}/httpd.conf || echo 'KeepAlive On' >> ${httpd_conf_dir}/httpd.conf", + require => Hdp::Package['httpd'] + + } + } elsif ($service_state == 'stopped') { # stop should never fail if process already stopped hdp::exec { 'monitor webserver stop': @@ -69,15 +96,26 @@ class hdp-monitor-webserver( } elsif ($service_state == 'restart') { hdp::exec { 'monitor webserver restart': command => "/etc/init.d/$service_name restart", - require => Hdp::Package['httpd'] + require => Hdp::Exec['enabling keepalive for httpd'] } hdp::package { 'httpd' : size => 64 } + + hdp::exec {'enabling keepalive for httpd': + command => "grep -E 'KeepAlive (On|Off)' ${httpd_conf_dir}/httpd.conf && sed -i 's/KeepAlive Off/KeepAlive On/' ${httpd_conf_dir}/httpd.conf || echo 'KeepAlive On' >> ${httpd_conf_dir}/httpd.conf", + require => Hdp::Package['httpd'] + } + } elsif ($service_state == 'installed_and_configured') { hdp::package { 'httpd' : size => 64 } + + hdp::exec {'enabling keepalive for httpd': + command => "grep -E 'KeepAlive (On|Off)' ${httpd_conf_dir}/httpd.conf && sed -i 's/KeepAlive Off/KeepAlive On/' ${httpd_conf_dir}/httpd.conf || echo 'KeepAlive On' >> ${httpd_conf_dir}/httpd.conf", + require => Hdp::Package['httpd'] + } } } else { hdp_fail("TODO not implemented yet: service_state = ${service_state}") http://git-wip-us.apache.org/repos/asf/incubator-ambari/blob/1bee56a9/ambari-agent/src/main/puppet/modules/hdp/manifests/params.pp ---------------------------------------------------------------------- diff --git a/ambari-agent/src/main/puppet/modules/hdp/manifests/params.pp b/ambari-agent/src/main/puppet/modules/hdp/manifests/params.pp index 5466484..881fb18 100644 --- a/ambari-agent/src/main/puppet/modules/hdp/manifests/params.pp +++ b/ambari-agent/src/main/puppet/modules/hdp/manifests/params.pp @@ -404,7 +404,11 @@ class hdp::params() nagios_p1_pl => { 'ALL' => '/usr/bin/p1.pl', suse => '/usr/lib/nagios/p1.pl' - } + }, + httpd_conf_dir => { + 'ALL' => '/etc/httpd/conf', + suse => '/etc/apache2' + }, } $services_names = {
