ieisystem.inmanage.edit_alert_policy 模块 – 设置告警策略

注意

此模块是 ieisystem.inmanage 集合 (版本 3.0.0) 的一部分。

如果您使用的是 ansible 包,则可能已安装此集合。它不包含在 ansible-core 中。要检查它是否已安装,请运行 ansible-galaxy collection list

要安装它,请使用: ansible-galaxy collection install ieisystem.inmanage。您需要其他要求才能使用此模块,有关详细信息,请参见 要求

要在 playbook 中使用它,请指定: ieisystem.inmanage.edit_alert_policy

ieisystem.inmanage 1.0.0 中的新增功能

概要

  • 在 ieisystem 服务器上设置告警策略。

要求

执行此模块的主机需要以下要求。

  • Python 3.7+

  • inManage

参数

参数

注释

channel

字符串

局域网通道。

只有 M5 型号支持此参数。

选项

  • "shared"

  • "dedicated"

destination

字符串

告警目标。接收 Trap 发送的陷阱信息的服务器地址。

当 type 为 snmp 时,指定 IP 地址。

当 type 为 email 时,指定用户名。

当 type 为 snmpdomain 时,指定域名。

host

字符串

指定通过指定传输连接到远程设备的 DNS 主机名或地址。host 的值用作传输的目标地址。

id

整数 / 必填

告警 ID。自定义在 Trap 中发送警报的通道。

M5 模块的值为 1、2、3。

M6 模块的值为 1、2、3、4。

选项

  • 1

  • 2

  • 3

  • 4

password

字符串

指定用于验证与远程设备连接的密码。如果任务中未指定此值,则将改用环境变量 ANSIBLE_NET_PASSWORD 的值。

provider

字典

包含连接详细信息的字典对象。

host

字符串

指定通过指定传输连接到远程设备的 DNS 主机名或地址。host 的值用作传输的目标地址。

password

字符串

指定用于验证与远程设备连接的密码。如果任务中未指定此值,则将改用环境变量 ANSIBLE_NET_PASSWORD 的值。

username

字符串

配置用于验证与远程设备连接的用户名。如果任务中未指定此值,则将改用环境变量 ANSIBLE_NET_USERNAME 的值。

status

字符串

告警策略状态。是否启用接收端在陷阱模式下发送消息。

选项

  • "enable"

  • "disable"

trap_port

整数

SNMP 陷阱端口 (1-65535)。

只有 M6 型号支持此参数。

type

字符串

告警类型。

只有 M5 型号支持此参数。

选项

  • "snmp"

  • "email"

  • "snmpdomain"

username

字符串

配置用于验证与远程设备连接的用户名。如果任务中未指定此值,则将改用环境变量 ANSIBLE_NET_USERNAME 的值。

备注

注意

  • 不支持 check_mode

示例

- name: Alert policy test
  hosts: inmanage
  connection: local
  gather_facts: false
  vars:
    inmanage:
      host: "{{ ansible_ssh_host }}"
      username: "{{ username }}"
      password: "{{ password }}"

  tasks:

  - name: "Set alert policy"
    ieisystem.inmanage.edit_alert_policy:
      id: 1
      status: "enable"
      type: "snmp"
      destination: "100.2.2.2"
      channel: "shared"
      provider: "{{ inmanage }}"

  - name: "Set alert policy"
    ieisystem.inmanage.edit_alert_policy:
      id: 1
      status: "disable"
      provider: "{{ inmanage }}"

返回值

常见的返回值已在 此处 记录,以下是此模块独有的字段

描述

changed

布尔值

检查设备上是否进行了更改。

返回:始终

message

字符串

模块执行后返回的消息。

返回:始终

state

字符串

模块执行后的状态。

返回:始终

作者

  • 王宝山 (@ieisystem)