community.general.statsd (8.5.0) — module

Send metrics to StatsD

| "added in version" 2.1.0 of community.general"

Authors: Mark Mercado (@mamercad)

Install collection

Install with ansible-galaxy collection install community.general:==8.5.0


Add to requirements.yml

  collections:
    - name: community.general
      version: 8.5.0

Description

The C(statsd) module sends metrics to StatsD.

For more information, see U(https://statsd-metrics.readthedocs.io/en/latest/).

Supported metric types are V(counter) and V(gauge). Currently unupported metric types are V(timer), V(set), and V(gaugedelta).


Requirements

Usage examples

  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Increment the metric my_counter by 1
  community.general.statsd:
    host: localhost
    port: 9125
    protocol: tcp
    metric: my_counter
    metric_type: counter
    value: 1
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Set the gauge my_gauge to 7
  community.general.statsd:
    host: localhost
    port: 9125
    protocol: tcp
    metric: my_gauge
    metric_type: gauge
    value: 7

Inputs

    
host:
    default: localhost
    description:
    - StatsD host (hostname or IP) to send metrics to.
    type: str

port:
    default: 8125
    description:
    - The port on O(host) which StatsD is listening on.
    type: int

delta:
    default: false
    description:
    - If the metric is of type V(gauge), change the value by O(delta).
    type: bool

state:
    choices:
    - present
    default: present
    description:
    - State of the check, only V(present) makes sense.
    type: str

value:
    description:
    - The value of the metric.
    required: true
    type: int

metric:
    description:
    - The name of the metric.
    required: true
    type: str

timeout:
    default: 1.0
    description:
    - Sender timeout, only applicable if O(protocol) is V(tcp).
    type: float

protocol:
    choices:
    - udp
    - tcp
    default: udp
    description:
    - The transport protocol to send metrics over.
    type: str

metric_type:
    choices:
    - counter
    - gauge
    description:
    - The type of metric.
    required: true
    type: str

metric_prefix:
    default: ''
    description:
    - The prefix to add to the metric.
    type: str