In Figure 1, the S5720I-SI working at a wide temperature range is typically deployed outdoors in a cabinet, and a backup power supply is configured in the cabinet. Input lines 1 and 2 of monitoring interfaces on the Switch are connected to the cabinet door and backup power supply respectively. The Switch and the NMS are connected and there are reachable routes between them.
Users want to use the NMS to monitor the cabinet door status and backup power supply for fast fault location.
Set the SNMP version of the switch to SNMPv3.
Configure user access rights.
Configure the trap host so that the traps generated by the switch can be sent to the NMS.
Configure the NMS.
Configure monitoring interfaces to monitor the input lines 1 and 2.
<HUAWEI> system-view [HUAWEI] sysname Switch [Switch] snmp-agent sys-info version v3
# Configure the MIB view.
[Switch] snmp-agent mib-view included isoview iso
# Configure the user group.
[Switch] snmp-agent group v3 admin privacy write-view isoview acl 2001
# Configure the user.
[Switch] snmp-agent usm-user v3 nms group admin
# Configure data authentication and set the authentication password to admin@123.
[Switch] snmp-agent usm-user v3 nms authentication-mode sha2-256
Please configure the authentication password (8-64)
Enter Password: //Enter the authentication password. It is admin@123 in this example.
Confirm Password: //Confirm the password. It is admin@123 in this example.
# Configure data encryption and set the authentication password to admin@123.
[Switch] snmp-agent usm-user v3 nms privacy-mode aes256
Please configure the privacy password (8-64)
Enter Password: //Enter the encryption password. It is admin@123 in this example.
Confirm Password: //Confirm the password. It is admin@123 in this example.
[Switch] snmp-agent trap enable Warning: All switches of SNMP trap/notification will be open. Continue? [Y/N]:y [Switch] snmp-agent target-host trap address udp-domain 10.1.1.1 params securityname nms-admin v3 privacy
Set a user name and select a security level on the NMS running SNMPv3. Then set the authentication mode, authentication password, encryption mode, and encryption key according to the security level you select.
The authentication parameters configured on the NMS must be the same as those on the switch. Otherwise, the NMS cannot manage the switch.
# Enable the monitoring function for input lines 1 and 2.
[Switch] monitor input 1 enable [Switch] monitor input 2 enable
# Set the names of the input lines 1 and 2 to input1 and input2, and set the level of the input lines in normal state to low level.
[Switch] monitor input 1 name input1 normal-state low-level [Switch] monitor input 2 name input2 normal-state low-level
After the configurations are complete, run the following command to check whether the SNMP configuration has taken effect.
# View the configuration of the target host used to receive traps.
[Switch] display snmp-agent target-host
Target-host NO. 1
-----------------------------------------------------------
IP-address : 10.1.1.1
Domain : -
Source interface : -
VPN instance : -
Security name : nms-admin
Port : 162
Type : trap
Version : v3
Level : Privacy
NMS type : NMS
With ext-vb : No
-----------------------------------------------------------
After the configurations are complete, check whether the monitoring device function has taken effect on monitoring interfaces.
When the cabinet door is opened (that is, the input line 1 changes from low level to high level), the switch sends a trap indicating that the input line 1 is abnormal to the NMS.
If the backup power supply is abnormal (that is, the input line 2 changes from low level to high level), the switch sends a trap indicating that the input line 2 is abnormal to the NMS.
Switch configuration file
# sysname Switch # monitor input 1 enable monitor input 1 name input1 normal-state low-level monitor input 2 enable monitor input 2 name input2 normal-state low-level # snmp-agent snmp-agent local-engineid 800007DB03000013824569 snmp-agent sys-info version v2c v3 snmp-agent group v3 admin privacy write-view isoview acl 2001 snmp-agent target-host trap address udp-domain 10.1.1.1 params securityname nms-admin v3 privacy snmp-agent target-host trap address udp-domain 192.168.50.252 udp-port 163 params securityname cipher %^%#`{9#1bV-lLMR[~M:Z9SRjCLV!P`5h-[~PKF)w{;"%^%# v2c snmp-agent mib-view included isoview iso snmp-agent usm-user v3 nms snmp-agent usm-user v3 nms authentication-mode sha2-256 cipher %^%#B73CS]\B%R]R^DDmW$9FZ`4m0V-:xV5v7v/fw_IU%^%# snmp-agent usm-user v3 nms privacy-mode aes128 cipher %^%#m$#O)tG@[(HRqgVYvZ}+NZh*ZFNs=SkU8>h07IQ%^%# snmp-agent trap enable # return