SNMP의 기본 사항
이것은 무엇이냐
SNMP가 자주 사용하는 지령과 OID를 기억하지 못하기 때문에 비망록 초밥입니다.
전제 조건
컨텐트
snmpwalk
명령snmptranslate
명령디테일
설치하다.
snmpwalk
, 사용하고 싶어서snmptranslate
, 아래[root@centos7 ~]# yum -y install net-snmp net-snmp-utils
MIB 정보
OID 정보
OID
OID(문자)
설명
.1.3.6.1.2.1.1
system
시스템 정보
.1.3.6.1.2.1.2
interfaces
인터페이스 정보
.1.3.6.1.2.1.3
at
IP 주소 및 물리적 주소를 저장하는 변환 테이블
.1.3.6.1.2.1.4
ip
IP 정보
.1.3.6.1.2.1.5
icmp
ICMP 정보
.1.3.6.1.2.1.6
tcp
TCP 정보
.1.3.6.1.2.1.7
udp
UDP 정보
.1.3.6.1.2.1.8
egp
EGP(Exteior Gateway Protocol) 정보
.1.3.6.1.2.1.9
transmission
네트워크 송수신 모듈(송신기)에 대한 정보
.1.3.6.1.2.1.11
snmp
SNMP 정보
명령
Usage
[root@centos7 ~]# snmpwalk -h
USAGE: snmpwalk [OPTIONS] AGENT [OID]
Version: 5.7.2
Web: http://www.net-snmp.org/
Email: [email protected]
OPTIONS:
-h, --help display this help message
-H display configuration file directives understood
-v 1|2c|3 specifies SNMP version to use
-V, --version display package version number
SNMP Version 1 or 2c specific
-c COMMUNITY set the community string
SNMP Version 3 specific
-a PROTOCOL set authentication protocol (MD5|SHA)
-A PASSPHRASE set authentication protocol pass phrase
-e ENGINE-ID set security engine ID (e.g. 800000020109840301)
-E ENGINE-ID set context engine ID (e.g. 800000020109840301)
-l LEVEL set security level (noAuthNoPriv|authNoPriv|authPriv)
-n CONTEXT set context name (e.g. bridge1)
-u USER-NAME set security name (e.g. bert)
-x PROTOCOL set privacy protocol (DES|AES)
-X PASSPHRASE set privacy protocol pass phrase
-Z BOOTS,TIME set destination engine boots/time
General communication options
-r RETRIES set the number of retries
-t TIMEOUT set the request timeout (in seconds)
Debugging
-d dump input/output packets in hexadecimal
-D[TOKEN[,...]] turn on debugging output for the specified TOKENs
(ALL gives extremely verbose debugging output)
General options
-m MIB[:...] load given list of MIBs (ALL loads everything)
-M DIR[:...] look in given list of directories for MIBs
(default: $HOME/.snmp/mibs:/usr/share/snmp/mibs)
-P MIBOPTS Toggle various defaults controlling MIB parsing:
u: allow the use of underlines in MIB symbols
c: disallow the use of "--" to terminate comments
d: save the DESCRIPTIONs of the MIB objects
e: disable errors when MIB symbols conflict
w: enable warnings when MIB symbols conflict
W: enable detailed warnings when MIB symbols conflict
R: replace MIB symbols from latest module
-O OUTOPTS Toggle various defaults controlling output display:
0: print leading 0 for single-digit hex characters
a: print all strings in ascii format
b: do not break OID indexes down
e: print enums numerically
E: escape quotes in string indices
f: print full OIDs on output
n: print OIDs numerically
q: quick print for easier parsing
Q: quick print with equal-signs
s: print only last symbolic element of OID
S: print MIB module-id plus last element
t: print timeticks unparsed as numeric integers
T: print human-readable text along with hex strings
u: print OIDs using UCD-style prefix suppression
U: don't print units
v: print values only (not OID = value)
x: print all strings in hex format
X: extended index format
-I INOPTS Toggle various defaults controlling input parsing:
b: do best/regex matching to find a MIB node
h: don't apply DISPLAY-HINTs
r: do not check values for range/type legality
R: do random access to OID labels
u: top-level OIDs must have '.' prefix (UCD-style)
s SUFFIX: Append all textual OIDs with SUFFIX before parsing
S PREFIX: Prepend all textual OIDs with PREFIX before parsing
-L LOGOPTS Toggle various defaults controlling logging:
e: log to standard error
o: log to standard output
n: don't log at all
f file: log to the specified file
s facility: log to syslog (via the specified facility)
(variants)
[EON] pri: log to standard error, output or /dev/null for level 'pri' and above
[EON] p1-p2: log to standard error, output or /dev/null for levels 'p1' to 'p2'
[FS] pri token: log to file/syslog for level 'pri' and above
[FS] p1-p2 token: log to file/syslog for levels 'p1' to 'p2'
-C APPOPTS Set various application specific behaviours:
p: print the number of variables found
i: include given OID in the search range
I: don't include the given OID, even if no results are returned
c: do not check returned OIDs are increasing
t: Display wall-clock time to complete the walk
T: Display wall-clock time to complete each request
E {OID}: End the walk at the specified OID
시스템 정보 얻기[root@centos7 ~]# snmpwalk -v 2c -c public 172.20.7.1 .1.3.6.1.2.1.1
または
[root@centos7 ~]# snmpwalk -v 2c -c public 172.20.7.1 system
SNMPv2-MIB::sysDescr.0 = STRING: Cisco IOS Software, C3560 Software (C3560-IPBASE-M), Version 12.2(25)SEB4, RELEASE SOFTWARE (fc1)
Copyright (c) 1986-2005 by Cisco Systems, Inc.
Compiled Tue 30-Aug-05 14:19 by yenanh
SNMPv2-MIB::sysObjectID.0 = OID: SNMPv2-SMI::enterprises.9.1.615
DISMAN-EVENT-MIB::sysUpTimeInstance = Timeticks: (3103805174) 359 days, 5:40:51.74
SNMPv2-MIB::sysContact.0 = STRING:
SNMPv2-MIB::sysName.0 = STRING: cs-bit-l3sw01.cisco.com
SNMPv2-MIB::sysLocation.0 = STRING:
SNMPv2-MIB::sysServices.0 = INTEGER: 6
SNMPv2-MIB::sysORLastChange.0 = Timeticks: (0) 0:00:00.00
특정 OID에서 정보 얻기[root@centos7 ~]# snmpwalk -v 2c -c public 172.20.7.1 .1.3.6.1.2.1.1.1
または
[root@centos7 ~]# snmpwalk -v 2c -c public 172.20.7.1 system.1
SNMPv2-MIB::sysDescr.0 = STRING: Cisco IOS Software, C3560 Software (C3560-IPBASE-M), Version 12.2(25)SEB4, RELEASE SOFTWARE (fc1)
Copyright (c) 1986-2005 by Cisco Systems, Inc.
Compiled Tue 30-Aug-05 14:19 by yenanh
snmptranslate 명령
Usage
[root@centos7 ~]# snmptranslate -h
USAGE: snmptranslate [OPTIONS] OID [OID]...
Version: 5.7.2
Web: http://www.net-snmp.org/
Email: [email protected]
OPTIONS:
-h display this help message
-V display package version number
-m MIB[:...] load given list of MIBs (ALL loads everything)
-M DIR[:...] look in given list of directories for MIBs
-D[TOKEN[,...]] turn on debugging output for the specified TOKENs
(ALL gives extremely verbose debugging output)
-w WIDTH set width of tree and detail output
-T TRANSOPTS Set various options controlling report produced:
B: print all matching objects for a regex search
d: print full details of the given OID
p: print tree format symbol table
a: print ASCII format symbol table
l: enable labeled OID report
o: enable OID report
s: enable dotted symbolic report
z: enable MIB child OID report
t: enable alternate format symbolic suffix report
-P MIBOPTS Toggle various defaults controlling mib parsing:
u: allow the use of underlines in MIB symbols
c: disallow the use of "--" to terminate comments
d: save the DESCRIPTIONs of the MIB objects
e: disable errors when MIB symbols conflict
w: enable warnings when MIB symbols conflict
W: enable detailed warnings when MIB symbols conflict
R: replace MIB symbols from latest module
-O OUTOPTS Toggle various defaults controlling output display:
0: print leading 0 for single-digit hex characters
a: print all strings in ascii format
b: do not break OID indexes down
e: print enums numerically
E: escape quotes in string indices
f: print full OIDs on output
n: print OIDs numerically
q: quick print for easier parsing
Q: quick print with equal-signs
s: print only last symbolic element of OID
S: print MIB module-id plus last element
t: print timeticks unparsed as numeric integers
T: print human-readable text along with hex strings
u: print OIDs using UCD-style prefix suppression
U: don't print units
v: print values only (not OID = value)
x: print all strings in hex format
X: extended index format
-I INOPTS Toggle various defaults controlling input parsing:
b: do best/regex matching to find a MIB node
h: don't apply DISPLAY-HINTs
r: do not check values for range/type legality
R: do random access to OID labels
u: top-level OIDs must have '.' prefix (UCD-style)
s SUFFIX: Append all textual OIDs with SUFFIX before parsing
S PREFIX: Prepend all textual OIDs with PREFIX before parsing
-L LOGOPTS Toggle various defaults controlling logging:
e: log to standard error
o: log to standard output
n: don't log at all
f file: log to the specified file
s facility: log to syslog (via the specified facility)
(variants)
[EON] pri: log to standard error, output or /dev/null for level 'pri' and above
[EON] p1-p2: log to standard error, output or /dev/null for levels 'p1' to 'p2'
[FS] pri token: log to file/syslog for level 'pri' and above
[FS] p1-p2 token: log to file/syslog for levels 'p1' to 'p2'
OID(숫자)에서 OID(이름)로 변환[root@centos7 ~]# snmptranslate .1.3.6.1.2.1.2.2.1.10
IF-MIB::ifInOctets
OID(이름)에서 OID(숫자)로 변환[root@centos7 ~]# snmptranslate -On IF-MIB::ifInOctets
.1.3.6.1.2.1.2.2.1.10
트리 뷰 객체[root@centos7 ~]# snmptranslate -Tp
たくさんでるよ
Reference
이 문제에 관하여(SNMP의 기본 사항), 우리는 이곳에서 더 많은 자료를 발견하고 링크를 클릭하여 보았다 https://qiita.com/Tocyuki/items/9aaae3de2858b2bfed7d텍스트를 자유롭게 공유하거나 복사할 수 있습니다.하지만 이 문서의 URL은 참조 URL로 남겨 두십시오.
우수한 개발자 콘텐츠 발견에 전념 (Collection and Share based on the CC Protocol.)