知乎專欄 | 多維度架構 | 微信號 netkiller-ebook | QQ群:128659835 請註明“讀者” |
snmpwalk -c public -v2c 172.16.1.1
system.sysDescr
$ snmpget -v2c -c public 172.16.1.1 system.sysDescr.0 SNMPv2-MIB::sysDescr.0 = STRING: Cisco IOS Software, C3750 Software (C3750-IPBASE-M), Version 12.2(35)SE5, RELEASE SOFTWARE (fc1) Copyright (c) 1986-2007 by Cisco Systems, Inc. Compiled Thu 19-Jul-07 19:15 by nachen $ snmpget -v2c -c public 172.16.1.1 sysName.0 SNMPv2-MIB::sysName.0 = STRING: Switch-3750-LAN $ snmpwalk -v2c -c public 172.16.1.1 interfaces.ifTable.ifEntry.ifDescr IF-MIB::ifDescr.1 = STRING: Vlan1 IF-MIB::ifDescr.2 = STRING: Vlan2 IF-MIB::ifDescr.3 = STRING: Vlan3 IF-MIB::ifDescr.4 = STRING: Vlan4 IF-MIB::ifDescr.5 = STRING: Vlan5 IF-MIB::ifDescr.5179 = STRING: StackPort1 IF-MIB::ifDescr.5180 = STRING: StackSub-St1-1 IF-MIB::ifDescr.5181 = STRING: StackSub-St1-2 IF-MIB::ifDescr.10101 = STRING: GigabitEthernet1/0/1 IF-MIB::ifDescr.10102 = STRING: GigabitEthernet1/0/2 IF-MIB::ifDescr.10103 = STRING: GigabitEthernet1/0/3 IF-MIB::ifDescr.10104 = STRING: GigabitEthernet1/0/4 IF-MIB::ifDescr.10105 = STRING: GigabitEthernet1/0/5 IF-MIB::ifDescr.10106 = STRING: GigabitEthernet1/0/6 IF-MIB::ifDescr.10107 = STRING: GigabitEthernet1/0/7 IF-MIB::ifDescr.10108 = STRING: GigabitEthernet1/0/8 IF-MIB::ifDescr.10109 = STRING: GigabitEthernet1/0/9 IF-MIB::ifDescr.10110 = STRING: GigabitEthernet1/0/10 IF-MIB::ifDescr.10111 = STRING: GigabitEthernet1/0/11 IF-MIB::ifDescr.10112 = STRING: GigabitEthernet1/0/12 IF-MIB::ifDescr.10113 = STRING: GigabitEthernet1/0/13 IF-MIB::ifDescr.10114 = STRING: GigabitEthernet1/0/14 IF-MIB::ifDescr.10115 = STRING: GigabitEthernet1/0/15 IF-MIB::ifDescr.10116 = STRING: GigabitEthernet1/0/16 IF-MIB::ifDescr.10117 = STRING: GigabitEthernet1/0/17 IF-MIB::ifDescr.10118 = STRING: GigabitEthernet1/0/18 IF-MIB::ifDescr.10119 = STRING: GigabitEthernet1/0/19 IF-MIB::ifDescr.10120 = STRING: GigabitEthernet1/0/20 IF-MIB::ifDescr.10121 = STRING: GigabitEthernet1/0/21 IF-MIB::ifDescr.10122 = STRING: GigabitEthernet1/0/22 IF-MIB::ifDescr.10123 = STRING: GigabitEthernet1/0/23 IF-MIB::ifDescr.10124 = STRING: GigabitEthernet1/0/24 IF-MIB::ifDescr.10125 = STRING: GigabitEthernet1/0/25 IF-MIB::ifDescr.10126 = STRING: GigabitEthernet1/0/26 IF-MIB::ifDescr.10127 = STRING: GigabitEthernet1/0/27 IF-MIB::ifDescr.10128 = STRING: GigabitEthernet1/0/28 IF-MIB::ifDescr.14501 = STRING: Null0 $ snmpget -v2c -c public 172.16.1.1 interfaces.ifNumber.0 IF-MIB::ifNumber.0 = INTEGER: 37
snmpget -v2c -c public 172.16.1.254 IF-MIB::ifInOctets.3 IF-MIB::ifInOctets.9 IF-MIB::ifOutOctets.3 IF-MIB::ifOutOctets.9 snmpget -v2c -c public 172.16.1.254 IF-MIB::ifOperStatus.3 IF-MIB::ifOperStatus.9
#!/bin/bash echo -n `date +%H:%M:%S` " " snmpget -v2c -c public 172.16.1.254 IF-MIB::ifInOctets.3 IF-MIB::ifInOctets.9 IF-MIB::ifOutOctets.3 IF-MIB::ifOutOctets.9 | awk -F ': ' '{print $2}' | tr "\n" " " echo
$ crontab -l # m h dom mon dow command */5 * * * * /home/mgmt/test/test.sh >> /home/mgmt/test/test.log