cisco.nxos.nxos_telemetry 模块 – TELEMETRY 资源模块

注意

此模块是 cisco.nxos 集合(版本 9.2.1)的一部分。

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

要安装它,请使用:ansible-galaxy collection install cisco.nxos

要在 Playbook 中使用它,请指定:cisco.nxos.nxos_telemetry

cisco.nxos 1.0.0 中的新增功能

概要

  • 管理遥测监控服务 (TMS) 配置

参数

参数

注释

config

字典

提供的配置

certificate

字典

证书 SSL/TLS 和主机名值。

值必须是一个字典,定义键(key 和 hostname)的值。

hostname

字符串

证书主机名

key

字符串

证书密钥

compression

字符串

目标配置文件压缩方法。

选项

  • "gzip"

destination_groups

列表 / 元素=任何

遥测目标组列表。

destination

字典

组目标 ipv4、端口、协议和编码值。

值必须是一个字典,定义键(ip、port、protocol、encoding)的值。

encoding

字符串

目标组编码。

选项

  • "GPB"

  • "JSON"

ip

字符串

目标组 IP 地址。

port

整数

目标组端口号。

protocol

字符串

目标组协议。

选项

  • "HTTP"

  • "TCP"

  • "UDP"

  • "gRPC"

id

字符串

目标组标识符。

值必须是表示目标组标识符的整数或字符串。

sensor_groups

列表 / 元素=任何

遥测传感器组列表。

data_source

字符串

遥测数据源。

选项

  • "NX-API"

  • "DME"

  • "YANG"

id

字符串

传感器组标识符。

值必须是表示传感器组标识符的整数或字符串。

path

字典

遥测传感器路径。

值必须是一个字典,定义键(name、depth、filter_condition、query_condition)的值。

必填键 (name)

可选键 (depth、filter_condition、query_condition)

depth

字符串

传感器组深度。

filter_condition

字符串

传感器组筛选条件。

name

字符串

传感器组路径名称。

query_condition

字符串

传感器组查询条件。

source_interface

字符串

目标配置文件源接口。

有效值是表示源接口名称的字符串。

subscriptions

列表 / 元素=任何

遥测订阅列表。

destination_group

字符串

关联的目标组。

id

字符串

订阅标识符。

值必须是表示订阅标识符的整数或字符串。

sensor_group

字典

关联的传感器组。

值必须是一个字典,定义键(id、sample_interval)的值。

id

字符串

关联的传感器组 ID。

sample_interval

整数

关联的传感器组 ID 采样间隔。

vrf

字符串

目标配置文件 vrf。

有效值是表示 vrf 名称的字符串。

state

字符串

最终配置状态

选项

  • "merged" ←(默认)

  • "replaced"

  • "deleted"

  • "gathered"

注释

注意

  • 在 N9k 版本 7.0(3)I7(5) 及更高版本上受支持。

  • 不支持 Cisco MDS

示例

# Using deleted
# This action will delete all telemetry configuration on the device

- name: Delete Telemetry Configuration
  cisco.nxos.nxos_telemetry:
    state: deleted


# Using merged
# This action will merge telemetry configuration defined in the playbook with
# telemetry configuration that is already on the device.

- name: Merge Telemetry Configuration
  cisco.nxos.nxos_telemetry:
    config:
      certificate:
        key: /bootflash/server.key
        hostname: localhost
      compression: gzip
      source_interface: Ethernet1/1
      vrf: management
      destination_groups:
        - id: 2
          destination:
            ip: 192.168.0.2
            port: 50001
            protocol: gRPC
            encoding: GPB
        - id: 55
          destination:
            ip: 192.168.0.55
            port: 60001
            protocol: gRPC
            encoding: GPB
      sensor_groups:
        - id: 1
          data_source: NX-API
          path:
            name: '"show lldp neighbors detail"'
            depth: 0
        - id: 55
          data_source: DME
          path:
            name: sys/ch
            depth: unbounded
            filter_condition: ne(eqptFt.operSt,"ok")
      subscriptions:
        - id: 5
          destination_group: 55
          sensor_group:
            id: 1
            sample_interval: 1000
        - id: 6
          destination_group: 2
          sensor_group:
            id: 55
            sample_interval: 2000
    state: merged


# Using replaced
# This action will replace telemetry configuration on the device with the
# telemetry configuration defined in the playbook.

- name: Override Telemetry Configuration
  cisco.nxos.nxos_telemetry:
    config:
      certificate:
        key: /bootflash/server.key
        hostname: localhost
      compression: gzip
      source_interface: Ethernet1/1
      vrf: management
      destination_groups:
        - id: 2
          destination:
            ip: 192.168.0.2
            port: 50001
            protocol: gRPC
            encoding: GPB
      subscriptions:
        - id: 5
          destination_group: 55
    state: replaced

返回值

通用返回值记录在此处,以下是此模块特有的字段

描述

after

字典

模块完成后,配置为结构化数据。

返回:当更改时

示例: "返回的配置将始终与上面的参数格式相同。\n"

before

字典

调用模块之前的配置为结构化数据。

返回:始终

示例: "返回的配置将始终与上面的参数格式相同。\n"

commands

列表 / 元素=字符串

推送到远程设备的命令集。

返回:始终

示例: ["命令 1", "命令 2", "命令 3"]

作者

  • Mike Wiebe (@mikewiebe)