community.general.sensu_check 模块 – 管理 Sensu 检查
注意
此模块是 community.general 集合 (版本 10.1.0) 的一部分。
如果您使用的是 ansible
包,则可能已经安装了此集合。它不包含在 ansible-core
中。要检查它是否已安装,请运行 ansible-galaxy collection list
。
要安装它,请使用: ansible-galaxy collection install community.general
。
要在 playbook 中使用它,请指定: community.general.sensu_check
。
概要
参数
参数 |
注释 |
---|---|
将检查分类为聚合检查, 使其可通过聚合 API 使用 默认为 选项
|
|
创建一个备份文件(如果为 yes),包括时间戳信息,以便 如果您以某种方式错误地破坏了它,您可以找回原始文件。 选项
|
|
要运行的 sensu 检查的路径(当 |
|
用于混合配置的自定义参数的哈希/字典。 您不能使用此方法重写其他模块参数 |
|
此检查依赖的其他检查,如果依赖项失败,则此检查的处理将被禁用 |
|
检查是否应该被处理 默认为 选项
|
|
检查失败时要通知的处理程序列表 |
|
抖动检测的高阈值 |
|
检查间隔(秒) |
|
抖动检测的低阈值 |
|
检查是否是指标 选项
|
|
检查的名称 这是用于确定检查是否存在的主键 |
|
处理程序应采取行动之前的事件发生次数 如果未指定,则默认为 1。 |
|
要添加/删除的检查的 json 文件的路径。 如果不存在,则会创建它(除非 当 默认值: |
|
检查是否应该被调度。 您仍然可以通过 sensu api 发布它 默认为 选项
|
|
处理程序在采取第二次行动之前应等待的秒数 |
|
检查来源,用于为外部资源(例如网络交换机)创建 JIT Sensu 客户端。 |
|
检查是否存在 选项
|
|
何时禁用检查失败的处理 |
|
何时启用检查失败处理 |
|
此检查应运行的订阅者/通道列表 参见 sensu_subscribers 将机器订阅到通道 |
|
检查超时 如果未指定,则默认为 10。 |
|
检查被视为过期之前的生存时间(秒) |
属性
属性 |
支持 |
描述 |
---|---|---|
支持:完全支持 |
可以在 |
|
支持:不支持 |
处于 diff 模式时,将返回有关已更改内容(或可能需要在 |
示例
# Fetch metrics about the CPU load every 60 seconds,
# the sensu server has a handler called 'relay' which forwards stats to graphite
- name: Get cpu metrics
community.general.sensu_check:
name: cpu_load
command: /etc/sensu/plugins/system/cpu-mpstat-metrics.rb
metric: true
handlers: relay
subscribers: common
interval: 60
# Check whether nginx is running
- name: Check nginx process
community.general.sensu_check:
name: nginx_running
command: /etc/sensu/plugins/processes/check-procs.rb -f /var/run/nginx.pid
handlers: default
subscribers: nginx
interval: 60
# Stop monitoring the disk capacity.
# Note that the check will still show up in the sensu dashboard,
# to remove it completely you need to issue a DELETE request to the sensu api.
- name: Check disk
community.general.sensu_check:
name: check_disk_capacity
state: absent