Configuring a Switch to Periodically Report Logs and Alarms to an Analyzer
Procedure
- Configure SNMP on the switch. This step is required only when the independent deployment mode is used.
- Run the system-view command to enter the system view.
- Run the snmp-agent command to enable the SNMP agent service.
By default, the SNMP agent service is disabled. This service is enabled when you run any command starting with snmp-agent (with or without parameters).
- Run the snmp-agent sys-info version { { v1 | v2c | v3 } * | all } command to configure the SNMP version.
By default, SNMPv3 is used.
- Run one of the following commands to configure the read and write community names:
- snmp-agent community { read | write } { community-name | cipher community-name } [ mib-view view-name | acl { acl-number | acl-name } | alias alias-name ] *
- snmp-agent community { read | write } [ cipher ] community-name [ mib-view view-name ] acl-ipv4 { acl-number | acl-name } [ acl-ipv6 { acl-number | acl-name } ] [ alias alias-name ]
- snmp-agent community { read | write } [ cipher ] community-name [ mib-view view-name ] acl-ipv6 { acl-number | acl-name } [ alias alias-name ]
By default, no community name exists on the device, and the device checks complexity of community names. If the check fails, the community name cannot be configured. The device has the following requirements for community name complexity:
The minimum length of a community name is determined by the set password min-length command. By default, a password contains 8 characters.
A community name includes at least two kinds of characters, which can be uppercase letters, lowercase letters, digits, and special characters (excluding question marks and spaces). When double quotation marks are used around the string, spaces are allowed in the string.
- Run the quit command to exit the system view.
- Configure the NETCONF function on the switch.
- Run the system-view command to enter the system view.
- Run the netconf command to enable the NETCONF function and enter the NETCONF view.
- Run the source ip ip-address [ port port-number ] command to configure the source IPv4 address and port number for the switch to interconnect with the analyzer.
- Run the smi-server command to create and enter SMI view.
- Run the server ip-address ip-address [ port port-number ] command to configure the IPv4 address and port number of the analyzer to interconnect with the switch.
- (Optional) Run the keepalive { interval interval | retry-interval retry-interval | retry-number retry-number } * command to configure connection parameters between the switch and analyzer.
By default, the switch and analyzer send heartbeat packets to each other at an interval of 5 minutes, the switch reconnects to the analyzer at an interval of 5 minutes, and the maximum number of reconnection attempts is 0.
- (Optional) Run the max-packet-size size command to set the maximum size of packets sent by the switch to report KPI information to the analyzer.
By default, the maximum size of packets sent by the switch to report KPI information to the analyzer is 5 KB.
- Run the return command to return to the user view.
- Configure the switch to report logs and alarms to the analyzer through syslog or telemetry.
- Configure the switch to report logs and alarms to the analyzer through syslog.
- Run the system-view command to enter the system view.
- Run the info-center enable command to enable the information center.
- Run the info-center loghost source interface-type interface-number command to configure the source interface from which the switch sends logs to the analyzer.
- Run the info-center loghost ip-address command to configure the IP address of the analyzer for receiving logs.
- Configure the switch to report logs and alarms to the analyzer through telemetry.
- Run the system-view command to enter the system view.
- Run the netconf command to enter the NETCONF view.
- Run the smi-server command to enter SMI view.
- Run the collect-item syslog { aaa | acl | basetrap | defd | dhcp | dot1x | entitytrap | ifnet | ifpdt | l2ifppi | l3adp | lbdt | mcast | mpls | mstp | nac | poe | portal | sea | sece | shell | web } enable command to configure the switch to report logs and alarms to the analyzer.
By default, the switch is disabled from reporting logs and alarms to the analyzer.
When the dhcp parameter is specified to enable the switch is enabled to report DHCP logs to the analyzer, run the dhcp snooping packet-flow log enable command to enable the switch to record logs when DHCP packets are exchanged.
- Configure the switch to report logs and alarms to the analyzer through syslog.