From c1f2b3d8133afc49e436e0d42918db62925c0d1c Mon Sep 17 00:00:00 2001 From: James Kirsop Date: Mon, 2 May 2022 12:51:08 +1000 Subject: [PATCH 1/2] Adding support for some FPM options --- manifests/init.pp | 3 +++ manifests/web.pp | 2 ++ templates/web/php-fpm.d.zabbix.conf.epp | 6 ++++++ 3 files changed, 11 insertions(+) diff --git a/manifests/init.pp b/manifests/init.pp index b1c1787f5..41f49dd9f 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -341,6 +341,7 @@ Optional[Stdlib::Absolutepath] $saml_sp_key = $zabbix::params::saml_sp_key, Optional[Stdlib::Absolutepath] $saml_sp_cert = $zabbix::params::saml_sp_cert, Optional[Stdlib::Absolutepath] $saml_idp_cert = $zabbix::params::saml_idp_cert, + Optional[Integer[1, 1000]] $fpm_max_requests = $zabbix::params::fpm_max_requests, Hash[String[1], Variant[ScalarData, Hash]] $saml_settings = $zabbix::params::saml_settings, ) inherits zabbix::params { class { 'zabbix::web': @@ -388,6 +389,8 @@ saml_sp_cert => $saml_sp_cert, saml_idp_cert => $saml_idp_cert, saml_settings => $saml_settings, + fpm_max_requests => $fpm_max_requests, + fpm_max_spare_servers => $fpm_max_spare_servers, manage_selinux => $manage_selinux, require => Class['zabbix::server'], } diff --git a/manifests/web.pp b/manifests/web.pp index 678f0d77f..15fc60e5e 100644 --- a/manifests/web.pp +++ b/manifests/web.pp @@ -139,6 +139,8 @@ Optional[Stdlib::Absolutepath] $saml_sp_key = $zabbix::params::saml_sp_key, Optional[Stdlib::Absolutepath] $saml_sp_cert = $zabbix::params::saml_sp_cert, Optional[Stdlib::Absolutepath] $saml_idp_cert = $zabbix::params::saml_idp_cert, + Optional[Integer[1, 1000]] $fpm_max_requests = $zabbix::params::fpm_max_requests, + Optional[Integer[1, 100]] $fpm_max_spare_servers = $zabbix::params::fpm_max_spare_servers, Hash[String[1], Variant[ScalarData, Hash]] $saml_settings = $zabbix::params::saml_settings, $puppetgem = $zabbix::params::puppetgem, Boolean $manage_selinux = $zabbix::params::manage_selinux, diff --git a/templates/web/php-fpm.d.zabbix.conf.epp b/templates/web/php-fpm.d.zabbix.conf.epp index a8a8fff80..2c5992304 100644 --- a/templates/web/php-fpm.d.zabbix.conf.epp +++ b/templates/web/php-fpm.d.zabbix.conf.epp @@ -12,6 +12,12 @@ pm.max_children = 50 pm.start_servers = 5 pm.min_spare_servers = 5 pm.max_spare_servers = 35 +<% if $zabbix::web::fpm_max_requests { %> +pm.max_requests = <%= $zabbix::web::fpm_max_requests %> +<% } %> +<% if $zabbix::web::fpm_max_spare_servers { %> +pm.max_spare_servers = <%= $zabbix::web::fpm_max_spare_servers %> +<% } %> php_value[session.save_handler] = files php_value[session.save_path] = /var<%= $zabbix::web::fpm_scl_prefix %>/lib/php/session/ From 71d639425b6939781a17abaa418720b50a523593 Mon Sep 17 00:00:00 2001 From: James Kirsop Date: Mon, 2 May 2022 13:07:54 +1000 Subject: [PATCH 2/2] Changing fpm max_spare_serers default --- manifests/init.pp | 5 ++++- manifests/params.pp | 1 + templates/web/php-fpm.d.zabbix.conf.epp | 5 +---- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/manifests/init.pp b/manifests/init.pp index 41f49dd9f..82f2ab0d8 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -197,6 +197,8 @@ # @param saml_sp_key The location of the SAML Service Provider Key file. # @param saml_sp_cert The location of the SAML Service Provider Certificate. # @param saml_idp_cert The location of the SAML Identity Provider Certificate. +# @param fpm_max_requests The number of requests each child process should execute before respawning. +# @param fpm_max_spare_servers The desired maximum number of idle server processes. # @param saml_settings A hash of additional SAML SSO settings. # @example Single host setup: # class { 'zabbix': @@ -341,7 +343,8 @@ Optional[Stdlib::Absolutepath] $saml_sp_key = $zabbix::params::saml_sp_key, Optional[Stdlib::Absolutepath] $saml_sp_cert = $zabbix::params::saml_sp_cert, Optional[Stdlib::Absolutepath] $saml_idp_cert = $zabbix::params::saml_idp_cert, - Optional[Integer[1, 1000]] $fpm_max_requests = $zabbix::params::fpm_max_requests, + Optional[Integer[1, 10000]] $fpm_max_requests = $zabbix::params::fpm_max_requests, + Optional[Integer[1, 1000]] $fpm_max_spare_servers = $zabbix::params::fpm_max_spare_servers, Hash[String[1], Variant[ScalarData, Hash]] $saml_settings = $zabbix::params::saml_settings, ) inherits zabbix::params { class { 'zabbix::web': diff --git a/manifests/params.pp b/manifests/params.pp index 99b5d09b8..c8122d9e6 100644 --- a/manifests/params.pp +++ b/manifests/params.pp @@ -189,6 +189,7 @@ $saml_sp_cert = undef $saml_idp_cert = undef $saml_settings = {} + $fpm_max_spare_servers = 35 # Zabbix-server $server_alertscriptspath = '/etc/zabbix/alertscripts' diff --git a/templates/web/php-fpm.d.zabbix.conf.epp b/templates/web/php-fpm.d.zabbix.conf.epp index 2c5992304..c4f17e057 100644 --- a/templates/web/php-fpm.d.zabbix.conf.epp +++ b/templates/web/php-fpm.d.zabbix.conf.epp @@ -11,13 +11,10 @@ pm = dynamic pm.max_children = 50 pm.start_servers = 5 pm.min_spare_servers = 5 -pm.max_spare_servers = 35 +pm.max_spare_servers = <%= $zabbix::web::fpm_max_spare_servers %> <% if $zabbix::web::fpm_max_requests { %> pm.max_requests = <%= $zabbix::web::fpm_max_requests %> <% } %> -<% if $zabbix::web::fpm_max_spare_servers { %> -pm.max_spare_servers = <%= $zabbix::web::fpm_max_spare_servers %> -<% } %> php_value[session.save_handler] = files php_value[session.save_path] = /var<%= $zabbix::web::fpm_scl_prefix %>/lib/php/session/