Docs » Integrations Guide » Integrations Reference » Traefik

image0 Traefik

DESCRIPTION

Configure Traefik to expose internal metrics as prometheus metrics at an endpoint. Install the SignalFx SmartAgent and configure it to access SignalFx and use the prometheus-exporter monitor.

REQUIREMENTS AND DEPENDENCIES

Software Version
signalfx-agent 3.4+

INSTALLATION

Follow these steps to install this plugin:

  1. Install the SignalFx Smart Agent in your environment.
  2. Modify the Smart Agent configuration file as described in Smart Agent Configuration, below.
  3. Configure Traefik to expose Prometheus metrics endpoint as described in Traefik Configuration, below.

CONFIGURATION

Traefik Configuration

Edit the Traefik configuration file, typically traefik.toml, to enable Traefik to expose prometheusmetrics at endpoint. The endpoint is on path /metrics by default. When running the Traefik binary, the configuration file is typically passed in as a command line argument.

./traefik -c traefik.toml

However, when running the Traefik Docker image, the configuration file is mounted to the volume /etc/traefik/traefik.toml. For example,

docker run -d -p 8080:8080 -p 80:80 -v $PWD/traefik.toml:/etc/traefik/traefik.toml

If the configuration file is not available use the sample configurationfile. The Smart Agent must have network access to Traefik. This means for instance that, in a Docker environment, the Smart Agent container needs to share a network with the Traefik container. So the Docker run command to start the agent may look as follows:

Before we can send metrics to SignalFx, we need to make sure you are sending them to the correct SignalFx realm.

To determine what realm you are in (YOUR_SIGNALFX_REALM), check your profile page in the SignalFx web application (click the avatar in the upper right and click My Profile).

If you are not in the us0 realm, you will need to set the URL configuration option below to use the correct realm, as shown below.

You will also need to set the SFX_ACCESS_TOKEN configuration option to your SignalFx organization access token (YOUR_SIGNALFX_API_TOKEN).

For more information on authentication, see the API’s Authentication documentation.

docker run --rm -e SFX_ACCESS_TOKEN=YOUR_SIGNALFX_API_TOKEN -e SFX_INGEST_URL=https://ingest.YOUR_SIGNALFX_REALM.signalfx.com -v /var/run/docker.sock:/var/run/docker.sock -v <agent.yaml path>:/etc/signalfx/agent.yaml --net <traefik container network> quay.io/signalfx/signalfx-agent:<version>

Smart Agent Configuration

Find and edit the Smart Agent configuration file agent.yaml to enable the Docker observer and configure the prometheus-exporter monitor as described here. For example, the configuration below will cause the Smart Agent to query the Docker Engine API for all running containers with port 8080 exposed and export Prometheus metrics from endpoint <container ip>:8080/metrics.

observers:
  - type: docker
monitors:
  - type: prometheus-exporter
    discoveryRule: port == 8080
  extraDimensions:
    metric_source: traefik

Also, metrics can be excluded by configuring the metricsToExclude section of the Smart Agent configuration file.

USAGE

The Smart Agent exports Prometheus metrics exposed by Traefik. These metrics can be categorized into Traefik-related, entrypoint-related and backend-related metrics. The Traefik-related metrics are prefixed by go_ and process_. The entrypoint-related metrics are prefixed by traefik_entrypoint_ and the backend-related metrics prefixed by traefik_backend_.

The Traefik-related metrics are for monitoring Traefik itself. For instance, the go_memstats_sys_bytes metric can be used to plot Traefik memory usage. The entrypoint-related and backend-related key metrics are the number and duration of requests measured at entrypoints and backends. These metrics are used to compute measurements such as the average request duration.

image1
image2
image3

The entrypoint-related and backend-related metrics also include metrics for the number of entrypoints connections, backends connections and backend server up/down flag.

METRICS

Below is a list of all metrics.

Metric Name Brief Type
counter.go_gc_duration_seconds A summary of the GC invocation durations. cumulative counter
counter.go_gc_duration_seconds_count A count of the GC invocation durations. cumulative counter
counter.go_gc_duration_seconds_sum The sum of the GC invocation durations. cumulative counter
counter.go_memstats_alloc_bytes_total Total number of bytes allocated, even if freed. counter
counter.go_memstats_frees_total Total number of frees. counter
counter.go_memstats_lookups_total Total number of pointer lookups. counter
counter.go_memstats_mallocs_total Total number of mallocs. counter
counter.process_cpu_seconds_total Total user and system CPU time spent, in seconds. counter
counter.traefik_backend_request_duration_seconds_bucket The sum of request durations within a configured time interval. cumulative counter
counter.traefik_backend_request_duration_seconds_count The number of request durations that were measured on a backend cumulative counter
counter.traefik_backend_request_duration_seconds_sum The sum of the request durations in seconds, measured on a backend, partitioned by status code, protocol, and method. cumulative counter
counter.traefik_backend_requests_total How many HTTP requests were processed on a backend, partitioned by status code, protocol, and method. counter
counter.traefik_config_reloads_failure_total Total number of config reloads that failed counter
counter.traefik_config_reloads_total Config reloads counter
counter.traefik_entrypoint_request_duration_seconds_bucket The sum of request durations within a configured time intervals. cumulative counter
counter.traefik_entrypoint_request_duration_seconds_count The number of request durations that were measured on an entrypoint. cumulative counter
counter.traefik_entrypoint_request_duration_seconds_sum The sum of the request durations in seconds measured on an entrypoint, partitioned by status code, protocol, and method. cumulative counter
counter.traefik_entrypoint_requests_total How many HTTP requests processed on an entrypoint, partitioned by status code, protocol, and method. counter
gauge.go_goroutines Number of goroutines that currently exist. gauge
gauge.go_memstats_alloc_bytes Number of bytes allocated and still in use. gauge
gauge.go_memstats_buck_hash_sys_bytes Number of bytes used by the profiling bucket hash table. gauge
gauge.go_memstats_gc_cpu_fraction The fraction of this program’s available CPU time used by the GC since the program started. gauge
gauge.go_memstats_gc_sys_bytes Number of bytes used for garbage collection system metadata. gauge
gauge.go_memstats_heap_alloc_bytes Number of heap bytes allocated and still in use. gauge
gauge.go_memstats_heap_idle_bytes Number of heap bytes waiting to be used. gauge
gauge.go_memstats_heap_inuse_bytes Number of heap bytes that are in use. gauge
gauge.go_memstats_heap_objects Number of allocated objects. gauge
gauge.go_memstats_heap_released_bytes Number of heap bytes released to OS. gauge
gauge.go_memstats_heap_sys_bytes Number of heap bytes obtained from system. gauge
gauge.go_memstats_last_gc_time_seconds Length of time since last garbage collection, in seconds since unix epoch. gauge
gauge.go_memstats_mcache_inuse_bytes Number of bytes in use by mcache structures. gauge
gauge.go_memstats_mcache_sys_bytes Number of bytes used for mcache structures obtained from system. gauge
gauge.go_memstats_mspan_inuse_bytes Number of bytes in use by mspan structures. gauge
gauge.go_memstats_mspan_sys_bytes Number of bytes used for mspan structures obtained from system. gauge
gauge.go_memstats_next_gc_bytes Number of heap bytes when next garbage collection will take place. gauge
gauge.go_memstats_other_sys_bytes Number of bytes used for other system allocations. gauge
gauge.go_memstats_stack_inuse_bytes Number of bytes in use by the stack allocator. gauge
gauge.go_memstats_stack_sys_bytes Number of bytes obtained from system for stack allocator. gauge
gauge.go_memstats_sys_bytes Number of bytes obtained from system. gauge
gauge.go_threads Number of OS threads created gauge
gauge.process_max_fds Maximum number of open file descriptors. gauge
gauge.process_open_fds Number of open file descriptors. gauge
gauge.process_resident_memory_bytes Resident memory size in bytes. gauge
gauge.process_start_time_seconds Start time of the process since unix epoch in seconds. gauge
gauge.process_virtual_memory_bytes Virtual memory size in bytes. gauge
gauge.traefik_backend_open_connections How many open connections exist on a backend, partitioned by method and protocol. gauge
gauge.traefik_backend_server_up Backend server is up, described by gauge value of 0 (down) or 1 (up). gauge
gauge.traefik_config_last_reload_failure Last config reload failure gauge
gauge.traefik_config_last_reload_success Last config reload success gauge
gauge.traefik_entrypoint_open_connections How many open connections exist on an entrypoint, partitioned by method and protocol. gauge

counter.go_gc_duration_seconds

cumulative counter

A summary of the GC invocation durations.

counter.go_gc_duration_seconds_count

cumulative counter

A count of the GC invocation durations.

counter.go_gc_duration_seconds_sum

cumulative counter

The sum of the GC invocation durations, in seconds.

counter.go_memstats_alloc_bytes_total

counter

Total number of bytes allocated, even if freed.

counter.go_memstats_frees_total

counter

Total number of frees.

counter.go_memstats_lookups_total

counter

Total number of pointer lookups.

counter.go_memstats_mallocs_total

counter

Total number of mallocs.

counter.process_cpu_seconds_total

counter

Total user and system CPU time spent, in seconds.

counter.traefik_backend_request_duration_seconds_bucket

cumulative counter

The sum of request durations that are within a configured time interval. The request durations are measured at a backend in seconds. This value is partitioned by status code, protocol, and method.

counter.traefik_backend_request_duration_seconds_count

cumulative counter

The number of request durations that were measured on a backend. The values are partitioned by status code, protocol, and method.

counter.traefik_backend_request_duration_seconds_sum

cumulative counter

The sum of the request durations in seconds, measured on a backend, partitioned by status code, protocol, and method.

counter.traefik_backend_requests_total

counter

How many HTTP requests were processed on a backend, partitioned by status code, protocol, and method.

counter.traefik_config_reloads_failure_total

counter

Total number of config reloads that failed

counter.traefik_config_reloads_total

counter

Config reloads

counter.traefik_entrypoint_request_duration_seconds_bucket

cumulative counter

The sum of request durations that are within a configured time interval. The request durations are measured at an entrypoint in seconds. This value is partitioned by status code, protocol, and method.

counter.traefik_entrypoint_request_duration_seconds_count

cumulative counter

The number of request durations that were measured on an entrypoint. The values are partitioned by status code, protocol, and method.

counter.traefik_entrypoint_request_duration_seconds_sum

cumulative counter

The sum of the request durations in seconds measured on an entrypoint, partitioned by status code, protocol, and method.

counter.traefik_entrypoint_requests_total

counter

How many HTTP requests processed on an entrypoint, partitioned by status code, protocol, and method.

gauge.go_goroutines

gauge

Number of goroutines that currently exist.

gauge.go_memstats_alloc_bytes

gauge

Number of bytes allocated and still in use.

gauge.go_memstats_buck_hash_sys_bytes

gauge

Number of bytes used by the profiling bucket hash table.

gauge.go_memstats_gc_cpu_fraction

gauge

The fraction of this program’s available CPU time used by the GC since the program started.

gauge.go_memstats_gc_sys_bytes

gauge

Number of bytes used for garbage collection system metadata.

gauge.go_memstats_heap_alloc_bytes

gauge

Number of heap bytes allocated and still in use.

gauge.go_memstats_heap_idle_bytes

gauge

Number of heap bytes waiting to be used.

gauge.go_memstats_heap_inuse_bytes

gauge

Number of heap bytes that are in use.

gauge.go_memstats_heap_objects

gauge

Number of allocated objects.

gauge.go_memstats_heap_released_bytes

gauge

Number of heap bytes released to OS.

gauge.go_memstats_heap_sys_bytes

gauge

Number of heap bytes obtained from system.

gauge.go_memstats_last_gc_time_seconds

gauge

Length of time since last garbage collection, in seconds since unix epoch.

gauge.go_memstats_mcache_inuse_bytes

gauge

Number of bytes in use by mcache structures.

gauge.go_memstats_mcache_sys_bytes

gauge

Number of bytes used for mcache structures obtained from system.

gauge.go_memstats_mspan_inuse_bytes

gauge

Number of bytes in use by mspan structures.

gauge.go_memstats_mspan_sys_bytes

gauge

Number of bytes used for mspan structures obtained from system.

gauge.go_memstats_next_gc_bytes

gauge

Number of heap bytes when next garbage collection will take place.

gauge.go_memstats_other_sys_bytes

gauge

Number of bytes used for other system allocations.

gauge.go_memstats_stack_inuse_bytes

gauge

Number of bytes in use by the stack allocator.

gauge.go_memstats_stack_sys_bytes

gauge

Number of bytes obtained from system for stack allocator.

gauge.go_memstats_sys_bytes

gauge

Number of bytes obtained from system.

gauge.go_threads

gauge

Number of OS threads created

gauge.process_max_fds

gauge

Maximum number of open file descriptors.

gauge.process_open_fds

gauge

Number of open file descriptors.

gauge.process_resident_memory_bytes

gauge

Resident memory size in bytes.

gauge.process_start_time_seconds

gauge

Start time of the process since unix epoch in seconds.

gauge.process_virtual_memory_bytes

gauge

Virtual memory size in bytes.

gauge.traefik_backend_open_connections

gauge

How many open connections exist on a backend, partitioned by method and protocol.

gauge.traefik_backend_server_up

gauge

Backend server is up, described by gauge value of 0 (down) or 1 (up).

gauge.traefik_config_last_reload_failure

gauge

Last config reload failure

gauge.traefik_config_last_reload_success

gauge

Last config reload success

gauge.traefik_entrypoint_open_connections

gauge

How many open connections exist on an entrypoint, partitioned by method and protocol.