Skip to content

Commit

Permalink
Set pool as default metricset for php_fpm module (#6768)
Browse files Browse the repository at this point in the history
  • Loading branch information
jsoriano authored and ruflin committed Apr 5, 2018
1 parent 3efbb74 commit bf4b84c
Show file tree
Hide file tree
Showing 7 changed files with 17 additions and 14 deletions.
5 changes: 2 additions & 3 deletions metricbeat/docs/modules/php_fpm.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ beta[]
This module periodically fetches metrics from https://php-fpm.org[PHP-FPM]
servers.

The default metricset is `pool`.

[float]
=== Module-specific configuration notes

Expand Down Expand Up @@ -48,9 +50,6 @@ in <<configuration-metricbeat>>. Here is an example configuration:
----
metricbeat.modules:
- module: php_fpm
metricsets: ["pool"]
period: 10s
status_path: "/status"
hosts: ["localhost:8080"]
----

Expand Down
1 change: 1 addition & 0 deletions metricbeat/metricbeat.reference.yml
Original file line number Diff line number Diff line change
Expand Up @@ -426,6 +426,7 @@ metricbeat.modules:
#------------------------------- PHP_FPM Module ------------------------------
- module: php_fpm
metricsets: ["pool"]
enabled: true
period: 10s
status_path: "/status"
hosts: ["localhost:8080"]
Expand Down
6 changes: 6 additions & 0 deletions metricbeat/module/php_fpm/_meta/config.reference.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
- module: php_fpm
metricsets: ["pool"]
enabled: true
period: 10s
status_path: "/status"
hosts: ["localhost:8080"]
3 changes: 0 additions & 3 deletions metricbeat/module/php_fpm/_meta/config.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,2 @@
- module: php_fpm
metricsets: ["pool"]
period: 10s
status_path: "/status"
hosts: ["localhost:8080"]
2 changes: 2 additions & 0 deletions metricbeat/module/php_fpm/_meta/docs.asciidoc
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
This module periodically fetches metrics from https://php-fpm.org[PHP-FPM]
servers.

The default metricset is `pool`.

[float]
=== Module-specific configuration notes

Expand Down
11 changes: 6 additions & 5 deletions metricbeat/module/php_fpm/pool/pool.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,18 +13,19 @@ import (

// init registers the MetricSet with the central registry.
func init() {
if err := mb.Registry.AddMetricSet("php_fpm", "pool", New, HostParser); err != nil {
panic(err)
}
mb.Registry.MustAddMetricSet("php_fpm", "pool", New,
mb.WithHostParser(hostParser),
mb.DefaultMetricSet(),
)
}

const (
defaultScheme = "http"
defaultPath = "/status"
)

// HostParser is used for parsing the configured php-fpm hosts.
var HostParser = parse.URLHostParserBuilder{
// hostParser is used for parsing the configured php-fpm hosts.
var hostParser = parse.URLHostParserBuilder{
DefaultScheme: defaultScheme,
DefaultPath: defaultPath,
QueryParams: "json",
Expand Down
3 changes: 0 additions & 3 deletions metricbeat/modules.d/php_fpm.yml.disabled
Original file line number Diff line number Diff line change
@@ -1,5 +1,2 @@
- module: php_fpm
metricsets: ["pool"]
period: 10s
status_path: "/status"
hosts: ["localhost:8080"]

0 comments on commit bf4b84c

Please sign in to comment.