telekom_mms.icinga_director.icinga_service_template 模块 – 在 Icinga2 中管理服务模板
注意
此模块是 telekom_mms.icinga_director 集合 (版本 2.2.1) 的一部分。
如果您使用的是 ansible
包,则可能已安装此集合。它不包含在 ansible-core
中。要检查它是否已安装,请运行 ansible-galaxy collection list
。
要安装它,请使用: ansible-galaxy collection install telekom_mms.icinga_director
。
要在剧本中使用它,请指定: telekom_mms.icinga_director.icinga_service_template
。
telekom_mms.icinga_director 1.0.0 中的新增功能
摘要
通过 director API 添加或删除 Icinga2 的服务模板。
参数
参数 |
注释 |
---|---|
不要覆盖整个对象,而是附加定义的属性。 注意 - 无法追加到现有的变量、导入或任何其他列表/字典。您必须覆盖完整的列表/字典。 注意 - 即使未设置,默认设置的变量也会应用。 选项
|
|
检查命令定义。 |
|
您的常规检查间隔。 |
|
确定应何时监控此对象的时间段名称。默认情况下不受限制。 |
|
检查命令超时时间(秒)。覆盖 CheckCommand 的超时属性。 |
|
用于 SSL 客户端身份验证的 PEM 格式证书链文件。 此文件也可以包含密钥,如果包含密钥,则不需要 |
|
包含用于 SSL 客户端身份验证的私钥的 PEM 格式文件。 如果 |
|
禁用的对象不会被部署。 选项
|
|
是否主动检查此对象。 选项
|
|
是否为此对象启用事件处理程序。 选项
|
|
是否为此对象启用抖动检测。 选项
|
|
是否为此对象发送通知。 选项
|
|
是否接受此对象的被动检查结果。 选项
|
|
是否处理此对象提供的性能数据。 选项
|
|
服务的事件命令,如果满足以下条件之一,则会在每次检查执行时调用: 服务处于软状态 服务状态变为硬状态 服务状态从软状态或硬状态恢复到 OK/Up |
|
服务被认为抖动的百分比上限 |
|
服务不被认为抖动的百分比下限 |
|
如果为 选项
|
|
应直接分配给此服务的服务组。 服务组可能由于各种原因而有用。 它们有助于在 Icinga Web 2 中提供特定于服务类型的视图,无论是用于自定义仪表板还是作为实施限制的工具。 服务组可以直接分配给单个服务或服务模板。 默认值: |
|
用于识别的标头,通常出现在 Web 服务器日志中。 默认值: |
|
指向此对象的图标的 URL。 对于相对于 public/img/icons 的图标,尝试“tux.png”;对于 Icinga 图标字体中的项目,尝试“cloud”(无扩展名) |
|
如果缺少上述图标,则显示的替代文本 |
|
可导入的模板,您可以添加任意数量的模板。 请注意,从多个模板导入属性时,顺序很重要 - 最后一个优先。 默认值: |
|
定义达到新的硬状态之前的检查尝试次数。 |
|
此对象的附加注释。 |
|
服务模板的名称。 |
|
重试间隔,将在状态更改后应用,除非达到下一个硬性状态。 |
|
应用功能状态。 选项
|
|
HTTP、HTTPS 或 FTP URL,格式为 (http|https|ftp)://[user[:pass]]@host.domain[:port]/path |
|
用于 HTTP 基本身份验证的密码。 如果未指定 |
|
用于 HTTP 基本身份验证的用户名。 对于允许空密码的站点,此参数可以不用 |
|
此服务的检查命令是否应在 Icinga agent 上执行。 选项
|
|
使用 GSSAPI 执行身份验证,通常用于 Kerberos 或通过 Negotiate 身份验证的 Kerberos。 需要安装 Python 库 gssapi。 GSSAPI 的凭据可以使用 即使安装了 NTLM 的 GSSAPI 机制,也不支持 NTLM 身份验证。 选项
|
|
如果为 选项
|
|
如果为 这仅应在使用自签名证书的个人控制站点上使用。 选项
|
|
服务模板的自定义属性。 默认值: |
|
此检查是否易失性。 选项
|
备注
注意
此模块支持检查模式。
示例
- name: Create servicetemplate
telekom_mms.icinga_director.icinga_service_template:
state: present
url: "{{ icinga_url }}"
url_username: "{{ icinga_user }}"
url_password: "{{ icinga_pass }}"
enable_flapping: true
flapping_threshold_high: "30.0"
flapping_threshold_low: "25.0"
icon_image_alt: "alt text"
icon_image: "http://url1"
object_name: fooservicetemplate
use_agent: false
vars:
procs_argument: consul
procs_critical: '1:'
procs_warning: '1:'
- name: Update servicetemplate
telekom_mms.icinga_director.icinga_service_template:
state: present
url: "{{ icinga_url }}"
url_username: "{{ icinga_user }}"
url_password: "{{ icinga_pass }}"
object_name: fooservicetemplate
notes: "example note"
notes_url: "'http://url1' 'http://url2'"
append: true
- name: Create servicetemplate with event command
telekom_mms.icinga_director.icinga_service_template:
state: present
url: "{{ icinga_url }}"
url_username: "{{ icinga_user }}"
url_password: "{{ icinga_pass }}"
object_name: apache_check_servicetemplate
use_agent: false
event_command: restart_httpd
notes: "example note"
notes_url: "'http://url1' 'http://url2'"