community.general.statsd 模块 – 发送指标到 StatsD
注意
此模块是 community.general 集合(版本 10.1.0)的一部分。
如果您正在使用 ansible
包,您可能已经安装了这个集合。 它不包含在 ansible-core
中。 要检查是否已安装,请运行 ansible-galaxy collection list
。
要安装它,请使用:ansible-galaxy collection install community.general
。您需要其他要求才能使用此模块,请参阅 要求 了解详细信息。
要在 Playbook 中使用它,请指定:community.general.statsd
。
community.general 2.1.0 中的新增功能
概要
statsd
模块将指标发送到 StatsD。有关更多信息,请参阅 https://statsd-metrics.readthedocs.io/en/latest/。
支持的指标类型是
counter
和gauge
。 当前不支持的指标类型是timer
、set
和gaugedelta
。
要求
在执行此模块的主机上需要以下要求。
statsd
参数
属性
示例
- 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