Note
This module is part of the community.general collection (version 10.7.3).
You might already have this collection installed if you are using the ansible package. It is not included in ansible-core. To check whether it is installed, run ansible-galaxy collection list.
To install it, use: ansible-galaxy collection install community.general. You need further requirements to be able to use this module, see Requirements for details.
To use it in a playbook, specify: community.general.statsd.
New in community.general 2.1.0
statsd module sends metrics to StatsD.counter and gauge. Currently unupported metric types are timer, set, and gaugedelta.The below requirements are needed on the host that executes this module.
Parameter | Comments |
|---|---|
delta boolean | |
host string | StatsD host (hostname or IP) to send metrics to. Default: |
metric string / required | The name of the metric. |
metric_prefix string | The prefix to add to the metric. Default: |
metric_type string / required | The type of metric. Choices:
|
port integer | The port on Default: |
protocol string | The transport protocol to send metrics over. Choices:
|
state string | State of the check, only Choices:
|
timeout float | Sender timeout, only applicable if Default: |
value integer / required | The value of the metric. |
Attribute | Support | Description |
|---|---|---|
check_mode | Support: none | Can run in |
diff_mode | Support: none | Will return details on what has changed (or possibly needs changing in |
- 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
- 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
© 2012–2018 Michael DeHaan
© 2018–2025 Red Hat, Inc.
Licensed under the GNU General Public License version 3.
https://docs.ansible.com/ansible/latest/collections/community/general/statsd_module.html