Skip to content
Permalink
Branch: master
Find file Copy path
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
136 lines (88 sloc) 3.94 KB

Traefik Integration

Overview

This integration collects data from Traefik in order to check its health and monitor:

  • Errors logs (4xx codes, 5xx codes)
  • Number of requests
  • Number of bytes exchanged

Setup

Installation

To install the Traefik check on your host:

  1. Install the developer toolkit on any machine.
  2. Run ddev release build traefik to build the package.
  3. Download the Datadog Agent.
  4. Upload the build artifact to any host with an Agent and run datadog-agent integration install -w path/to/traefik/dist/<ARTIFACT_NAME>.whl.

Configuration

  1. Edit the traefik.d/conf.yaml file in the conf.d/ folder at the root of your Agent's configuration directory to start collecting your Traefik metrics and logs. See the sample traefik.d/conf.yaml for all available configuration options.

  2. Restart the Agent

Metric Collection

Add this configuration setup to your traefik.yaml file to start gathering your metrics:

init_config:

instances:
  - host: 10.1.2.3
    port: "8080"
    path: "/health"

Configuration Options:

  • host: Traefik endpoint to query. Required
  • port: API listener of Traefik endpoint. Default value 8080. Optional
  • path: Path of Traefik health check endpoint. Default /health. Optional

Restart the Agent to begin sending Traefik metrics to Datadog.

Log Collection

Available for Agent >6.0

By default Traefik logs are sent to stdout. This should not be changed for containerized version, as the Datadog Agent is able to collect logs directly from container stdout/stderr.

To configure Traefik to log to a file, add the following in the Traefik configuration file:

[traefikLog]
  filePath = "/path/to/traefik.log"

The common Apache Access format is used by default and is supported by this integration.

  1. Collecting logs is disabled by default in the Datadog Agent. Enable it in your datadog.yaml file with:

    logs_enabled: true
  2. Add this configuration block to your traefik.d/conf.yaml file at the root of your Agent's configuration directory to start collecting your Traefik logs:

    logs:
      - type: file
        path: /path/to/traefik.log
        source: traefik
        service: traefik
  • Change the path and service parameter values and configure them for your environment.

  • Restart the Agent

Validation

Run the Agent's status subcommand and look for traefik under the Checks section:

  Checks
  ======
    [...]

    traefik
    -------
      - instance #0 [OK]
      - Collected 2 metrics, 0 events & 1 service check

    [...]

Compatibility

The check is compatible with all major platforms.

Data Collected

Metrics

See metadata.csv for a list of metrics provided by this integration.

Events

The Traefik check does not include any events.

Service Checks

Query Traefik and expect 200 as return status code.

Development

Refer to the main documentation for more details about how to test and develop Agent based integrations.

You can’t perform that action at this time.