IOS-XEでのSNMP manager
iosv-1(config)#snmp-server manager
iosv-1(config)#snmp-server community private rw
iosv-1#snmp get v2c 10.1.1.1 private oid 1.3.6.1.2.1.1.5.0
Timeout
なんでTimeoutするんだ?
でもTimeoutするってことはコマンド自体は間違ってなさそう。
iosv-0#sh run | sec snmp
mmi snmp-timeout 180
snmp-server group HOGETA v3 auth
snmp-server community private RW 1
snmp-server trap-source GigabitEthernet0/0
snmp-server community private RW """1"""
前設定したものをそのままにしてた。気を付けよう。
SNMP GET
iosv-0(config)#access-list 1 permit host 10.1.1.2
iosv-1#snmp get v2c 10.1.1.1 private oid 1.3.6.1.2.1.1.5.0
SNMP Response: reqid 4, errstat 0, erridx 0
system.5.0 = iosv-0
SNMP Traps
iosv-0(config)#snmp-server host 10.1.1.2 informs version 2c private
iosv-0(config)#snmp-server host 10.1.1.2 traps version 2c private
iosv-0(config)#int gi0/2
iosv-0(config-if)#shut/no shut(linkupとdownでtrapsの確認)
iosv-1#debug ip udp
UDP packet debugging is on
iosv-1#
*Jun 24 15:36:18.897: UDP: rcvd src=10.1.1.1(60472), dst=10.1.1.2(162), length=173
*Jun 24 15:36:18.913: UDP: sent src=10.1.1.2(55086), dst=10.1.1.1(60472), length=35
*Jun 24 15:36:19.168: UDP: rcvd src=10.1.1.1(59490), dst=10.1.1.2(162), length=173
iosv-1#debug snmp packets
SNMP packet debugging is on
iosv-1#
*Jun 24 15:40:55.439: SNMP: Packet received via UDP from 10.1.1.1 on GigabitEthernet0/0
*Jun 24 15:40:55.443: SNMP: Inform request, reqid 106, errstat 0, erridx 0
sysUpTime.0 = 2356366
snmpTrapOID.0 = snmpTraps.4
ifIndex.3 = 3
ifDescr.3 = GigabitEthernet0/2
ifType.3 = 6
lifEntry.20.3 = Link up
*Jun 24 15:40:55.453: dest ip addr= 10.1.1.2
*Jun 24 15:40:55.454: dest if_index = 1
*Jun 24 15:40:55.455: SNMP: Response, reqid 106, errstat 0, erridx 0
*Jun 24 15:40:55.457: SNMP: Packet sent via UDP to 10.1.1.1.60472
*Jun 24 15:40:55.703: SNMP: Packet received via UDP from 10.1.1.1 on GigabitEthernet0/0
*Jun 24 15:40:55.710: SNMP: V2 Trap
iosv-1#, reqid 88, errstat 0, erridx 0
sysUpTime.0 = 2356366
snmpTrapOID.0 = snmpTraps.4
ifIndex.3 = 3
ifDescr.3 = GigabitEthernet0/2
ifType.3 = 6
lifEntry.20.3 = Link up
*Jun 24 15:40:55.726: dest ip addr= 10.1.1.2
*Jun 24 15:40:55.727: dest if_index = 1
・ポーリングもトラップも成功
・snmp-server manager設定するだけで実現するからめっちゃ楽
・この前わざわざubuntuでsnmpdセットアップした苦労は一体…?
罠
iosv-1#?
Exec commands:
<略>
sdlc Send SDLC test frames
send Send a message to other tty lines
set Set system parameter (not config)
setup Run the SETUP command facility
show Show running system information
slip Start Serial-line IP (SLIP)
software Software commands
spec-file format spec file commands
ssh Open a secure shell client connection
start-chat Start a chat-script on a line
systat Display information about terminal lines
<略>
iosv-1#snmp get v2c 10.1.1.1 private oid 1.3.6.1.2.1.1.5.0
SNMP Response: reqid 9, errstat 0, erridx 0
system.5.0 = iosv-0
?コマンドでsnmpは表示されないけど、ちゃんとsnmp getできる
参考
Chapter: Configuring SNMP Support