-
Notifications
You must be signed in to change notification settings - Fork 4.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Metricbeat module for Traefik (#7413)
Resolves #7412. This PR adds a Metricbeat module for the [Traefik](https://traefik.io/) reverse proxy/load balancer. In this module, it adds the health metricset, whose data it retrieves from polling the Traefik instance's health HTTP API endpoint.
- Loading branch information
1 parent
ddeec6d
commit 4071bc7
Showing
28 changed files
with
718 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
//// | ||
This file is generated! See scripts/docs_collector.py | ||
//// | ||
|
||
[[metricbeat-module-traefik]] | ||
== traefik module | ||
|
||
experimental[] | ||
|
||
This module periodically fetches metrics from a https://traefik.io/[Traefik] | ||
instance. The Traefik instance must be configured to expose it's HTTP API. | ||
|
||
=== Compatibility | ||
|
||
The Traefik metricsets were tested with Traefik 1.6. | ||
|
||
|
||
[float] | ||
=== Example configuration | ||
|
||
The traefik module supports the standard configuration options that are described | ||
in <<configuration-metricbeat>>. Here is an example configuration: | ||
|
||
[source,yaml] | ||
---- | ||
metricbeat.modules: | ||
- module: traefik | ||
metricsets: ["health"] | ||
period: 10s | ||
hosts: ["localhost:8080"] | ||
---- | ||
|
||
[float] | ||
=== Metricsets | ||
|
||
The following metricsets are available: | ||
|
||
* <<metricbeat-metricset-traefik-health,health>> | ||
|
||
include::traefik/health.asciidoc[] | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
//// | ||
This file is generated! See scripts/docs_collector.py | ||
//// | ||
|
||
[[metricbeat-metricset-traefik-health]] | ||
=== traefik health metricset | ||
|
||
experimental[] | ||
|
||
include::../../../module/traefik/health/_meta/docs.asciidoc[] | ||
|
||
|
||
==== Fields | ||
|
||
For a description of each field in the metricset, see the | ||
<<exported-fields-traefik,exported fields>> section. | ||
|
||
Here is an example document generated by this metricset: | ||
|
||
[source,json] | ||
---- | ||
include::../../../module/traefik/health/_meta/data.json[] | ||
---- |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
FROM traefik:1.6-alpine | ||
|
||
COPY ./traefik.toml /etc/traefik/traefik.toml | ||
|
||
RUN apk add --no-cache curl | ||
HEALTHCHECK --interval=1s --retries=90 CMD curl -f http://localhost:8080/health |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
- module: traefik | ||
metricsets: ["health"] | ||
period: 10s | ||
hosts: ["localhost:8080"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
This module periodically fetches metrics from a https://traefik.io/[Traefik] | ||
instance. The Traefik instance must be configured to expose it's HTTP API. | ||
|
||
=== Compatibility | ||
|
||
The Traefik metricsets were tested with Traefik 1.6. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
TRAEFIK_HOST=traefik | ||
TRAEFIK_API_PORT=8080 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
- key: traefik | ||
title: "traefik" | ||
description: > | ||
Traefik reverse proxy / load balancer metrics | ||
fields: | ||
- name: traefik | ||
type: group | ||
description: > | ||
Traefik reverse proxy / load balancer metrics | ||
fields: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
[api] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
// Licensed to Elasticsearch B.V. under one or more contributor | ||
// license agreements. See the NOTICE file distributed with | ||
// this work for additional information regarding copyright | ||
// ownership. Elasticsearch B.V. licenses this file to you under | ||
// the Apache License, Version 2.0 (the "License"); you may | ||
// not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, | ||
// software distributed under the License is distributed on an | ||
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
// KIND, either express or implied. See the License for the | ||
// specific language governing permissions and limitations | ||
// under the License. | ||
|
||
// Package traefik is a Metricbeat module that contains MetricSets. | ||
package traefik |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
{ | ||
"@timestamp": "2017-10-12T08:05:34.853Z", | ||
"beat": { | ||
"hostname": "host.example.com", | ||
"name": "host.example.com" | ||
}, | ||
"metricset": { | ||
"host": "127.0.0.1:8080", | ||
"module": "traefik", | ||
"name": "health", | ||
"rtt": 115 | ||
}, | ||
"traefik": { | ||
"health": { | ||
"response": { | ||
"avg_time": { | ||
"us": 32 | ||
}, | ||
"count": 15, | ||
"status_codes": { | ||
"404": 15 | ||
} | ||
}, | ||
"uptime": { | ||
"sec": 1944 | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
=== traefik health MetricSet | ||
|
||
This is the health metricset of the module traefik. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
- name: health | ||
type: group | ||
description: > | ||
Metrics obtained from Traefik's health API endpoint | ||
fields: | ||
- name: uptime.sec | ||
type: long | ||
description: > | ||
Uptime of Traefik instance in seconds | ||
- name: response | ||
type: group | ||
description: > | ||
Response metrics | ||
fields: | ||
- name: count | ||
type: long | ||
description: > | ||
Number of responses | ||
- name: avg_time.us | ||
type: long | ||
description: > | ||
Average response time in microseconds | ||
- name: status_code | ||
type: object | ||
object_type: long | ||
description: > | ||
Number of responses per status code |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
{ | ||
"pid": 1, | ||
"uptime": "17h51m23.252891567s", | ||
"uptime_sec": 64283.252891567, | ||
"time": "2018-06-27 22:07:28.966768969 +0000 UTC m=+64283.314491879", | ||
"unixtime": 1530137248, | ||
"status_code_count": {}, | ||
"total_status_code_count": { | ||
"200": 17, | ||
"404": 1 | ||
}, | ||
"count": 0, | ||
"total_count": 18, | ||
"total_response_time": "272.119µs", | ||
"total_response_time_sec": 0.000272119, | ||
"average_response_time": "15.117µs", | ||
"average_response_time_sec": 1.5117e-05 | ||
} |
Oops, something went wrong.