相关snmp,oid,mib的介绍如下: 
http://wenku.baidu.com/link?url=NbKuswetz4S_C6x8aZKr7txnhLHiMK-P938XvmQtC_ic91rOT3Yxg9evb_DJ4qEBksr4tsDoSo23lfEBJhC42Q4Ufvay_JKrISgD0fykobG

sudo apt-get install snmpd 
sudo apt-get install snmp 
如果在用客户端获取信息是,使用的是mib名称,而不是oid,还需要安装snmp-mibs-downloader 
service snmpd start 
为了获取所有的数据,修/etc/snmp/snmpd.conf,添加最后一行 
view systemonly included .1.3.6.1.2.1.1 
view systemonly included .1.3.6.1.2.1.25.1 
view systemonly included .1 
service snmpd restart 
使用下面命令测试 
snmpwalk -v 2c -c public localhost

snmpwalk 
No hostname specified. 
USAGE: snmpwalk [OPTIONS] AGENT [OID]

Version: 5.7.3 
Web: http://www.net-snmp.org/ 
Email: net-snmp-coders@lists.sourceforge.NET

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/baixyu/.snmp/mibs:/usr/share/snmp/mibs:/usr/share/snmp/mibs/iana:/usr/share/snmp/mibs/ietf:/usr/share/mibs/site:/usr/share/snmp/mibs:/usr/share/mibs/iana:/usr/share/mibs/ietf:/usr/share/mibs/netsnmp)
-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

实例: 
获取系统基本信息 
baixyu@ubuntu:~/eclipse_jsnmpwalk -v 2c -c public localhost .1.3.6.1.2.1.1.1.0  
iso.3.6.1.2.1.1.1.0 = STRING: “Linux ubuntu 4.4.0-31-generic #50-Ubuntu SMP Wed Jul 13 00:07:12 UTC 2016 x86_64”  
获取系统提供服务  
baixyu@ubuntu:~/eclipse_j
snmpwalk -v 2c -c public localhost .1.3.6.1.2.1.1.7.0 
iso.3.6.1.2.1.1.7.0 = INTEGER: 72 
获取系统当前运行进程 
baixyu@ubuntu:~/eclipse_j$ snmpwalk -v 2c -c public localhost .1.3.6.1.2.1.25.4.2.1.2 
iso.3.6.1.2.1.25.4.2.1.2.1 = STRING: “systemd” 
iso.3.6.1.2.1.25.4.2.1.2.2 = STRING: “kthreadd” 
iso.3.6.1.2.1.25.4.2.1.2.3 = STRING: “ksoftirqd/0” 
iso.3.6.1.2.1.25.4.2.1.2.5 = STRING: “kworker/0:0H” 
iso.3.6.1.2.1.25.4.2.1.2.7 = STRING: “rcu_sched” 
iso.3.6.1.2.1.25.4.2.1.2.8 = STRING: “rcu_bh” 
iso.3.6.1.2.1.25.4.2.1.2.9 = STRING: “migration/0” 
iso.3.6.1.2.1.25.4.2.1.2.10 = STRING: “watchdog/0” 
iso.3.6.1.2.1.25.4.2.1.2.11 = STRING: “watchdog/1” 
iso.3.6.1.2.1.25.4.2.1.2.12 = STRING: “migration/1” 
iso.3.6.1.2.1.25.4.2.1.2.13 = STRING: “ksoftirqd/1” 
iso.3.6.1.2.1.25.4.2.1.2.15 = STRING: “kworker/1:0H” 
iso.3.6.1.2.1.25.4.2.1.2.16 = STRING: “watchdog/2” 
iso.3.6.1.2.1.25.4.2.1.2.17 = STRING: “migration/2” 
iso.3.6.1.2.1.25.4.2.1.2.18 = STRING: “ksoftirqd/2” 
iso.3.6.1.2.1.25.4.2.1.2.20 = STRING: “kworker/2:0H” 
iso.3.6.1.2.1.25.4.2.1.2.21 = STRING: “watchdog/3” 
iso.3.6.1.2.1.25.4.2.1.2.22 = STRING: “migration/3” 
iso.3.6.1.2.1.25.4.2.1.2.23 = STRING: “ksoftirqd/3” 
iso.3.6.1.2.1.25.4.2.1.2.25 = STRING: “kworker/3:0H” 
iso.3.6.1.2.1.25.4.2.1.2.26 = STRING: “kdevtmpfs” 
iso.3.6.1.2.1.25.4.2.1.2.27 = STRING: “netns” 
iso.3.6.1.2.1.25.4.2.1.2.28 = STRING: “perf” 
iso.3.6.1.2.1.25.4.2.1.2.29 = STRING: “khungtas

下面是使用mib来获取信息的方式 
baixyu@ubuntu:~/eclipse_jsnmpwalkv1cpubliclocalhostUCDSNMPMIB::memBuffer.0UCDSNMPMIB::memBuffer.0=INTEGER:102636kBbaixyu@ubuntu: /eclipsejsnmpwalk -v1 -c public localhost UCD-SNMP-MIB::memTotalFree.0 
UCD-SNMP-MIB::memTotalFree.0 = INTEGER: 3293580 kB

本文出自http://blog.csdn.net/aoerqileng/article/details/52166359