add
netq add check-filter
您可以将过滤器添加到 netq check
命令,以基于主机名、故障原因和其他参数来抑制验证失败。
语法
netq add check-filter
[check_filter_id <text-check-filter-id>]
[check_name <text-check-name-anchor>]
[test_name <text-test-name-anchor>]
[scope <text-check-scope-anchor> | scope-append <text-check-scope-anchor>]
[is_active true | is_active false]
[suppress_until <text-suppress-until>]
必需参数
无
选项
选项 | 值 | 描述 |
---|---|---|
check_filter_id | <text-check-filter-id> | 过滤器的标识符 |
check_name | <text-check-name-anchor> | 验证检查的名称 |
test_name | <text-test-name-anchor> | 验证测试的名称 |
scope | <text-check-scope-anchor> | 范围的名称 |
scope-append | <text-check-scope-anchor> | 将定义的范围附加到现有配置 |
is_active | true, false | 启用或禁用配置 |
suppress_until | <text-suppress-until> | 抑制指定事件的时间量(秒) |
用法示例
cumulus@switch:~$ netq add check-filter check_name roce test_name 'RoCE Classification' scope '[{"Reason": "Invalid traffic-class mapping for switch-priority 4.Expected 0 Got 3"}]' is_active true
Successfully added/updated Check Filter
相关命令
netq del check-filter
netq show check-filter
netq add events-config
抑制系统事件,将其从事件显示中排除。您可以抑制以下事件:
- 两年(默认):当您不想看到事件时很有用
- 指定的时间量:当您想因维护或测试新的网络配置而暂时抑制事件时很有用
事件将在指定的时间量过去后显示。
语法
netq add events-config
[events_config_id <text-events-config-id-anchor>]
[events_config_name <text-events-config-name-anchor>]
[message_type <text-message-type-anchor>]
[events_id <text-events-id-anchor>]
[scope <text-events-scope-anchor>]
[is_active true | is_active false]
[suppress_until <text-suppress-until>]
必需参数
无
选项
选项 | 值 | 描述 |
---|---|---|
events_config_id | <text-events-config-id-anchor> | 现有配置的标识符;用于编辑现有配置 |
events_config_name | <text-events-config-name-anchor> | 用户定义的配置名称 |
message_type | <text-message-type-anchor> | 要抑制的消息类型。值包括agent、bgp、btrfsinfo、clag、clsupport、configdiff、evpn、link、ntp、sensor、services 和 ssdutil。 |
events_id | <text-events-id-anchor> | 事件的标识符 |
scope | <text-events-scope-anchor> | 规则,采用正则表达式的形式,指示要抑制哪些设备、设备子集或属性 |
is_active | true, false | 启用或禁用配置 |
suppress_until | <text-suppress-until> | 抑制指定事件的时间量(秒) |
用法示例
添加名为 ntpconfig
的配置,该配置在未来 10 分钟内抑制 leaf01 上的 NTP 相关事件
netq add events-config events_config_name ntpconfig message_type ntp scope '[{"scope_name":"hostname","scope_value":"leaf01"},{"scope_name":"severity","scope_value":"*"}]' suppress_until 600
相关命令
netq del events-config
netq show events-config
netq add notification channel
NetQ 通过通知通道向用户呈现事件。NetQ 支持五种通道类型:电子邮件、PagerDuty、Slack、syslog
和通用(一个 webhook 通道,用于将通知发送到第三方应用程序)。此命令配置这些通道。
您必须至少有一个通道、一个规则和一个过滤器才能完全配置通知。
语法
此命令的某种形式适用于每种通道类型
netq add notification channel email
<text-channel-name>
to <text-email-toids>
[smtpserver <text-email-hostname>]
[smtpport <text-email-port>]
[login <text-email-id>]
[password <text-email-password>]
[severity info | severity error]
[default]
netq add notification channel pagerduty
<text-channel-name>
integration-key <text-integration-key>
[severity info | severity error]
[default]
netq add notification channel slack
<text-channel-name>
webhook <text-webhook-url>
[severity info | severity error]
[tag <text-slack-tag>]
[default]
netq add notification channel syslog
<text-channel-name>
hostname <text-syslog-hostname>
port <text-syslog-port>
[severity info | severity error]
[default]
netq add notification channel generic
<text-channel-name>
webhook <text-webhook-url>
[severity info | severity error ]
[use-ssl True | use-ssl False]
[auth-type basic-auth generic-username <text-generic-username> generic-password <text-generic-password> | auth-type api-key key-name <text-api-key-name> key-value <text-api-key-value>]
[default]
必需参数
参数 | 值 | 描述 |
---|---|---|
NA | 创建电子邮件通道以接收事件通知 | |
pagerduty | NA | 创建 PagerDuty 通道以接收事件通知 |
slack | NA | 创建 Slack 通道以接收事件通知 |
syslog | NA | 创建 Syslog 通道以接收事件通知 |
generic | NA | 创建通用通道以接收事件通知 |
NA | <text-channel-name> | 通道的名称 |
to | <text-email-toids> | 收件人电子邮件地址的逗号分隔列表;您不能添加空格 |
integration-key | <text-integration-key> | 为您的 PagerDuty 服务生成的服务密钥或路由密钥。默认为空字符串 ("")。 |
webhook | <text-webhook-url> | 在您的实例中创建的传入 webhook |
hostname | <text-syslog-hostname> | 接收通知的 syslog 服务器的名称 |
port | <text-syslog-port> | syslog 服务器上接收通知的端口的名称 |
选项
选项 | 值 | 描述 |
---|---|---|
smtpserver | <text-email-hostname> | 将通知发送到具有此主机名的 SMTP 服务器 |
smtpport | <text-email-port> | 将通知发送到 SMTP 服务器上的此端口 |
login | <text-email-id> | 用于身份验证的电子邮件地址 |
password | <text-email-password> | 用于身份验证的密码 |
severity | info, error | 仅发送具有此严重性的通知。默认严重性为 info。 |
auth-type | <auth-type> | 指定身份验证方法 |
use-ssl | True, False | 启用 SSL 加密 |
NA | default | 将通道设置为默认值,并将所有通知发送到此通道 |
用法示例
创建电子邮件通道
cumulus@switch:~$ netq add notification channel email onprem-email to netq-notifications@domain.com smtpserver smtp.domain.com smtpport 587 login smtphostlogin@domain.com password MyPassword123
Successfully added/updated channel onprem-email
创建 PagerDuty 通道
cumulus@switch:~$ netq add notification channel pagerduty pd-netq-events integration-key c6d666e210a8425298ef7abde0d1998
Successfully added/updated channel pd-netq-events
创建 Slack 通道
cumulus@switch:~$ netq add notification channel slack slk-netq-events webhook https://hooks.slack.com/services/text/moretext/evenmoretext
Successfully added/updated channel slk-netq-events
创建 Syslog 通道
cumulus@switch:~$ netq add notification channel syslog syslog-netq-events hostname syslog-server port 514
Successfully added/updated channel syslog-netq-events
有关更多信息和完整的通知配置,请参阅配置系统事件通知。
相关命令
netq del notification channel
netq add notification rule
netq add notification filter
netq add notification proxy
netq show notification
netq add notification filter
事件通知过滤器将通知规则绑定到通知通道。过滤器可以限制事件,以便仅发送具有给定严重性的事件。您可以在其他过滤器之前或之后插入过滤器,以达到所需的过滤级别。有关实施详细信息和其他示例,请参阅创建过滤器。
您必须至少有一个通道、一个规则和一个过滤器才能完全配置通知。
语法
netq add notification filter
<text-filter-name>
[severity info | severity error]
[rule <text-rule-name-anchor>]
[channel <text-channel-name-anchor>]
[before <text-filter-name-anchor> | after <text-filter-name-anchor>]
必需参数
参数 | 值 | 描述 |
---|---|---|
NA | <text-filter-name> | 过滤器的名称 |
选项
选项 | 值 | 描述 |
---|---|---|
severity | info, error | 仅过滤具有此严重性的通知。默认严重性为info。 |
rule | <text-rule-name-anchor> | 要应用此过滤器的规则的名称 |
channel | <text-channel-name-anchor> | 要应用此过滤器的通道的名称。 |
before | <text-filter-name-anchor> | 在此名称的过滤器之前插入此过滤器。 |
after | <text-filter-name-anchor> | 在此名称的过滤器之后插入此过滤器。 |
用法示例
创建过滤器并将其分配给电子邮件通道
cumulus@switch:~$ netq add notification filter notify-all-ifs rule all-interfaces channel onprem-email
Successfully added/updated filter notify-all-ifs
创建过滤器并分配给 Slack 通道
cumulus@switch:~$ netq add notification filter notify-all-ifs rule all-interfaces channel slk-netq-events
Successfully added/updated filter notify-all-ifs
相关命令
netq del notification filter
netq add notification rule
netq add notification channel
netq add notification proxy
netq show notification
netq add notification rule
事件通知规则定义要包含在通知中或从通知中排除哪些事件。规则是一个键值对。每个键都有一组可用于过滤的值。有关实施详细信息和其他示例,请参阅创建规则。
您必须至少有一个通道、一个规则和一个过滤器才能完全配置通知。
语法
netq add notification rule
<text-rule-name>
key <text-rule-key>
value <text-rule-value>
必需参数
参数 | 值 | 描述 |
---|---|---|
NA | <text-rule-name> | 规则的名称 |
key | <text-rule-key> | 仅发送具有此键的事件 |
value | <text-rule-value> | 仅发送具有此键值的事件 |
选项
无
用法示例
创建规则以发送所有接口事件
cumulus@switch:~$ netq add notification rule all-interfaces key ifname value ALL
Successfully added/updated rule all-ifs
基于 VNI 创建 EVPN 规则
cumulus@switch:~$ netq add notification rule evpnVni key vni value 42
Successfully added/updated rule evpnVni
相关命令
netq del notification rule
netq add notification filter
netq add notification channel
netq add notification proxy
netq show notification
netq add notification proxy
要通过代理服务器而不是直接发送到通知通道来发送事件通知,请使用主机名(可选)和代理服务器端口配置 NetQ。如果您未指定端口,则 NetQ 默认为端口 80。目前仅支持一个代理服务器。为了简化部署,请在配置通道、规则或过滤器之前配置您的代理服务器。
语法
netq add notification proxy
<text-proxy-hostname>
[port <text-proxy-port>]
必需参数
参数 | 值 | 描述 |
---|---|---|
NA | <text-proxy-hostname> | 将通知发送到具有此名称的代理服务器 |
选项
选项 | 值 | 描述 |
---|---|---|
port | <text-proxy-port> | 将通知发送到代理服务器上具有此名称的端口 |
用法示例
在默认端口上为事件通知创建代理
cumulus@switch:~$ netq add notification proxy proxy4
Successfully configured notifier proxy proxy4:80
相关命令
netq del notification proxy
netq add notification channel
netq add notification rule
netq add notification filter
netq show notification
netq add tca
NetQ 支持一组在超过用户定义的阈值后触发的事件,称为 TCA 事件。这些事件允许检测和预防选定 ACL 资源、数字光器件、转发资源、接口错误和统计信息、链路抖动、资源利用率和传感器事件的网络故障。您可以在阈值交叉事件参考中找到完整列表。
TCA 事件通知配置必须包含一个规则。每个规则必须包含一个范围和一个阈值。可选地,您可以指定关联的通道。注意:如果规则未与通道关联,则事件信息只能从数据库访问。 如果您想将事件传递到一个或多个通知通道,请在使用 netq add notification channel
创建 TCA 事件之前创建通道。
语法
此命令有两种形式可用:一种使用用于创建通知的 event_id
参数,另一种使用用于修改现有通知的 tca_id
参数。
netq add tca event_id <text-event-id-anchor>
[scope <text-scope-anchor>]
[severity info | severity error]
[is_active true | is_active false]
[suppress_until <text-suppress-ts>]
[threshold_type user_set | threshold_type vendor_set]
[threshold <text-threshold-value>]
[channel <text-channel-name-anchor> | channel drop <text-drop-channel-name>]
netq add tca tca_id <text-tca-id-anchor>
[scope <text-scope-anchor>]
[severity info | severity error]
[is_active true | is_active false]
[suppress_until <text-suppress-ts>]
[threshold_type user_set | threshold_type vendor_set]
[threshold <text-threshold-value>]
[channel <text-channel-name-anchor> | channel drop <text-drop-channel-name>]
必需参数
参数 | 值 | 描述 |
---|---|---|
event_id | <text-event-id-anchor> | 为此 ID 的事件类型创建基于阈值的事件规则 |
tca_id | <text-tca-id-anchor> | 修改具有此 ID 的现有基于阈值的事件 |
选项
选项 | 值 | 描述 |
---|---|---|
scope | <text-scope-anchor> | 用于过滤事件的正则表达式。当您使用两个参数时,请用逗号分隔它们,但不要留空格。当您单独使用星号 (*) 时,您必须用单引号或双引号将其括起来。 |
severity | info, error | 仅包含具有此严重性的事件 |
is_active | true, false | 激活或停用 TCA 事件规则 |
suppress_until | <text-suppress-ts> | 抑制此事件规则直到指定时间,格式为从现在起算的秒数 |
threshold_type | user_set, vendor_set | 应用在 threshold 选项中指定的阈值或供应商为此属性指定的默认值 |
threshold | <text-threshold-value> | 超过此值时会触发事件的值 |
channel | <text-channel-name-anchor> | 将事件发送到具有此名称的通道 |
channel drop | <text-drop-channel-name> | 停止向具有此名称的通道发送事件 |
用法示例
基本基于阈值的事件通知
cumulus@switch:~$ netq add tca event_id TCA_CPU_UTILIZATION_UPPER scope leaf* threshold 80
Successfully added/updated tca
创建基于阈值的事件通知并传递到现有的 syslog 通道
cumulus@switch:~$ netq add tca event_id TCA_SENSOR_TEMPERATURE_UPPER scope leaf12,temp1 threshold 32 channel syslog-netq-events
Successfully added/updated tca
将规则 TCA_CPU_UTILIZATION_UPPER_1 的阈值更改为 96%。这将覆盖现有的阈值。
cumulus@switch:~$ netq add tca tca_id TCA_CPU_UTILIZATION_UPPER_1 threshold 96
相关命令
netq del tca
netq show tca
netq add notification channel
netq add trace
创建按需跟踪,并在 NetQ UI 中的“按需跟踪结果”卡中查看结果,而不是在终端窗口中以文本形式查看结果。有关更多信息,请参阅验证网络连接。请注意,跟踪功能仅了解已学习的地址。如果您发现路径无效或不完整,您可以 ping 标识的设备,以便其地址变得已知。
语法
此命令有两种形式可用:一种用于第 2 层跟踪,另一种用于第 3 层跟踪。
netq add trace <mac>
[vlan <1-4096>]
from (<src-hostname> | <ip-src>)
[vrf <vrf>]
[alert-on-failure]
netq add trace <ip>
from (<src-hostname> | <ip-src>)
[vrf <vrf>]
[alert-on-failure]
必需参数
参数 | 值 | 描述 |
---|---|---|
NA | <mac> | 创建到此 MAC 地址的第 2 层跟踪 |
NA | <ip> | 创建到此 IPv4 或 IPv6 地址的第 3 层跟踪 |
from | <src-hostname>, <ip-src> | 创建从具有此主机名或 IPv4/v6 地址的设备开始的跟踪 |
选项
选项 | 值 | 描述 |
---|---|---|
vlan | 1-4096 | 创建通过此 VLAN 的第 2 层跟踪 |
vrf | <vrf> | 创建通过此 VRF 的第 2 层或第 3 层跟踪 |
alert-on-failure | NA | 当跟踪失败时生成事件 |
用法示例
创建通过给定 VRF 的第 3 层跟踪
cumulus@switch:~$ netq add trace 10.1.10.104 from 10.1.10.101 vrf RED
创建通过给定 VLAN 的第 2 层跟踪
cumulus@switch:~$ netq add trace 44:38:39:00:00:3e vlan 10 from 44:38:39:00:00:32
相关命令
netq add trace name
netq del trace
netq show trace
netq show events type trace
netq add trace name
创建计划跟踪,并在 NetQ UI 中的“计划跟踪结果”卡中查看结果,而不是在终端窗口中以文本形式查看结果。有关更多信息,请参阅验证网络连接。请注意,跟踪功能仅了解已学习的地址。如果您发现路径无效或不完整,请 ping 标识的设备,以便其地址变得已知。
语法
此命令有两种形式可用:一种用于第 2 层跟踪,另一种用于第 3 层跟踪。
netq add trace name
<text-new-trace-name>
<mac>
[vlan <1-4096>]
from (<src-hostname> | <ip-src>)
[vrf <vrf>]
interval <text-time-min>
[alert-on-failure]
netq add trace name
<text-new-trace-name>
<ip>
from (<src-hostname> | <ip-src>)
[vrf <vrf>]
interval <text-time-min>
[alert-on-failure]
必需参数
参数 | 值 | 描述 |
---|---|---|
name | <text-new-trace-name> | 跟踪的唯一名称(每个用户) |
NA | <mac> | 创建到此 MAC 地址的第 2 层跟踪 |
NA | <ip> | 创建到此 IPv4 或 IPv6 地址的第 3 层跟踪 |
from | <src-hostname>, <ip-src> | 创建从具有此主机名或 IPv4/v6 地址的设备开始的跟踪 |
interval | <text-time-min> | 设置运行跟踪的频率,以分钟为单位 |
选项
选项 | 值 | 描述 |
---|---|---|
vlan | 1-4096 | 创建通过此 VLAN 的第 2 层跟踪 |
vrf | <vrf> | 创建通过此 VRF 的第 2 层或第 3 层跟踪 |
alert-on-failure | NA | 如果跟踪失败,则生成事件 |
用法示例
创建每 24 小时(1440 分钟)运行一次的第 3 层跟踪
cumulus@switch:~$ netq add trace name Lf01toBor01Daily 10.10.10.63 from 10.10.10.1 interval 1440m
Successfully added/updated Lf01toBor01Daily running every 1440m
创建每 3 小时(180 分钟)运行一次的第 2 层跟踪
cumulus@switch:~$ netq add trace name Svr01toSvr04x3Hrs 44:38:39:00:00:3e vlan 10 from 10.1.10.101 interval 180m
Successfully added/updated Svr01toSvr04x3Hrs running every 180m
相关命令
netq add trace
netq del trace
netq show trace
netq show events type trace
netq add validation
创建对各种协议和服务的验证,以便按常规间隔运行,结果以内联方式显示。您可以配置最多 15 个计划验证,不包括默认的计划验证。
语法
netq add validation
name <text-new-validation-name>
type (addr | agents | bgp | evpn | interfaces | mlag | mtu | ntp | roce | sensors | topology | vlan | vxlan)
interval <text-time-min>
[alert-on-failure]
必需参数
参数 | 值 | 描述 |
---|---|---|
name | 用户定义 | 验证的唯一名称 |
type | addr、agents、bgp、evpn、interfaces、mlag、mtu、ntp、roce、sensors、topology、vlan 或 vxlan | 要验证的协议或服务 |
interval | <text-time-min> | 运行验证的频率,以分钟为单位。值必须包含时间单位m,分钟。每种类型的默认计划验证每 60 分钟运行一次。 |
选项
选项 | 值 | 描述 |
---|---|---|
alert-on-failure | NA | 如果验证失败,则生成事件 |
用法示例
每 15 分钟在所有设备上运行的 BGP 验证
cumulus@switch:~$ netq add validation name Bgp15m type bgp interval 15m
相关命令
netq add validation
netq del validation
netq show validation settings
netq show validation summary
netq add validation type
创建对各种协议和服务的按需验证,结果以内联方式显示。
语法
netq add validation
type (addr | agents | bgp | evpn | interfaces | mlag | mtu | ntp | roce | sensors | topology | vlan | vxlan)
[alert-on-failure]
必需参数
参数 | 值 | 描述 |
---|---|---|
type | addr、agents、bgp、evpn、interfaces、mlag、mtu、ntp、roce、sensors、topology、vlan 或 vxlan | 要验证的协议或服务 |
选项
选项 | 值 | 描述 |
---|---|---|
alert-on-failure | NA | 如果验证失败,则生成事件 |
用法示例
创建 BGP 验证
cumulus@switch:~$ netq add validation type bgp
相关命令
netq add validation
netq del validation
netq show validation settings
netq show validation summary