Skip to main content
简体中文版经机器翻译而成,仅供参考。如与英语版出现任何冲突,应以英语版为准。

配置以太网交换机运行状况监视器的日志收集

贡献者 netapp-yvonneo netapp-jsnyder netapp-aoife aclose-ntap

在以太网交换机上配置日志收集,以启用以太网交换机健康监视器 (CSHM) 收集用于调试和 AutoSupport 报告的交换机日志。此过程在 ONTAP 中设置按需支持日志收集和每小时定期数据收集。

开始之前
  • 如果使用 FIPS 模式,请在设置日志收集之前完成以下操作:

    1. 按照厂商提供的说明,在交换机上重新生成 SSH 密钥。

    2. 使用 debug system regenerate-systemshell-key-pair 在 ONTAP 中重新生成 SSH 密钥。

    3. 使用 `system switch ethernet log setup-password`命令重新运行日志收集设置。

  • 您必须能够访问交换机 `show`命令。如果没有访问权限,请创建新的交换机用户并授予必要的权限。

  • 必须为交换机启用交换机运行状况监控。通过检查 `Is Monitored:`字段在 `system switch ethernet show`的输出中是否设置为 true 来验证。

  • 用于收集博通和Cisco交换机的日志:

    • 本地用户必须具有网络管理员权限。

    • 为每个启用了日志收集的集群创建新的交换机用户。这些交换机不支持同一用户使用多个 SSH 密钥,再次运行设置将覆盖现有的 SSH 密钥。

  • 要使用 NVIDIA 交换机支持日志收集,日志收集用户必须能够在没有密码的情况下运行该 `cl-support`命令。要执行此操作,请运行:

    echo '<user> ALL = NOPASSWD: /usr/cumulus/bin/cl-support' | sudo EDITOR='tee -a' visudo -f /etc/sudoers.d/cumulus

步骤

按照适用于您的 ONTAP 版本的步骤设置日志收集,启用定期数据收集,并可选择请求按需支持日志。

ONTAP 9.15.1 及更高版本
  1. 要设置日志收集,请对每个交换机运行以下命令。系统会提示您输入用于日志收集的交换机名称、用户名和密码。

    注意: 如果对用户规范提示回答 y,请确保用户拥有必要的权限,如以下所述:[开始之前]

    system switch ethernet log setup-password
    cluster1::*> system switch ethernet log setup-password
    Enter the switch name: <return>
    The switch name entered is not recognized.
    Choose from the following list:
    cs1
    cs2
    
    cluster1::*> system switch ethernet log setup-password
    
    Enter the switch name: cs1
    Would you like to specify a user other than admin for log collection? {y|n}: n
    
    Enter the password: <enter switch password>
    Enter the password again: <enter switch password>
    
    cluster1::*> system switch ethernet log setup-password
    
    Enter the switch name: cs2
    
    Would you like to specify a user other than admin for log collection? {y|n}: n
    
    Enter the password: <enter switch password>
    Enter the password again: <enter switch password>
备注 对于 CL 5.11.1,创建用户 cumulus 并对以下提示回答 y:您是否要指定除 admin 之外的用户进行日志收集? {y|n}: y
  1. 步骤2:启用定期日志收集。

    system switch ethernet log modify -device <switch-name> -periodic-enabled true
    cluster1::*> system switch ethernet log modify -device cs1 -periodic-enabled true
    
    Do you want to modify the cluster switch log collection configuration? {y|n}: [n] y
    
    cs1: Periodic log collection has been scheduled to run every hour.
    
    cluster1::*> system switch ethernet log modify -device cs2 -periodic-enabled true
    
    Do you want to modify the cluster switch log collection configuration? {y|n}: [n] y
    
    cs2: Periodic log collection has been scheduled to run every hour.
    
    cluster1::*> system switch ethernet log show
                                              Periodic    Periodic    Support
    Switch                                    Log Enabled Log State   Log State
    
    cs1                                       true        scheduled   never-run
    cs2                                       true        scheduled   never-run
    2 entries were displayed.
  2. 请求支持日志收集:

    system switch ethernet log collect-support-log -device <switch-name>
    cluster1::*> system switch ethernet log collect-support-log -device cs1
    
    cs1: Waiting for the next Ethernet switch polling cycle to begin support collection.
    
    cluster1::*> system switch ethernet log collect-support-log -device cs2
    
    cs2: Waiting for the next Ethernet switch polling cycle to begin support collection.
    
    cluster1::*> *system switch ethernet log show
                                              Periodic    Periodic    Support
    Switch                                    Log Enabled Log State   Log State
    
    cs1                                       false       halted      initiated
    cs2                                       true        scheduled   initiated
    2 entries were displayed.
  3. 要查看日志收集的所有详细信息,包括定期收集的启用状态、状态消息、上一个时间戳和文件名,以及支持收集的请求状态、状态消息、上一个时间戳和文件名,请使用以下命令:

    system switch ethernet log show -instance
    cluster1::*> system switch ethernet log show -instance
    
                        Switch Name: cs1
               Periodic Log Enabled: true
                Periodic Log Status: Periodic log collection has been scheduled to run every hour.
        Last Periodic Log Timestamp: 3/11/2024 11:02:59
              Periodic Log Filename: cluster1:/mroot/etc/log/shm-cluster-info.tgz
              Support Log Requested: false
                 Support Log Status: Successfully gathered support logs - see filename for their location.
         Last Support Log Timestamp: 3/11/2024 11:14:20
               Support Log Filename: cluster1:/mroot/etc/log/shm-cluster-log.tgz
    
                        Switch Name: cs2
               Periodic Log Enabled: false
                Periodic Log Status: Periodic collection has been halted.
        Last Periodic Log Timestamp: 3/11/2024 11:05:18
              Periodic Log Filename: cluster1:/mroot/etc/log/shm-cluster-info.tgz
              Support Log Requested: false
                 Support Log Status: Successfully gathered support logs - see filename for their location.
         Last Support Log Timestamp: 3/11/2024 11:18:54
               Support Log Filename: cluster1:/mroot/etc/log/shm-cluster-log.tgz
    2 entries were displayed.
ONTAP 9.14.1 及更早版本
  1. 要设置日志收集,请对每个交换机运行以下命令。系统会提示您输入用于日志收集的交换机名称、用户名和密码。

    注意: 如果回答 `y`根据用户规范提示,确保用户拥有必要的权限,具体权限要求请参见相关文档。[开始之前]

    system switch ethernet log setup-password
    cluster1::*> system switch ethernet log setup-password
    Enter the switch name: <return>
    The switch name entered is not recognized.
    Choose from the following list:
    cs1
    cs2
    
    cluster1::*> system switch ethernet log setup-password
    
    Enter the switch name: cs1
    Would you like to specify a user other than admin for log collection? {y|n}: n
    
    Enter the password: <enter switch password>
    Enter the password again: <enter switch password>
    
    cluster1::*> system switch ethernet log setup-password
    
    Enter the switch name: cs2
    
    Would you like to specify a user other than admin for log collection? {y|n}: n
    
    Enter the password: <enter switch password>
    Enter the password again: <enter switch password>
备注 对于 CL 5.11.1,创建用户 cumulus 并对以下提示回答 y:您是否要指定除 admin 之外的用户进行日志收集? {y|n}: y
  1. 要请求支持日志收集并启用定期收集,请运行以下命令。这将启动两种类型的日志收集:详细日志收集和详细日志收集。 `Support`日志和每小时收集的数据 `Periodic`数据。

    system switch ethernet log modify -device <switch-name> -log-request true
    cluster1::*> system switch ethernet log modify -device cs1 -log-request true
    
    Do you want to modify the cluster switch log collection configuration? {y|n}: [n] y
    
    Enabling cluster switch log collection.
    
    cluster1::*> system switch ethernet log modify -device cs2 -log-request true
    
    Do you want to modify the cluster switch log collection configuration? {y|n}: [n] y
    
    Enabling cluster switch log collection.

    等待 10 分钟,然后检查日志收集是否完成:

    system switch ethernet log show
注意 如果日志收集功能报告了任何错误状态(在 system switch ethernet log show 的输出中可见),请参阅 "排查日志收集问题" 以了解详细信息。
下一步是什么?

"配置 SNMPv3(可选)"