File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ # Class: datadog_agent::integrations::php_fpm
2+ #
3+ # This class will set-up PHP FPM monitoring
4+ #
5+ # Parameters:
6+ # $status_url
7+ # URL to fetch FPM metrics. Default: http://localhost/status
8+ #
9+ # $ping_url
10+ # URL to get a reliable check of the FPM pool. Default: http://localhost/ping
11+ #
12+ # $tags
13+ # Optional array of tags
14+ #
15+ # Sample Usage:
16+ #
17+ # class { 'datadog_agent::integrations::php_fpm' :
18+ # status_url => 'http://localhost/fpm_status',
19+ # ping_url => 'http://localhost/fpm_ping'
20+ # }
21+ #
22+
23+ class datadog_agent::integrations::php_fpm (
24+ $status_url = ' http://localhost/status' ,
25+ $ping_url = ' http://localhost/ping' ,
26+ $tags = []
27+ ) inherits datadog_agent::params {
28+ include datadog_agent
29+
30+ file { "${datadog_agent::params::conf_dir}/php_fpm.yaml" :
31+ ensure => file ,
32+ owner => $datadog_agent::params::dd_user ,
33+ group => $datadog_agent::params::dd_group ,
34+ mode => ' 0600' ,
35+ content => template (' datadog_agent/agent-conf.d/php_fpm.yaml.erb' ),
36+ require => Package[$datadog_agent::params::package_name ],
37+ notify => Service[$datadog_agent::params::service_name ]
38+ }
39+ }
Original file line number Diff line number Diff line change 1+ require 'spec_helper'
2+
3+ describe 'datadog_agent::integrations::php_fpm' do
4+ let ( :facts ) { {
5+ operatingsystem : 'Ubuntu' ,
6+ } }
7+ let ( :conf_dir ) { '/etc/dd-agent/conf.d' }
8+ let ( :dd_user ) { 'dd-agent' }
9+ let ( :dd_group ) { 'root' }
10+ let ( :dd_package ) { 'datadog-agent' }
11+ let ( :dd_service ) { 'datadog-agent' }
12+ let ( :conf_file ) { "#{ conf_dir } /php_fpm.yaml" }
13+
14+ it { should compile . with_all_deps }
15+ it { should contain_file ( conf_file ) . with (
16+ owner : dd_user ,
17+ group : dd_group ,
18+ mode : '0600' ,
19+ ) }
20+ it { should contain_file ( conf_file ) . that_requires ( "Package[#{ dd_package } ]" ) }
21+ it { should contain_file ( conf_file ) . that_notifies ( "Service[#{ dd_service } ]" ) }
22+
23+ context 'with default parameters' do
24+ it { should contain_file ( conf_file ) . with_content ( /status_url: http:\/ \/ localhost\/ status/ ) }
25+ it { should contain_file ( conf_file ) . with_content ( /ping_url: http:\/ \/ localhost\/ ping/ ) }
26+ end
27+
28+ context 'with parameters set' do
29+ let ( :params ) { {
30+ status_url : 'http://localhost/fpm_status' ,
31+ ping_url : 'http://localhost/fpm_ping' ,
32+ } }
33+ it { should contain_file ( conf_file ) . with_content ( /status_url: http:\/ \/ localhost\/ fpm_status/ ) }
34+ it { should contain_file ( conf_file ) . with_content ( /ping_url: http:\/ \/ localhost\/ fpm_ping/ ) }
35+ end
36+ end
Original file line number Diff line number Diff line change 1+ #
2+ # MANAGED BY PUPPET
3+ #
4+ init_config:
5+
6+ instances:
7+ - # Get metrics from your FPM pool with this URL
8+ status_url: <%= @status_url %>
9+ # Get a reliable service check of your FPM pool with that one
10+ ping_url: <%= @ping_url %>
11+ # Set the expected reply to the ping.
12+ ping_reply: pong
13+ # These 2 URLs should follow the options from your FPM pool
14+ # See http://php.net/manual/en/install.fpm.configuration.php
15+ # * pm.status_path
16+ # * ping.path
17+ # You should configure your fastcgi passthru (nginx/apache) to
18+ # catch these URLs and redirect them through the FPM pool target
19+ # you want to monitor (FPM `listen` directive in the config, usually
20+ # a UNIX socket or TCP socket.
21+ #
22+ <% if @tags and !@tags.empty? -%>
23+ # Array of custom tags
24+ # By default metrics and service check will be tagged by pool and host
25+ tags:
26+ <% @tags.each do |tag| -%>
27+ - <%= tag %>
28+ <% end -%>
29+ <% end -%>
You can’t perform that action at this time.
0 commit comments