목차
[edit]
1 ucd-snmp 소 개 ¶
망관리 프로토콜인 snmp을 이용할수 있도록 해주는 공개 소프트웨어이다. ucd-snmp 는 현재 버전 5대로 올라가면서 프로젝트의 이름을 net-snmp 로 변경한 상태이다. 일반적으로 많이 사용되고 있는 ucd-snmp의 버전은 4대이다.
[edit]
3 ucd-snmp 설 정 ¶
/usr/local/share/snmp/snmpd.conf
com2sec local localhost private com2sec mynetwork 192.168.119.128/29 public sysservices 76 syslocation skku syscontact leejonghyouk <webmaster@hurryon.org>
[edit]
4.2.1 snmptest ¶
snmptest 명령어을 이용하여 제대로 설치가 되었는지 테스트해 볼수 있다.
[root@note snmp]# snmptest 192.168.119.128 public Variable: system.sysDescr.0 Variable: system.sysName.0 Variable: Received Get Response from 192.168.119.128 requestid 0x456B696C errstat 0x0 errindex 0x0 system.sysDescr.0 = Linux note.wmware.org 2.4.18-3 #1 Thu Apr 18 07:37:53 EDT 2002 i686 system.sysName.0 = note.wmware.org Variable: [root@note snmp]#
[edit]
4.2.2 snmpget ¶
snmpget 명령어는 명령어 이름에서 알수 있듯이 에이전트로부터 정보을 얻어 오는데 사용되는 명령어 있다. 인자값으로 MIB의 계층이름이나 OID 번호을 넣을수 있다. snmpget 명령어는 snmp get의 기능을 구현한 명령어이기 때문에 하위 계층의 정보는 가져 오지 않는다.
[root@note bin]# snmpget localhost public system.sysDescr.0 system.sysDescr.0 = Linux note.wmware.org 2.4.18-3 #1 Thu Apr 18 07:37:53 EDT 2002 i686 [root@note bin]# snmpget localhost public 1.1.0 system.sysDescr.0 = Linux note.wmware.org 2.4.18-3 #1 Thu Apr 18 07:37:53 EDT 2002 i686 [root@note bin]# snmpget localhost public 1.2.0 system.sysObjectID.0 = OID: enterprises.ucdavis.ucdSnmpAgent.linux [root@note bin]# snmpget localhost public 1.3.0 system.sysUpTime.0 = Timeticks: (837696) 2:19:36.96 [root@note bin]# snmpget localhost public 1.4.0 system.sysContact.0 = root@ [root@note bin]# snmpget localhost public 1.5.0 system.sysName.0 = note.wmware.org [root@note bin]# snmpget localhost public 1.6.0 system.sysLocation.0 = Unknown [root@note bin]# snmpget localhost public 1.7.0 Error in packet Reason: (noSuchName) There is no such variable name in this MIB. Failed object: system.sysServices.0 [root@note bin]# snmpget localhost public 1.8.0 system.sysORLastChange.0 = Timeticks: (1) 0:00:00.01 [root@note bin]# snmpget localhost public 1.9.0 Error in packet Reason: (noSuchName) There is no such variable name in this MIB. Failed object: system.sysORTable.0 [root@note bin]# snmpget localhost public 1.10.0 Error in packet Reason: (noSuchName) There is no such variable name in this MIB. Failed object: system.10.0 [root@note bin]#
[edit]
4.2.3 snmpgetnext ¶
snmpgetnext 명령어는 snmp next의 기능을 구현한 명령어이다. 하지만 하위 계층의 정보을 모두 가져 오는것이 아니라 바로 다음 계층의 정보을 가져오게 된다. 결론적으로 1개의 정보을 가져오게 되는것이다. 예을 들어 system.sysDescr.0 에 대한 정보을 요청하면 하위 계층의 정보인 system.sysObjectID.0 의 정보을 가져 온다.
[root@note bin]# snmpgetnext localhost public 1.1.0 system.sysObjectID.0 = OID: enterprises.ucdavis.ucdSnmpAgent.linux
[edit]
4.2.4 snmpwalk ¶
snmpwalk 명령어도 snmp next의 기능을 구현한 명령어로 하위 계층의 정보을 모두 가져 온다. -Of 옵션은 Full OID output -On 옵션은 OID number output 이다.
[root@note bin]# snmpwalk localhost public 1 system.sysDescr.0 = Linux note.wmware.org 2.4.18-3 #1 Thu Apr 18 07:37:53 EDT 2002 i686 system.sysObjectID.0 = OID: enterprises.ucdavis.ucdSnmpAgent.linux system.sysUpTime.0 = Timeticks: (47405) 0:07:54.05 system.sysContact.0 = root@ system.sysName.0 = note.wmware.org system.sysLocation.0 = Unknown system.sysORLastChange.0 = Timeticks: (0) 0:00:00.00 system.sysORTable.sysOREntry.sysORID.1 = OID: ifMIB system.sysORTable.sysOREntry.sysORID.2 = OID: .iso.org.dod.internet.snmpV2.snmpModules.snmpMIB system.sysORTable.sysOREntry.sysORID.3 = OID: tcpMIB system.sysORTable.sysOREntry.sysORID.4 = OID: ip system.sysORTable.sysOREntry.sysORID.5 = OID: udpMIB system.sysORTable.sysOREntry.sysORID.6 = OID: .iso.org.dod.internet.snmpV2.snmpModules.snmpVacmMIB.vacmMIBConformance.vacmMIBGroups.vacmBasicGroup system.sysORTable.sysOREntry.sysORID.7 = OID: .iso.org.dod.internet.snmpV2.snmpModules.snmpFrameworkMIB.snmpFrameworkMIBConformance.snmpFrameworkMIBCompliances.snmpFrameworkMIBCompliance system.sysORTable.sysOREntry.sysORID.8 = OID: .iso.org.dod.internet.snmpV2.snmpModules.snmpMPDMIB.snmpMPDMIBConformance.snmpMPDMIBCompliances.snmpMPDCompliance system.sysORTable.sysOREntry.sysORID.9 = OID: .iso.org.dod.internet.snmpV2.snmpModules.snmpUsmMIB.usmMIBConformance.usmMIBCompliances.usmMIBCompliance system.sysORTable.sysOREntry.sysORDescr.1 = The MIB module to describe generic objects for network interface sub-layers system.sysORTable.sysOREntry.sysORDescr.2 = The MIB module for SNMPv2 entities system.sysORTable.sysOREntry.sysORDescr.3 = The MIB module for managing TCP implementations system.sysORTable.sysOREntry.sysORDescr.4 = The MIB module for managing IP and ICMP implementations system.sysORTable.sysOREntry.sysORDescr.5 = The MIB module for managing UDP implementations system.sysORTable.sysOREntry.sysORDescr.6 = View-based Access Control Model for SNMP. system.sysORTable.sysOREntry.sysORDescr.7 = The SNMP Management Architecture MIB. system.sysORTable.sysOREntry.sysORDescr.8 = The MIB for Message Processing and Dispatching. system.sysORTable.sysOREntry.sysORDescr.9 = The management information definitions for the SNMP User-based Security Model. system.sysORTable.sysOREntry.sysORUpTime.1 = Timeticks: (0) 0:00:00.00 system.sysORTable.sysOREntry.sysORUpTime.2 = Timeticks: (0) 0:00:00.00 system.sysORTable.sysOREntry.sysORUpTime.3 = Timeticks: (0) 0:00:00.00 system.sysORTable.sysOREntry.sysORUpTime.4 = Timeticks: (0) 0:00:00.00 system.sysORTable.sysOREntry.sysORUpTime.5 = Timeticks: (0) 0:00:00.00 system.sysORTable.sysOREntry.sysORUpTime.6 = Timeticks: (0) 0:00:00.00 system.sysORTable.sysOREntry.sysORUpTime.7 = Timeticks: (0) 0:00:00.00 system.sysORTable.sysOREntry.sysORUpTime.8 = Timeticks: (0) 0:00:00.00 system.sysORTable.sysOREntry.sysORUpTime.9 = Timeticks: (0) 0:00:00.00 [root@note snmp]# snmpwalk -Of localhost private memory .iso.org.dod.internet.private.enterprises.ucdavis.memory.memIndex.0 = 0 .iso.org.dod.internet.private.enterprises.ucdavis.memory.memErrorName.0 = swap .iso.org.dod.internet.private.enterprises.ucdavis.memory.memTotalSwap.0 = 264560 .iso.org.dod.internet.private.enterprises.ucdavis.memory.memAvailSwap.0 = 261656 .iso.org.dod.internet.private.enterprises.ucdavis.memory.memTotalReal.0 = 191272 .iso.org.dod.internet.private.enterprises.ucdavis.memory.memAvailReal.0 = 13140 .iso.org.dod.internet.private.enterprises.ucdavis.memory.memTotalFree.0 = 274796 .iso.org.dod.internet.private.enterprises.ucdavis.memory.memMinimumSwap.0 = 16000 .iso.org.dod.internet.private.enterprises.ucdavis.memory.memShared.0 = 0 .iso.org.dod.internet.private.enterprises.ucdavis.memory.memBuffer.0 = 28148 .iso.org.dod.internet.private.enterprises.ucdavis.memory.memCached.0 = 129248 .iso.org.dod.internet.private.enterprises.ucdavis.memory.memSwapError.0 = 0 .iso.org.dod.internet.private.enterprises.ucdavis.memory.memSwapErrorMsg.0 = [root@note snmp]# snmpwalk -On localhost private memory .1.3.6.1.4.1.2021.4.1.0 = 0 .1.3.6.1.4.1.2021.4.2.0 = swap .1.3.6.1.4.1.2021.4.3.0 = 264560 .1.3.6.1.4.1.2021.4.4.0 = 261656 .1.3.6.1.4.1.2021.4.5.0 = 191272 .1.3.6.1.4.1.2021.4.6.0 = 13132 .1.3.6.1.4.1.2021.4.11.0 = 274788 .1.3.6.1.4.1.2021.4.12.0 = 16000 .1.3.6.1.4.1.2021.4.13.0 = 0 .1.3.6.1.4.1.2021.4.14.0 = 28152 .1.3.6.1.4.1.2021.4.15.0 = 129248 .1.3.6.1.4.1.2021.4.100.0 = 0 .1.3.6.1.4.1.2021.4.101.0 = [root@note snmp]#
[edit]
5.1 시스템의 상태을 확인하기 위해 사용되는 OID ¶
[edit]