-
Notifications
You must be signed in to change notification settings - Fork 4.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Metricbeat module for Traefik #7413
Changes from 41 commits
4ac476a
07afa97
1da6229
6abccaf
897f576
102e5e7
1349b5f
d16cec2
4d85bf2
9e9d51d
caeee0c
acb87e4
a0c4b10
70b00ff
56b8927
a76b7c7
fe0c7fc
932073d
ff5c8a2
7584cf8
b67847f
de9c972
fe80d57
b027607
7650731
48490e9
8998c45
bd131f7
41ab4de
89b99b5
2cc6ac6
c4f6ade
f0ab0eb
6292c7f
03d6a9f
a0b5191
d9ec2fb
bed5d3c
69e433a
2f26d10
3b0ef8b
249f97f
072dda2
32a2914
5fb7c35
51d1f37
44d4e60
5295345
bb54c34
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
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[] | ||
|
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[] | ||
---- |
Large diffs are not rendered by default.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
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 |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
- module: traefik | ||
metricsets: ["health"] | ||
period: 10s | ||
hosts: ["localhost:8080"] |
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. |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
TRAEFIK_HOST=traefik | ||
TRAEFIK_API_PORT=8080 |
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: |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
[api] |
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 |
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 | ||
} | ||
} | ||
} | ||
} |
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. |
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_codes | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I would call it
|
||
type: object | ||
object_type: long | ||
description: > | ||
Number of responses per status code |
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 | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is the purpose of this file? How is it used?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is an example output document that we should in the docs. It is generated by this command here: https://github.com/elastic/beats/blob/master/metricbeat/Makefile#L73 As this updates all data.json I normally run the following command:
In you case this assumes the traefik docker container is running and exposes the port on localhost. This will generate a data.json file and
make update
will link it in the docs.Here you can see an example in the docs: https://www.elastic.co/guide/en/beats/metricbeat/master/metricbeat-metricset-elasticsearch-index.html